aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-12-11 13:33:13 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-06-23 07:46:39 +0200
commit86af2a17d26712bce69759120c290c5ede88f677 (patch)
treec29b24b7dde23233b88a99fe3fc29538bd18bb5d
parent3e7e84decfebec22936e288e66fd7a5a51f01fc7 (diff)
downloadsparse-dev-86af2a17d26712bce69759120c290c5ede88f677.tar.gz
cast: reorg testcases related to casts
* merge the tests about implicit & explicit casts in a single file as there was a lot of redundancy. * shuffle the tests to linear/ or optim/ Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--validation/bool-cast-explicit.c22
-rw-r--r--validation/bool-cast-implicit.c25
-rw-r--r--validation/linear/bool-cast.c32
-rw-r--r--validation/linear/cast-constant-to-float.c (renamed from validation/cast-constant-to-float.c)0
-rw-r--r--validation/linear/cast-constants.c (renamed from validation/cast-constants.c)0
-rw-r--r--validation/linear/cast-kinds.c (renamed from validation/cast-kinds.c)0
-rw-r--r--validation/linear/fp-vs-ptrcast.c (renamed from validation/fp-vs-ptrcast.c)0
-rw-r--r--validation/linear/fp2i-cast.c (renamed from validation/fp2i-cast.c)0
-rw-r--r--validation/optim/kill-casts.c (renamed from validation/kill-casts.c)0
9 files changed, 32 insertions, 47 deletions
diff --git a/validation/bool-cast-explicit.c b/validation/bool-cast-explicit.c
deleted file mode 100644
index dbb67cc4..00000000
--- a/validation/bool-cast-explicit.c
+++ /dev/null
@@ -1,22 +0,0 @@
-typedef unsigned int u32;
-typedef int s32;
-typedef void *vdp;
-typedef int *sip;
-typedef double dbl;
-typedef unsigned short __attribute__((bitwise)) le16;
-
-static _Bool fs32(s32 a) { return (_Bool)a; }
-static _Bool fu32(u32 a) { return (_Bool)a; }
-static _Bool fvdp(vdp a) { return (_Bool)a; }
-static _Bool fsip(sip a) { return (_Bool)a; }
-static _Bool fdbl(dbl a) { return (_Bool)a; }
-static _Bool ffun(void) { return (_Bool)ffun; }
-
-static _Bool fres(le16 a) { return (_Bool)a; }
-
-/*
- * check-name: bool-cast-explicit
- * check-command: test-linearize -m64 $file
- * check-output-ignore
- * check-output-excludes: cast\\.
- */
diff --git a/validation/bool-cast-implicit.c b/validation/bool-cast-implicit.c
deleted file mode 100644
index 9d89443b..00000000
--- a/validation/bool-cast-implicit.c
+++ /dev/null
@@ -1,25 +0,0 @@
-typedef unsigned int u32;
-typedef int s32;
-typedef void *vdp;
-typedef int *sip;
-typedef double dbl;
-typedef unsigned short __attribute__((bitwise)) le16;
-
-static _Bool fs32(s32 a) { return a; }
-static _Bool fu32(u32 a) { return a; }
-static _Bool fvdp(vdp a) { return a; }
-static _Bool fsip(sip a) { return a; }
-static _Bool fdbl(dbl a) { return a; }
-static _Bool ffun(void) { return ffun; }
-
-static _Bool fres(le16 a) { return a; }
-
-/*
- * check-name: bool-cast-implicit
- * check-command: test-linearize -m64 $file
- * check-output-ignore
- * check-output-excludes: cast\\.
- *
- * check-error-start
- * check-error-end
- */
diff --git a/validation/linear/bool-cast.c b/validation/linear/bool-cast.c
new file mode 100644
index 00000000..981e9f83
--- /dev/null
+++ b/validation/linear/bool-cast.c
@@ -0,0 +1,32 @@
+extern int fun(void);
+typedef unsigned int u32;
+typedef int s32;
+typedef void *vdp;
+typedef int *sip;
+typedef double dbl;
+typedef unsigned short __attribute__((bitwise)) le16;
+
+static _Bool fs32_i(s32 a) { return a; }
+static _Bool fs32_e(s32 a) { return (_Bool)a; }
+static _Bool fu32_i(u32 a) { return a; }
+static _Bool fu32_e(u32 a) { return (_Bool)a; }
+static _Bool fvdp_i(vdp a) { return a; }
+static _Bool fvdp_e(vdp a) { return (_Bool)a; }
+static _Bool fsip_i(sip a) { return a; }
+static _Bool fsip_e(sip a) { return (_Bool)a; }
+static _Bool ffun_i(void) { return fun; }
+static _Bool ffun_e(void) { return (_Bool)fun; }
+static _Bool fres_i(le16 a) { return a; }
+static _Bool fres_e(le16 a) { return (_Bool)a; }
+static _Bool fdbl_i(dbl a) { return a; }
+static _Bool fdbl_e(dbl a) { return (_Bool)a; }
+
+/*
+ * check-name: bool-cast
+ * check-command: test-linearize -m64 -fdump-ir=linearize $file
+ *
+ * check-output-ignore
+ * check-output-excludes: cast\\.
+ * check-output-pattern(12): setne\\.
+ * check-output-pattern(2): fcmpune\\.
+ */
diff --git a/validation/cast-constant-to-float.c b/validation/linear/cast-constant-to-float.c
index ef7892f1..ef7892f1 100644
--- a/validation/cast-constant-to-float.c
+++ b/validation/linear/cast-constant-to-float.c
diff --git a/validation/cast-constants.c b/validation/linear/cast-constants.c
index 9e200672..9e200672 100644
--- a/validation/cast-constants.c
+++ b/validation/linear/cast-constants.c
diff --git a/validation/cast-kinds.c b/validation/linear/cast-kinds.c
index e686c01e..e686c01e 100644
--- a/validation/cast-kinds.c
+++ b/validation/linear/cast-kinds.c
diff --git a/validation/fp-vs-ptrcast.c b/validation/linear/fp-vs-ptrcast.c
index 817aee5c..817aee5c 100644
--- a/validation/fp-vs-ptrcast.c
+++ b/validation/linear/fp-vs-ptrcast.c
diff --git a/validation/fp2i-cast.c b/validation/linear/fp2i-cast.c
index 98d7453e..98d7453e 100644
--- a/validation/fp2i-cast.c
+++ b/validation/linear/fp2i-cast.c
diff --git a/validation/kill-casts.c b/validation/optim/kill-casts.c
index cf52f246..cf52f246 100644
--- a/validation/kill-casts.c
+++ b/validation/optim/kill-casts.c