summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/extswsli-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/powerpc/extswsli-2.c')
-rw-r--r--gcc/testsuite/gcc.target/powerpc/extswsli-2.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/powerpc/extswsli-2.c b/gcc/testsuite/gcc.target/powerpc/extswsli-2.c
new file mode 100644
index 00000000000..b92a537b735
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/extswsli-2.c
@@ -0,0 +1,37 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-require-effective-target powerpc_p9modulo_ok } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
+/* { dg-options "-mcpu=power9 -O2" } */
+
+long
+func1 (int reg, int *is_zero)
+{
+ long value;
+
+ __asm__ (" #foo %0" : "+r" (reg));
+ value = ((long)reg) << 4;
+
+ if (!value)
+ *is_zero = 1;
+
+ return value;
+}
+
+long
+func2 (int *ptr, int *is_zero)
+{
+ int reg = *ptr;
+ long value = ((long)reg) << 4;
+
+ if (!value)
+ *is_zero = 1;
+
+ return value;
+}
+
+/* { dg-final { scan-assembler "extswsli\\. " } } */
+/* { dg-final { scan-assembler "lwz " } } */
+/* { dg-final { scan-assembler-not "lwa " } } */
+/* { dg-final { scan-assembler-not "sldi " } } */
+/* { dg-final { scan-assembler-not "sldi\\. " } } */
+/* { dg-final { scan-assembler-not "extsw " } } */