@@ -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) \
{ \
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
@@ -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" } } */
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
@@ -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" } } */
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
@@ -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" } } */
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
@@ -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" } } */