diagnostics: move output formats from diagnostic.{c,h} to their own files
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / pr94613.c
blob13cab13cb83772b0a285e457de16d96e0a7e022a
1 /* { dg-do run } */
2 /* { dg-require-effective-target vmx_hw } */
3 /* { dg-options "-O2 -maltivec" } */
5 #include <altivec.h>
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
12 vsel. */
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);
31 int
32 main ()
34 vector unsigned char v = (vector unsigned char){ 1 };
36 if (foo (v, v, v)[0] != 3)
37 __builtin_abort ();
39 if (bar (v, v, v)[0] != 1)
40 __builtin_abort ();
42 if (foor (v, v, v)[0] != 3)
43 __builtin_abort ();
45 return 0;