[AMDGPU] Test codegen'ing True16 additions.
[llvm-project.git] / polly / lib / External / isl / schedule_cmp.c
blob8bf02ea403b44c48b4ada141036703f368f34f93
1 /*
2 * Copyright 2017 Sven Verdoolaege
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege.
7 */
9 #include <stdlib.h>
11 #include <isl/arg.h>
12 #include <isl/options.h>
13 #include <isl/schedule.h>
15 struct options {
16 struct isl_options *isl;
17 char *schedule1;
18 char *schedule2;
21 ISL_ARGS_START(struct options, options_args)
22 ISL_ARG_CHILD(struct options, isl, "isl", &isl_options_args, "isl options")
23 ISL_ARG_ARG(struct options, schedule1, "schedule1", NULL)
24 ISL_ARG_ARG(struct options, schedule2, "schedule2", NULL)
25 ISL_ARGS_END
27 ISL_ARG_DEF(options, struct options, options_args)
29 static void die(const char *msg)
31 fprintf(stderr, "%s\n", msg);
32 exit(EXIT_FAILURE);
35 static FILE *open_or_die(const char *filename)
37 FILE *file;
39 file = fopen(filename, "r");
40 if (!file) {
41 fprintf(stderr, "Unable to open %s\n", filename);
42 exit(EXIT_FAILURE);
44 return file;
47 /* Given two YAML descriptions of isl_schedule objects, check whether
48 * they are equivalent.
49 * Return EXIT_SUCCESS if they are and EXIT_FAILURE if they are not
50 * or if anything else went wrong.
52 int main(int argc, char **argv)
54 isl_ctx *ctx;
55 struct options *options;
56 FILE *input1, *input2;
57 isl_bool equal;
58 isl_schedule *s1, *s2;
60 options = options_new_with_defaults();
61 if (!options)
62 return EXIT_FAILURE;
64 ctx = isl_ctx_alloc_with_options(&options_args, options);
65 argc = options_parse(options, argc, argv, ISL_ARG_ALL);
67 input1 = open_or_die(options->schedule1);
68 input2 = open_or_die(options->schedule2);
69 s1 = isl_schedule_read_from_file(ctx, input1);
70 s2 = isl_schedule_read_from_file(ctx, input2);
72 equal = isl_schedule_plain_is_equal(s1, s2);
73 if (equal < 0)
74 return EXIT_FAILURE;
75 if (!equal)
76 die("schedules differ");
78 isl_schedule_free(s1);
79 isl_schedule_free(s2);
80 fclose(input1);
81 fclose(input2);
82 isl_ctx_free(ctx);
84 return EXIT_SUCCESS;