aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/pr84154-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/powerpc/pr84154-2.c')
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr84154-2.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/powerpc/pr84154-2.c b/gcc/testsuite/gcc.target/powerpc/pr84154-2.c
new file mode 100644
index 00000000000..619777ce8dd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr84154-2.c
@@ -0,0 +1,58 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8 -O2" } */
+
+/* PR target/84154. Make sure on ISA 2.07 (power8) that we store the result of
+ a conversion to char/short using an offsettable address does not generate
+ direct moves for storing 32-bit integers, but does do a direct move for
+ 8/16-bit integers. */
+
+void
+double_to_uc (double x, unsigned char *p)
+{
+ p[3] = x;
+}
+
+void
+double_to_sc (double x, signed char *p)
+{
+ p[3] = x;
+}
+
+void
+double_to_us (double x, unsigned short *p)
+{
+ p[3] = x;
+}
+
+void
+double_to_ss (double x, short *p)
+{
+ p[3] = x;
+}
+
+void
+double_to_ui (double x, unsigned int *p)
+{
+ p[3] = x;
+}
+
+void
+double_to_si (double x, int *p)
+{
+ p[3] = x;
+}
+
+/* { dg-final { scan-assembler-times {\mfctiwuz\M|\mxscvdpuxws\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mfctiwz\M|\mxscvdpsxws\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mmfvsrwz\M} 4 } } */
+/* { dg-final { scan-assembler-times {\mstfiwx\M|\mstxsiwx\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mstb\M} 2 } } */
+/* { dg-final { scan-assembler-times {\msth\M} 2 } } */
+/* { dg-final { scan-assembler-not {\mlbz\M} } } */
+/* { dg-final { scan-assembler-not {\mlhz\M} } } */
+/* { dg-final { scan-assembler-not {\mlha\M} } } */
+/* { dg-final { scan-assembler-not {\mmfvsrd\M} } } */
+/* { dg-final { scan-assembler-not {\mstw\M} } } */