@@ -61,4 +61,11 @@ T sat_u_add_##T##_8 (T x, T y) \
return x + y; \
}
+#define DEF_SAT_U_ADD_9(T) \
+T sat_u_add_##T##_9 (T x, T y) \
+{ \
+ T ret; \
+ return __builtin_add_overflow (x, y, &ret) == 0 ? ret : - 1; \
+}
+
#endif
new file mode 100644
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-phiopt2-details" } */
+
+#include <stdint.h>
+#include "sat_arith_simplify.h"
+
+DEF_SAT_U_ADD_9 (uint16_t)
+
+/* { dg-final { scan-tree-dump-not " if " "phiopt2" } } */
+/* { dg-final { scan-tree-dump-not " else " "phiopt2" } } */
+/* { dg-final { scan-tree-dump-not " goto " "phiopt2" } } */
new file mode 100644
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-phiopt2-details" } */
+
+#include <stdint.h>
+#include "sat_arith_simplify.h"
+
+DEF_SAT_U_ADD_9 (uint32_t)
+
+/* { dg-final { scan-tree-dump-not " if " "phiopt2" } } */
+/* { dg-final { scan-tree-dump-not " else " "phiopt2" } } */
+/* { dg-final { scan-tree-dump-not " goto " "phiopt2" } } */
new file mode 100644
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-phiopt2-details" } */
+
+#include <stdint.h>
+#include "sat_arith_simplify.h"
+
+DEF_SAT_U_ADD_9 (uint64_t)
+
+/* { dg-final { scan-tree-dump-not " if " "phiopt2" } } */
+/* { dg-final { scan-tree-dump-not " else " "phiopt2" } } */
+/* { dg-final { scan-tree-dump-not " goto " "phiopt2" } } */
new file mode 100644
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-phiopt2-details" } */
+
+#include <stdint.h>
+#include "sat_arith_simplify.h"
+
+DEF_SAT_U_ADD_9 (uint8_t)
+
+/* { dg-final { scan-tree-dump-not " if " "phiopt2" } } */
+/* { dg-final { scan-tree-dump-not " else " "phiopt2" } } */
+/* { dg-final { scan-tree-dump-not " goto " "phiopt2" } } */