isl_multi_templ.c: extract out isl_multi_nan_templ.c
authorSven Verdoolaege <sven.verdoolaege@gmail.com>
Thu, 12 Apr 2018 10:06:00 +0000 (12 12:06 +0200)
committerSven Verdoolaege <sven@cerebras.net>
Thu, 2 May 2019 16:19:13 +0000 (2 18:19 +0200)
The isl_multi_*_involves_nan function is only useful
in case the base expressions can actually represent a NaN.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
Makefile.am
include/isl/aff.h
include/isl/multi.h
include/isl/val.h
isl_aff.c
isl_multi_nan_templ.c [new file with mode: 0644]
isl_multi_templ.c
isl_val.c

index ad6ec67..aae0a3b 100644 (file)
@@ -486,6 +486,7 @@ EXTRA_DIST = \
        isl_multi_intersect.c \
        isl_multi_identity_templ.c \
        isl_multi_move_dims_templ.c \
+       isl_multi_nan_templ.c \
        isl_multi_param_templ.c \
        isl_multi_product_templ.c \
        isl_multi_splice_templ.c \
index 213ed20..077504b 100644 (file)
@@ -419,6 +419,7 @@ __isl_give isl_set *isl_pw_aff_list_gt_set(__isl_take isl_pw_aff_list *list1,
 ISL_DECLARE_MULTI(aff)
 ISL_DECLARE_MULTI_CMP(aff)
 ISL_DECLARE_MULTI_ARITH(aff)
+ISL_DECLARE_MULTI_NAN(aff)
 ISL_DECLARE_MULTI_DIMS(aff)
 ISL_DECLARE_MULTI_WITH_DOMAIN(aff)
 
@@ -475,6 +476,7 @@ void isl_multi_aff_dump(__isl_keep isl_multi_aff *maff);
 
 ISL_DECLARE_MULTI(pw_aff)
 ISL_DECLARE_MULTI_ARITH(pw_aff)
+ISL_DECLARE_MULTI_NAN(pw_aff)
 ISL_DECLARE_MULTI_DIMS(pw_aff)
 ISL_DECLARE_MULTI_WITH_DOMAIN(pw_aff)
 ISL_DECLARE_MULTI_PARAM(pw_aff)
@@ -1003,6 +1005,7 @@ void isl_union_pw_aff_dump(__isl_keep isl_union_pw_aff *upa);
 
 ISL_DECLARE_MULTI(union_pw_aff)
 ISL_DECLARE_MULTI_ARITH(union_pw_aff)
+ISL_DECLARE_MULTI_NAN(union_pw_aff)
 
 __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_from_multi_aff(
        __isl_take isl_multi_aff *ma);
index 1811898..b20a655 100644 (file)
@@ -37,8 +37,6 @@ __isl_export                                                          \
 isl_bool isl_multi_##BASE##_plain_is_equal(                            \
        __isl_keep isl_multi_##BASE *multi1,                            \
        __isl_keep isl_multi_##BASE *multi2);                           \
-isl_bool isl_multi_##BASE##_involves_nan(                              \
-       __isl_keep isl_multi_##BASE *multi);                            \
 int isl_multi_##BASE##_find_dim_by_id(                                 \
        __isl_keep isl_multi_##BASE *multi, enum isl_dim_type type,     \
        __isl_keep isl_id *id);                                         \
@@ -134,6 +132,10 @@ __isl_export                                                               \
 __isl_give isl_multi_##BASE *isl_multi_##BASE##_neg(                   \
        __isl_take isl_multi_##BASE *multi);
 
+#define ISL_DECLARE_MULTI_NAN(BASE)                                    \
+isl_bool isl_multi_##BASE##_involves_nan(                              \
+       __isl_keep isl_multi_##BASE *multi);
+
 #define ISL_DECLARE_MULTI_DIMS(BASE)                                   \
 isl_bool isl_multi_##BASE##_involves_dims(                             \
        __isl_keep isl_multi_##BASE *multi, enum isl_dim_type type,     \
index d51984d..442b00e 100644 (file)
@@ -14,6 +14,7 @@ extern "C" {
 
 ISL_DECLARE_MULTI(val)
 ISL_DECLARE_MULTI_ARITH(val)
+ISL_DECLARE_MULTI_NAN(val)
 ISL_DECLARE_MULTI_DIMS(val)
 ISL_DECLARE_MULTI_WITH_DOMAIN(val)
 
index 1e0299f..681794c 100644 (file)
--- a/isl_aff.c
+++ b/isl_aff.c
@@ -3833,6 +3833,7 @@ error:
 #include <isl_multi_gist.c>
 #include <isl_multi_identity_templ.c>
 #include <isl_multi_move_dims_templ.c>
+#include <isl_multi_nan_templ.c>
 #include <isl_multi_product_templ.c>
 #include <isl_multi_splice_templ.c>
 #include <isl_multi_zero_templ.c>
@@ -6231,6 +6232,7 @@ error:
 #include <isl_multi_align_set.c>
 #include <isl_multi_intersect.c>
 #include <isl_multi_move_dims_templ.c>
+#include <isl_multi_nan_templ.c>
 #include <isl_multi_param_templ.c>
 #include <isl_multi_product_templ.c>
 #include <isl_multi_splice_templ.c>
@@ -8005,6 +8007,7 @@ error:
 #include <isl_multi_align_set.c>
 #include <isl_multi_align_union_set.c>
 #include <isl_multi_intersect.c>
+#include <isl_multi_nan_templ.c>
 
 /* Does "mupa" have a non-trivial explicit domain?
  *
diff --git a/isl_multi_nan_templ.c b/isl_multi_nan_templ.c
new file mode 100644 (file)
index 0000000..6457e91
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2014      Ecole Normale Superieure
+ *
+ * Use of this software is governed by the MIT license
+ *
+ * Written by Sven Verdoolaege,
+ * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
+ */
+
+#include <isl_multi_macro.h>
+
+/* Does "multi" involve any NaNs?
+ */
+isl_bool FN(MULTI(BASE),involves_nan)(__isl_keep MULTI(BASE) *multi)
+{
+       int i;
+
+       if (!multi)
+               return isl_bool_error;
+       if (multi->n == 0)
+               return isl_bool_false;
+
+       for (i = 0; i < multi->n; ++i) {
+               isl_bool has_nan = FN(EL,involves_nan)(multi->u.p[i]);
+               if (has_nan < 0 || has_nan)
+                       return has_nan;
+       }
+
+       return isl_bool_false;
+}
index 9d0b336..fea2d3f 100644 (file)
@@ -1012,23 +1012,3 @@ isl_bool FN(MULTI(BASE),plain_is_equal)(__isl_keep MULTI(BASE) *multi1,
 
        return isl_bool_true;
 }
-
-/* Does "multi" involve any NaNs?
- */
-isl_bool FN(MULTI(BASE),involves_nan)(__isl_keep MULTI(BASE) *multi)
-{
-       int i;
-
-       if (!multi)
-               return isl_bool_error;
-       if (multi->n == 0)
-               return isl_bool_false;
-
-       for (i = 0; i < multi->n; ++i) {
-               isl_bool has_nan = FN(EL,involves_nan)(multi->u.p[i]);
-               if (has_nan < 0 || has_nan)
-                       return has_nan;
-       }
-
-       return isl_bool_false;
-}
index f2bdb53..3c90cf8 100644 (file)
--- a/isl_val.c
+++ b/isl_val.c
@@ -1676,6 +1676,7 @@ isl_stat isl_val_check_match_domain_space(__isl_keep isl_val *v,
 #include <isl_multi_templ.c>
 #include <isl_multi_arith_templ.c>
 #include <isl_multi_dims.c>
+#include <isl_multi_nan_templ.c>
 #include <isl_multi_product_templ.c>
 #include <isl_multi_splice_templ.c>
 #include <isl_multi_zero_templ.c>