summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/i386-cmov1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/i386-cmov1.c')
-rw-r--r--gcc/testsuite/gcc.dg/i386-cmov1.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/i386-cmov1.c b/gcc/testsuite/gcc.dg/i386-cmov1.c
new file mode 100644
index 00000000000..1f7ff727bc4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/i386-cmov1.c
@@ -0,0 +1,29 @@
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2 -march=athlon" } */
+/* { dg-final { scan-assembler "sar.*magic_namea" } } */
+/* { dg-final { scan-assembler "sar.*magic_nameb" } } */
+/* { dg-final { scan-assembler "sar.*magic_namec" } } */
+/* { dg-final { scan-assembler "shr.*magic_named" } } */
+/* { dg-final { scan-assembler "shr.*magic_namee" } } */
+/* { dg-final { scan-assembler "shr.*magic_namef" } } */
+
+/* Check code generation for several conditional moves doable by single arithmetics. */
+
+int magic_namea;
+char magic_nameb;
+short magic_namec;
+int magic_named;
+char magic_namee;
+short magic_namef;
+
+unsigned int gen;
+m()
+{
+ magic_namec=magic_namec>=0?0:-1;
+ magic_namea=magic_namea>=0?0:-1;
+ magic_nameb=magic_nameb>=0?0:-1;
+ magic_named=magic_named>=0?0:1;
+ magic_namee=magic_namee>=0?0:1;
+ magic_namef=magic_namef>=0?0:1;
+}
+