1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_p9vector_ok } */
4 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
5 /* { dg-options "-mcpu=power9 -O2" } */
6
7 /* PR target/84154. Make sure on ISA 3.0 we store the result of a conversion
8 to char/short using an offsettable address does not generate direct moves
9 for storing 8/16/32-bit integers. */
10
11 void
double_to_uc(double x,unsigned char * p)12 double_to_uc (double x, unsigned char *p)
13 {
14 p[3] = x;
15 }
16
17 void
double_to_sc(double x,signed char * p)18 double_to_sc (double x, signed char *p)
19 {
20 p[3] = x;
21 }
22
23 void
double_to_us(double x,unsigned short * p)24 double_to_us (double x, unsigned short *p)
25 {
26 p[3] = x;
27 }
28
29 void
double_to_ss(double x,short * p)30 double_to_ss (double x, short *p)
31 {
32 p[3] = x;
33 }
34
35 void
double_to_ui(double x,unsigned int * p)36 double_to_ui (double x, unsigned int *p)
37 {
38 p[3] = x;
39 }
40
41 void
double_to_si(double x,int * p)42 double_to_si (double x, int *p)
43 {
44 p[3] = x;
45 }
46
47 /* { dg-final { scan-assembler-times {\maddi\M} 6 } } */
48 /* { dg-final { scan-assembler-times {\mfctiwuz\M|\mxscvdpuxws\M} 3 } } */
49 /* { dg-final { scan-assembler-times {\mfctiwz\M|\mxscvdpsxws\M} 3 } } */
50 /* { dg-final { scan-assembler-times {\mstfiwx\M|\mstxsiwx\M} 2 } } */
51 /* { dg-final { scan-assembler-times {\mstxsibx\M} 2 } } */
52 /* { dg-final { scan-assembler-times {\mstxsihx\M} 2 } } */
53 /* { dg-final { scan-assembler-not {\mlbz\M} } } */
54 /* { dg-final { scan-assembler-not {\mlhz\M} } } */
55 /* { dg-final { scan-assembler-not {\mlha\M} } } */
56 /* { dg-final { scan-assembler-not {\mmfvsrwz\M} } } */
57 /* { dg-final { scan-assembler-not {\mmfvsrd\M} } } */
58 /* { dg-final { scan-assembler-not {\mstw\M} } } */
59 /* { dg-final { scan-assembler-not {\mstb\M} } } */
60 /* { dg-final { scan-assembler-not {\msth\M} } } */
61