* config/i386/avx512fintrin.h (_mm512_set_epi16, _mm512_set_epi8,
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / tst_1.c
blob285c874fb0e3c0e5f56577d55f5cc44c18d86197
1 /* { dg-do run } */
2 /* { dg-options "-O2 --save-temps -fno-inline" } */
4 extern void abort (void);
6 int
7 tst_si_test1 (int a, int b, int c)
9 int d = a & b;
11 /* { dg-final { scan-assembler-times "tst\tw\[0-9\]+, w\[0-9\]+" 2 } } */
12 if (d == 0)
13 return 12;
14 else
15 return 18;
18 int
19 tst_si_test2 (int a, int b, int c)
21 int d = a & 0x99999999;
23 /* { dg-final { scan-assembler "tst\tw\[0-9\]+, -1717986919" } } */
24 if (d == 0)
25 return 12;
26 else
27 return 18;
30 int
31 tst_si_test3 (int a, int b, int c)
33 int d = a & (b << 3);
35 /* { dg-final { scan-assembler "tst\tw\[0-9\]+, w\[0-9\]+, lsl 3" } } */
36 if (d == 0)
37 return 12;
38 else
39 return 18;
42 typedef long long s64;
44 s64
45 tst_di_test1 (s64 a, s64 b, s64 c)
47 s64 d = a & b;
49 /* { dg-final { scan-assembler-times "tst\tx\[0-9\]+, x\[0-9\]+" 2 } } */
50 if (d == 0)
51 return 12;
52 else
53 return 18;
56 s64
57 tst_di_test2 (s64 a, s64 b, s64 c)
59 s64 d = a & 0xaaaaaaaaaaaaaaaall;
61 /* { dg-final { scan-assembler "tst\tx\[0-9\]+, -6148914691236517206" } } */
62 if (d == 0)
63 return 12;
64 else
65 return 18;
68 s64
69 tst_di_test3 (s64 a, s64 b, s64 c)
71 s64 d = a & (b << 3);
73 /* { dg-final { scan-assembler "tst\tx\[0-9\]+, x\[0-9\]+, lsl 3" } } */
74 if (d == 0)
75 return 12;
76 else
77 return 18;
80 int
81 main ()
83 int x;
84 s64 y;
86 x = tst_si_test1 (29, 4, 5);
87 if (x != 18)
88 abort ();
90 x = tst_si_test1 (5, 2, 20);
91 if (x != 12)
92 abort ();
94 x = tst_si_test2 (29, 4, 5);
95 if (x != 18)
96 abort ();
98 x = tst_si_test2 (1024, 2, 20);
99 if (x != 12)
100 abort ();
102 x = tst_si_test3 (35, 4, 5);
103 if (x != 18)
104 abort ();
106 x = tst_si_test3 (5, 2, 20);
107 if (x != 12)
108 abort ();
110 y = tst_di_test1 (0x130000029ll,
111 0x320000004ll,
112 0x505050505ll);
114 if (y != 18)
115 abort ();
117 y = tst_di_test1 (0x5000500050005ll,
118 0x2111211121112ll,
119 0x0000000002020ll);
120 if (y != 12)
121 abort ();
123 y = tst_di_test2 (0x130000029ll,
124 0x320000004ll,
125 0x505050505ll);
126 if (y != 18)
127 abort ();
129 y = tst_di_test2 (0x540004100ll,
130 0x320000004ll,
131 0x805050205ll);
132 if (y != 12)
133 abort ();
135 y = tst_di_test3 (0x130000029ll,
136 0x064000008ll,
137 0x505050505ll);
138 if (y != 18)
139 abort ();
141 y = tst_di_test3 (0x130002900ll,
142 0x088000008ll,
143 0x505050505ll);
144 if (y != 12)
145 abort ();
147 return 0;