1 /* { dg-do run } */
2 /* { dg-options "-O3 -mzarch -march=arch12 --save-temps" } */
3 /* { dg-require-effective-target s390_vxe } */
4
5 typedef unsigned int uv4si __attribute__((vector_size(16)));
6
7 uv4si __attribute__((noinline))
not_xor(uv4si a,uv4si b)8 not_xor (uv4si a, uv4si b)
9 {
10 return ~(a ^ b);
11 }
12 /* { dg-final { scan-assembler-times "vnx\t%v24,%v24,%v26" 1 } } */
13
14 uv4si __attribute__((noinline))
not_and(uv4si a,uv4si b)15 not_and (uv4si a, uv4si b)
16 {
17 return ~(a & b);
18 }
19 /* { dg-final { scan-assembler-times "vnn\t%v24,%v24,%v26" 1 } } */
20
21 uv4si __attribute__((noinline))
or_not(uv4si a,uv4si b)22 or_not (uv4si a, uv4si b)
23 {
24 return a | ~b;
25 }
26 /* { dg-final { scan-assembler-times "voc\t%v24,%v24,%v26" 1 } } */
27
28
29 int
main()30 main ()
31 {
32 uv4si a = (uv4si){ 42, 1, 0, 2 };
33 uv4si b = (uv4si){ 42, 2, 0, 2 };
34 uv4si c;
35
36 c = not_xor (a, b);
37
38 if (c[0] != ~0 || c[1] != ~3 || c[2] != ~0 || c[3] != ~0)
39 __builtin_abort ();
40
41 c = not_and (a, b);
42
43 if (c[0] != ~42 || c[1] != ~0 || c[2] != ~0 || c[3] != ~2)
44 __builtin_abort ();
45
46 c = or_not (a, b);
47
48 if (c[0] != ~0 || c[1] != ~2 || c[2] != ~0 || c[3] != ~0)
49 __builtin_abort ();
50
51 return 0;
52 }
53