2 /* { dg-require-effective-target vmx_hw } */
3 /* { dg-options "-O2 -maltivec" } */
7 /* The initial implementation of vec_sel used an IF_THEN_ELSE rtx.
8 This did NOT match what the vsel instruction does. vsel is a
9 bit-wise operation. Using IF_THEN_ELSE made the + operation to be
10 simplified away in combine. A plus operation affects other bits in
11 the same element. Hence per-element simplifications are wrong for
13 vector
unsigned char __attribute__((noinline
))
14 foo (vector
unsigned char a
, vector
unsigned char b
, vector
unsigned char c
)
16 return vec_sel (a
+ b
, c
, a
);
19 vector
unsigned char __attribute__((noinline
))
20 foor (vector
unsigned char a
, vector
unsigned char b
, vector
unsigned char c
)
22 return vec_sel (c
, a
+ b
, ~a
);
25 vector
unsigned char __attribute__((noinline
))
26 bar (vector
unsigned char a
, vector
unsigned char b
, vector
unsigned char c
)
28 return vec_sel (a
| b
, c
, a
);
34 vector
unsigned char v
= (vector
unsigned char){ 1 };
36 if (foo (v
, v
, v
)[0] != 3)
39 if (bar (v
, v
, v
)[0] != 1)
42 if (foor (v
, v
, v
)[0] != 3)