1 /* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
2 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
3 /* { dg-require-effective-target powerpc_p9vector_ok } */
4 /* { dg-options "-mcpu=power9 -O2" } */
6 /* Test that under ISA 3.0 (-mcpu=power9), the compiler optimizes conversion to
7 double after a vec_extract to use the VEXTRACTU{B,H} or XXEXTRACTUW
8 instructions (which leaves the result in a vector register), and not the
9 VEXTU{B,H,W}{L,R}X instructions (which needs a direct move to do the floating
15 fpcvt_int_0 (vector
int a
)
18 int b
= vec_extract (a
, c
);
23 fpcvt_int_3 (vector
int a
)
26 int b
= vec_extract (a
, c
);
31 fpcvt_uint_0 (vector
unsigned int a
)
34 unsigned int b
= vec_extract (a
, c
);
39 fpcvt_uint_3 (vector
unsigned int a
)
42 unsigned int b
= vec_extract (a
, c
);
47 fpcvt_short_0 (vector
short a
)
50 short b
= vec_extract (a
, c
);
55 fpcvt_short_7 (vector
short a
)
58 short b
= vec_extract (a
, c
);
63 fpcvt_ushort_0 (vector
unsigned short a
)
66 unsigned short b
= vec_extract (a
, c
);
71 fpcvt_ushort_7 (vector
unsigned short a
)
74 unsigned short b
= vec_extract (a
, c
);
79 fpcvt_schar_0 (vector
signed char a
)
82 signed char b
= vec_extract (a
, c
);
87 fpcvt_schar_15 (vector
signed char a
)
90 signed char b
= vec_extract (a
, c
);
95 fpcvt_uchar_0 (vector
unsigned char a
)
98 unsigned char b
= vec_extract (a
, c
);
103 fpcvt_uchar_15 (vector
unsigned char a
)
106 signed char b
= vec_extract (a
, c
);
110 /* { dg-final { scan-assembler "vextractu\[bh\] " } } */
111 /* { dg-final { scan-assembler "vexts\[bh\]2d " } } */
112 /* { dg-final { scan-assembler "vspltw " } } */
113 /* { dg-final { scan-assembler "xscvsxddp " } } */
114 /* { dg-final { scan-assembler "xvcvsxwdp " } } */
115 /* { dg-final { scan-assembler "xvcvuxwdp " } } */
116 /* { dg-final { scan-assembler-not "exts\[bhw\] " } } */
117 /* { dg-final { scan-assembler-not "stxv" } } */
118 /* { dg-final { scan-assembler-not "m\[ft\]vsrd " } } */
119 /* { dg-final { scan-assembler-not "m\[ft\]vsrw\[az\] " } } */
120 /* { dg-final { scan-assembler-not "l\[hw\]\[az\] " } } */