1 /* Verify that overloaded built-ins for vec_cmp with __int128
2 inputs produce the right code. */
3
4 /* { dg-do compile } */
5 /* { dg-require-effective-target power10_ok } */
6 /* { dg-require-effective-target int128 } */
7 /* { dg-options "-mdejagnu-cpu=power10 -O2" } */
8
9 #include <altivec.h>
10
11 vector bool __int128
12 test_eq (vector signed __int128 x, vector signed __int128 y)
13 {
14 return vec_cmpeq (x, y);
15 }
16
17 vector bool __int128
18 testu_eq (vector unsigned __int128 x, vector unsigned __int128 y)
19 {
20 return vec_cmpeq (x, y);
21 }
22
23 vector bool __int128
24 test_ge (vector signed __int128 x, vector signed __int128 y)
25 {
26 return vec_cmpge (x, y);
27 }
28
29 vector bool __int128
30 testu_ge (vector unsigned __int128 x, vector unsigned __int128 y)
31 {
32 return vec_cmpge (x, y);
33 }
34
35 vector bool __int128
36 test_gt (vector signed __int128 x, vector signed __int128 y)
37 {
38 return vec_cmpgt (x, y);
39 }
40
41 vector bool __int128
42 testu_gt (vector unsigned __int128 x, vector unsigned __int128 y)
43 {
44 return vec_cmpgt (x, y);
45 }
46
47 vector bool __int128
48 test_le (vector signed __int128 x, vector signed __int128 y)
49 {
50 return vec_cmple (x, y);
51 }
52
53 vector bool __int128
54 testu_le (vector unsigned __int128 x, vector unsigned __int128 y)
55 {
56 return vec_cmple (x, y);
57 }
58
59 vector bool __int128
60 test_lt (vector signed __int128 x, vector signed __int128 y)
61 {
62 return vec_cmplt (x, y);
63 }
64
65 vector bool __int128
66 testu_lt (vector unsigned __int128 x, vector unsigned __int128 y)
67 {
68 return vec_cmplt (x, y);
69 }
70
71 vector bool __int128
72 test_ne (vector signed __int128 x, vector signed __int128 y)
73 {
74 return vec_cmpne (x, y);
75 }
76
77 vector bool __int128
78 testu_ne (vector unsigned __int128 x, vector unsigned __int128 y)
79 {
80 return vec_cmpne (x, y);
81 }
82
83 /* { dg-final { scan-assembler-times "vcmpequq" 4 } } */
84 /* { dg-final { scan-assembler-times "vcmpgtsq" 4 } } */
85 /* { dg-final { scan-assembler-times "vcmpgtuq" 4 } } */
86 /* { dg-final { scan-assembler-times "xxlnor" 6 } } */
87