* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
[official-gcc.git] / gcc / testsuite / gcc.target / s390 / insv-1.c
blob020b5d8e3c0466bac8f003f728b883cddef5f251
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -march=z10 -mzarch" } */
4 unsigned long
5 foo1 (unsigned long a, unsigned long b)
7 return (a << 5) | (b & (((1UL << 5) - 1)));
10 /* This generates very different RTX than foo1. The output reg (r2)
11 matches the unshifted argument. So it actually is a
12 (set (zero_extract a 59 0) b) */
13 unsigned long
14 foo2 (unsigned long a, unsigned long b)
16 return (b << 5) | (a & (((1UL << 5) - 1)));
19 /* risbg cannot be used when less bits are removed with the mask. */
21 unsigned long
22 foo1b (unsigned long a, unsigned long b)
24 return (a << 5) | (b & 1);
27 unsigned long
28 foo2b (unsigned long a, unsigned long b)
30 return (b << 5) | (a & 1);
33 /* risbg cannot be used when the masked bits would end up in the
34 result since a real OR is required then. */
35 unsigned long
36 foo1c (unsigned long a, unsigned long b)
38 return (a << 5) | (b & 127);
41 unsigned long
42 foo2c (unsigned long a, unsigned long b)
44 return (b << 5) | (a & 127);
47 unsigned long
48 foo3 (unsigned long a, unsigned long b)
50 #ifdef __s390x__
51 return (a << 5) | (b >> 59);
52 #else
53 return (a << 5) | (b >> 27);
54 #endif
57 unsigned long
58 foo4 (unsigned long a, unsigned long b)
60 #ifdef __s390x__
61 return (b << 5) | (a >> 59);
62 #else
63 return (b << 5) | (a >> 27);
64 #endif
67 /* risbg can be used also if there are some bits spared in the middle
68 of the two chunks. */
69 unsigned long
70 foo3b (unsigned long a, unsigned long b)
72 #ifdef __s390x__
73 return (a << 6) | (b >> 59);
74 #else
75 return (a << 6) | (b >> 27);
76 #endif
79 unsigned long
80 foo4b (unsigned long a, unsigned long b)
82 #ifdef __s390x__
83 return (b << 6) | (a >> 59);
84 #else
85 return (b << 6) | (a >> 27);
86 #endif
89 /* One bit of overlap so better don't use risbg. */
91 unsigned long
92 foo3c (unsigned long a, unsigned long b)
94 #ifdef __s390x__
95 return (a << 4) | (b >> 59);
96 #else
97 return (a << 4) | (b >> 27);
98 #endif
101 unsigned long
102 foo4c (unsigned long a, unsigned long b)
104 #ifdef __s390x__
105 return (b << 4) | (a >> 59);
106 #else
107 return (b << 4) | (a >> 27);
108 #endif
111 /* The functions foo3, foo4, foo3b, foo4b no longer use risbg but rosbg instead.
113 On 64 bit, four risbg go away and four new ones appear in other functions
114 { dg-final { scan-assembler-times "risbg" 6 { target { lp64 } } } }
116 ... but not on 31 bit.
117 { dg-final { scan-assembler-times "risbg" 2 { target { ! lp64 } } } }