[AMDGPU] Test codegen'ing True16 additions.
[llvm-project.git] / polly / lib / External / isl / isl_test_list_templ.c
blobfa5cb32ff638d6877d118c740e5412b306e98600
1 #define xCAT(A,B) A ## B
2 #define CAT(A,B) xCAT(A,B)
3 #define xFN(TYPE,NAME) TYPE ## _ ## NAME
4 #define FN(TYPE,NAME) xFN(TYPE,NAME)
5 #define xLIST(EL) EL ## _list
6 #define LIST(EL) xLIST(EL)
8 #undef SET
9 #define SET CAT(isl_,SET_BASE)
10 #undef EL
11 #define EL CAT(isl_,EL_BASE)
13 /* Check that the conversion from SET to list of EL works as expected,
14 * using input described by "str".
16 static isl_stat FN(FN(FN(test_get_list,EL_BASE),from),SET_BASE)(isl_ctx *ctx,
17 const char *str)
19 int i;
20 isl_size n;
21 isl_bool equal;
22 SET *set, *set2;
23 LIST(EL) *list;
25 set = FN(SET,read_from_str)(ctx, str);
26 list = FN(FN(SET,get),LIST(EL_BASE))(set);
28 set2 = FN(SET,empty)(FN(SET,get_space)(set));
30 n = FN(LIST(EL),size)(list);
31 for (i = 0; i < n; i++) {
32 EL *el;
33 el = FN(LIST(EL),get_at)(list, i);
34 set2 = FN(SET,union)(set2, FN(FN(SET,from),EL_BASE)(el));
37 equal = FN(SET,is_equal)(set, set2);
39 FN(SET,free)(set);
40 FN(SET,free)(set2);
41 FN(LIST(EL),free)(list);
43 if (n < 0 || equal < 0)
44 return isl_stat_error;
46 if (!equal)
47 isl_die(ctx, isl_error_unknown, "collections are not equal",
48 return isl_stat_error);
50 return isl_stat_ok;