diff mbox series

[v2,06/10] Test: Move unsigned integer SAT_ADD simplify testcases to gcc.dg

Message ID 20241031062742.2709845-6-pan2.li@intel.com
State New
Headers show
Series [v2,01/10] Match: Simplify branch form 4 of unsigned SAT_ADD into branchless | expand

Commit Message

Li, Pan2 Oct. 31, 2024, 6:27 a.m. UTC
From: Pan Li <pan2.li@intel.com>

As suggested by Richard, move the SAT_ADD simplify testcases from
the tree-ssa to gcc.dg.

gcc/testsuite/ChangeLog:

	* gcc.dg/sat_arith_simplify.h: Add test macros.
	* gcc.dg/tree-ssa/sat_u_add-simplify-1-u16.c: Move to...
	* gcc.dg/sat_u_add-simplify-1-u16.c: ...here.
	* gcc.dg/tree-ssa/sat_u_add-simplify-1-u32.c: Move to...
	* gcc.dg/sat_u_add-simplify-1-u32.c: ...here.
	* gcc.dg/tree-ssa/sat_u_add-simplify-1-u64.c: Move to...
	* gcc.dg/sat_u_add-simplify-1-u64.c: ...here.
	* gcc.dg/tree-ssa/sat_u_add-simplify-1-u8.c: Move to...
	* gcc.dg/sat_u_add-simplify-1-u8.c: ...here.

Signed-off-by: Pan Li <pan2.li@intel.com>
---
 gcc/testsuite/gcc.dg/sat_arith_simplify.h                 | 6 ++++++
 .../gcc.dg/{tree-ssa => }/sat_u_add-simplify-1-u16.c      | 8 ++------
 .../gcc.dg/{tree-ssa => }/sat_u_add-simplify-1-u32.c      | 8 ++------
 .../gcc.dg/{tree-ssa => }/sat_u_add-simplify-1-u64.c      | 8 ++------
 .../gcc.dg/{tree-ssa => }/sat_u_add-simplify-1-u8.c       | 8 ++------
 5 files changed, 14 insertions(+), 24 deletions(-)
 rename gcc/testsuite/gcc.dg/{tree-ssa => }/sat_u_add-simplify-1-u16.c (75%)
 rename gcc/testsuite/gcc.dg/{tree-ssa => }/sat_u_add-simplify-1-u32.c (75%)
 rename gcc/testsuite/gcc.dg/{tree-ssa => }/sat_u_add-simplify-1-u64.c (75%)
 rename gcc/testsuite/gcc.dg/{tree-ssa => }/sat_u_add-simplify-1-u8.c (75%)
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.dg/sat_arith_simplify.h b/gcc/testsuite/gcc.dg/sat_arith_simplify.h
index 89577ffabb1..1d66f6f25e3 100644
--- a/gcc/testsuite/gcc.dg/sat_arith_simplify.h
+++ b/gcc/testsuite/gcc.dg/sat_arith_simplify.h
@@ -1,6 +1,12 @@ 
 #ifndef HAVE_DEFINED_SAT_ARITH_SIMPLIFY_H
 #define HAVE_DEFINED_SAT_ARITH_SIMPLIFY_H
 
+#define DEF_SAT_U_ADD_1(T)               \
+T sat_u_add_##T##_1 (T x, T y)           \
+{                                        \
+  return (T)(x + y) >= x ? (x + y) : -1; \
+}
+
 #define DEF_SAT_U_ADD_2(T)              \
 T sat_u_add_##T##_2 (T x, T y)          \
 {                                       \
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u16.c b/gcc/testsuite/gcc.dg/sat_u_add-simplify-1-u16.c
similarity index 75%
rename from gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u16.c
rename to gcc/testsuite/gcc.dg/sat_u_add-simplify-1-u16.c
index 7617fbaca45..bf897f4af59 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u16.c
+++ b/gcc/testsuite/gcc.dg/sat_u_add-simplify-1-u16.c
@@ -2,13 +2,9 @@ 
 /* { dg-options "-O2 -fdump-tree-gimple-details" } */
 
 #include <stdint.h>
+#include "sat_arith_simplify.h"
 
-#define T uint16_t
-
-T sat_add_u_1 (T x, T y)
-{
-  return (T)(x + y) >= x ? (x + y) : -1;
-}
+DEF_SAT_U_ADD_1 (uint16_t)
 
 /* { dg-final { scan-tree-dump-not " if " "gimple" } } */
 /* { dg-final { scan-tree-dump-not " else " "gimple" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u32.c b/gcc/testsuite/gcc.dg/sat_u_add-simplify-1-u32.c
similarity index 75%
rename from gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u32.c
rename to gcc/testsuite/gcc.dg/sat_u_add-simplify-1-u32.c
index efea85bfbb7..0ba1d3e92d7 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u32.c
+++ b/gcc/testsuite/gcc.dg/sat_u_add-simplify-1-u32.c
@@ -2,13 +2,9 @@ 
 /* { dg-options "-O2 -fdump-tree-gimple-details" } */
 
 #include <stdint.h>
+#include "sat_arith_simplify.h"
 
-#define T uint32_t
-
-T sat_add_u_1 (T x, T y)
-{
-  return (T)(x + y) >= x ? (x + y) : -1;
-}
+DEF_SAT_U_ADD_1 (uint32_t)
 
 /* { dg-final { scan-tree-dump-not " if " "gimple" } } */
 /* { dg-final { scan-tree-dump-not " else " "gimple" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u64.c b/gcc/testsuite/gcc.dg/sat_u_add-simplify-1-u64.c
similarity index 75%
rename from gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u64.c
rename to gcc/testsuite/gcc.dg/sat_u_add-simplify-1-u64.c
index b7b55d72ede..723799dd612 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u64.c
+++ b/gcc/testsuite/gcc.dg/sat_u_add-simplify-1-u64.c
@@ -2,13 +2,9 @@ 
 /* { dg-options "-O2 -fdump-tree-gimple-details" } */
 
 #include <stdint.h>
+#include "sat_arith_simplify.h"
 
-#define T uint64_t
-
-T sat_add_u_1 (T x, T y)
-{
-  return (T)(x + y) >= x ? (x + y) : -1;
-}
+DEF_SAT_U_ADD_1 (uint64_t)
 
 /* { dg-final { scan-tree-dump-not " if " "gimple" } } */
 /* { dg-final { scan-tree-dump-not " else " "gimple" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u8.c b/gcc/testsuite/gcc.dg/sat_u_add-simplify-1-u8.c
similarity index 75%
rename from gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u8.c
rename to gcc/testsuite/gcc.dg/sat_u_add-simplify-1-u8.c
index 77e9af3dd29..96e8ecb4af1 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/sat_u_add-simplify-1-u8.c
+++ b/gcc/testsuite/gcc.dg/sat_u_add-simplify-1-u8.c
@@ -2,13 +2,9 @@ 
 /* { dg-options "-O2 -fdump-tree-gimple-details" } */
 
 #include <stdint.h>
+#include "sat_arith_simplify.h"
 
-#define T uint8_t
-
-T sat_add_u_1 (T x, T y)
-{
-  return (T)(x + y) >= x ? (x + y) : -1;
-}
+DEF_SAT_U_ADD_1 (uint8_t)
 
 /* { dg-final { scan-tree-dump-not " if " "gimple" } } */
 /* { dg-final { scan-tree-dump-not " else " "gimple" } } */