aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/pr49095-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/pr49095-2.c')
-rw-r--r--gcc/testsuite/gcc.target/i386/pr49095-2.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/pr49095-2.c b/gcc/testsuite/gcc.target/i386/pr49095-2.c
new file mode 100644
index 0000000..25bc6b7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr49095-2.c
@@ -0,0 +1,73 @@
+/* PR rtl-optimization/49095 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-Os -fno-shrink-wrap -masm=att -mapxf" } */
+
+void foo (void *);
+
+int *
+f1 (int *x)
+{
+ if (!--*x)
+ foo (x);
+ return x;
+}
+
+int
+g1 (int x)
+{
+ if (!--x)
+ foo ((void *) 0);
+ return x;
+}
+
+#define F(T, OP, OPN) \
+T * \
+f##T##OPN (T *x, T y) \
+{ \
+ *x OP y; \
+ if (!*x) \
+ foo (x); \
+ return x; \
+} \
+ \
+T \
+g##T##OPN (T x, T y) \
+{ \
+ x OP y; \
+ if (!x) \
+ foo ((void *) 0); \
+ return x; \
+} \
+ \
+T * \
+h##T##OPN (T *x) \
+{ \
+ *x OP 24; \
+ if (!*x) \
+ foo (x); \
+ return x; \
+} \
+ \
+T \
+i##T##OPN (T x, T y) \
+{ \
+ x OP 24; \
+ if (!x) \
+ foo ((void *) 0); \
+ return x; \
+}
+
+#define G(T) \
+F (T, +=, plus) \
+F (T, -=, minus) \
+F (T, &=, and) \
+F (T, |=, or) \
+F (T, ^=, xor)
+
+G (char)
+G (short)
+G (int)
+G (long)
+
+/* { dg-final { scan-assembler-not "test\[lq\]" } } */
+/* { dg-final { scan-assembler-not "\\(%\[re\]di\\), %" } } */