[committed] Fix previously latent bug in reorg affecting cris port
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / p9-xxbr-1.c
blob00776bd7190ffe4e6baa5cfb4e32c0076ddf540f
1 /* { dg-do compile } */
2 /* { dg-options "-mdejagnu-cpu=power9 -mvsx -O3" } */
3 /* { dg-require-effective-target powerpc_vsx } */
5 #include <altivec.h>
7 /* Verify P9 vec_revb builtin generates the XXBR{Q,D,W,H} instructions. */
9 vector char
10 rev_char (vector char a)
12 return vec_revb (a); /* Is a NOP, maps to move inst */
15 vector bool char
16 rev_bool_char (vector bool char a)
18 return vec_revb (a); /* Is a NOP, maps to move inst */
21 vector signed char
22 rev_schar (vector signed char a)
24 return vec_revb (a); /* Is a NOP, maps to move inst */
27 vector unsigned char
28 rev_uchar (vector unsigned char a)
30 return vec_revb (a); /* Is a NOP, maps to move inst */
33 vector short
34 rev_short (vector short a)
36 return vec_revb (a); /* XXBRH. */
39 vector bool short
40 rev_bool_short (vector bool short a)
42 return vec_revb (a); /* XXBRH. */
45 vector unsigned short
46 rev_ushort (vector unsigned short a)
48 return vec_revb (a); /* XXBRH. */
51 vector int
52 rev_int (vector int a)
54 return vec_revb (a); /* XXBRW. */
57 vector bool int
58 rev_bool_int (vector bool int a)
60 return vec_revb (a); /* XXBRW. */
63 vector unsigned int
64 rev_uint (vector unsigned int a)
66 return vec_revb (a); /* XXBRW. */
69 vector float
70 rev_float (vector float a)
72 return vec_revb (a); /* XXBRW. */
75 vector double
76 rev_double (vector double a)
78 return vec_revb (a); /* XXBRD. */
81 /* { dg-final { scan-assembler-times "xxbrd" 1 } } */
82 /* { dg-final { scan-assembler-times "xxbrh" 3 } } */
83 /* { dg-final { scan-assembler-times "xxbrw" 4 } } */