]> gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/gcc.target/powerpc/p9-xxbr-1.c
rs6000.c (swap_endian_selector_for_mode): Remove le_ and be_ prefixes to swap* variables.
[gcc.git] / gcc / testsuite / gcc.target / powerpc / p9-xxbr-1.c
1 /* { dg-do compile { target { powerpc*-*-* && { lp64 && p9vector_hw } } } } */
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 -O3" } */
5
6 #include <altivec.h>
7
8 /* Verify P9 vec_revb builtin generates the XXBR{Q,D,W,H} instructions. */
9
10 vector char
11 rev_char (vector char a)
12 {
13 return vec_revb (a); /* Is a NOP, maps to move inst */
14 }
15
16 vector bool char
17 rev_bool_char (vector bool char a)
18 {
19 return vec_revb (a); /* Is a NOP, maps to move inst */
20 }
21
22 vector signed char
23 rev_schar (vector signed char a)
24 {
25 return vec_revb (a); /* Is a NOP, maps to move inst */
26 }
27
28 vector unsigned char
29 rev_uchar (vector unsigned char a)
30 {
31 return vec_revb (a); /* Is a NOP, maps to move inst */
32 }
33
34 vector short
35 rev_short (vector short a)
36 {
37 return vec_revb (a); /* XXBRH. */
38 }
39
40 vector bool short
41 rev_bool_short (vector bool short a)
42 {
43 return vec_revb (a); /* XXBRH. */
44 }
45
46 vector unsigned short
47 rev_ushort (vector unsigned short a)
48 {
49 return vec_revb (a); /* XXBRH. */
50 }
51
52 vector int
53 rev_int (vector int a)
54 {
55 return vec_revb (a); /* XXBRW. */
56 }
57
58 vector bool int
59 rev_bool_int (vector bool int a)
60 {
61 return vec_revb (a); /* XXBRW. */
62 }
63
64 vector unsigned int
65 rev_uint (vector unsigned int a)
66 {
67 return vec_revb (a); /* XXBRW. */
68 }
69
70 vector float
71 rev_float (vector float a)
72 {
73 return vec_revb (a); /* XXBRW. */
74 }
75
76 vector double
77 rev_double (vector double a)
78 {
79 return vec_revb (a); /* XXBRD. */
80 }
81
82 /* { dg-final { scan-assembler-times "xxbrd" 1 } } */
83 /* { dg-final { scan-assembler-times "xxbrh" 3 } } */
84 /* { dg-final { scan-assembler-times "xxbrw" 4 } } */
This page took 0.038505 seconds and 5 git commands to generate.