Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr42833.c
blob5494f98686ec6a5975824d00ae0db3f78b33d8e2
1 typedef __INT_LEAST8_TYPE__ int8_t;
2 typedef __UINT_LEAST32_TYPE__ uint32_t;
3 typedef int ssize_t;
4 typedef struct { int8_t v1; int8_t v2; int8_t v3; int8_t v4; } neon_s8;
6 uint32_t helper_neon_rshl_s8 (uint32_t arg1, uint32_t arg2);
8 uint32_t
9 helper_neon_rshl_s8 (uint32_t arg1, uint32_t arg2)
11 uint32_t res;
12 neon_s8 vsrc1;
13 neon_s8 vsrc2;
14 neon_s8 vdest;
17 union
19 neon_s8 v;
20 uint32_t i;
21 } conv_u;
22 conv_u.i = (arg1);
23 vsrc1 = conv_u.v;
25 while (0);
28 union
30 neon_s8 v;
31 uint32_t i;
32 } conv_u;
33 conv_u.i = (arg2);
34 vsrc2 = conv_u.v;
36 while (0);
39 int8_t tmp;
40 tmp = (int8_t) vsrc2.v1;
41 if (tmp >= (ssize_t) sizeof (vsrc1.v1) * 8)
43 vdest.v1 = 0;
45 else if (tmp < -(ssize_t) sizeof (vsrc1.v1) * 8)
47 vdest.v1 = vsrc1.v1 >> (sizeof (vsrc1.v1) * 8 - 1);
49 else if (tmp == -(ssize_t) sizeof (vsrc1.v1) * 8)
51 vdest.v1 = vsrc1.v1 >> (tmp - 1);
52 vdest.v1++;
53 vdest.v1 >>= 1;
55 else if (tmp < 0)
57 vdest.v1 = (vsrc1.v1 + (1 << (-1 - tmp))) >> -tmp;
59 else
61 vdest.v1 = vsrc1.v1 << tmp;
64 while (0);
67 int8_t tmp;
68 tmp = (int8_t) vsrc2.v2;
69 if (tmp >= (ssize_t) sizeof (vsrc1.v2) * 8)
71 vdest.v2 = 0;
73 else if (tmp < -(ssize_t) sizeof (vsrc1.v2) * 8)
75 vdest.v2 = vsrc1.v2 >> (sizeof (vsrc1.v2) * 8 - 1);
77 else if (tmp == -(ssize_t) sizeof (vsrc1.v2) * 8)
79 vdest.v2 = vsrc1.v2 >> (tmp - 1);
80 vdest.v2++;
81 vdest.v2 >>= 1;
83 else if (tmp < 0)
85 vdest.v2 = (vsrc1.v2 + (1 << (-1 - tmp))) >> -tmp;
87 else
89 vdest.v2 = vsrc1.v2 << tmp;
92 while (0);
95 int8_t tmp;
96 tmp = (int8_t) vsrc2.v3;
97 if (tmp >= (ssize_t) sizeof (vsrc1.v3) * 8)
99 vdest.v3 = 0;
101 else if (tmp < -(ssize_t) sizeof (vsrc1.v3) * 8)
103 vdest.v3 = vsrc1.v3 >> (sizeof (vsrc1.v3) * 8 - 1);
105 else if (tmp == -(ssize_t) sizeof (vsrc1.v3) * 8)
107 vdest.v3 = vsrc1.v3 >> (tmp - 1);
108 vdest.v3++;
109 vdest.v3 >>= 1;
111 else if (tmp < 0)
113 vdest.v3 = (vsrc1.v3 + (1 << (-1 - tmp))) >> -tmp;
115 else
117 vdest.v3 = vsrc1.v3 << tmp;
120 while (0);
123 int8_t tmp;
124 tmp = (int8_t) vsrc2.v4;
125 if (tmp >= (ssize_t) sizeof (vsrc1.v4) * 8)
127 vdest.v4 = 0;
129 else if (tmp < -(ssize_t) sizeof (vsrc1.v4) * 8)
131 vdest.v4 = vsrc1.v4 >> (sizeof (vsrc1.v4) * 8 - 1);
133 else if (tmp == -(ssize_t) sizeof (vsrc1.v4) * 8)
135 vdest.v4 = vsrc1.v4 >> (tmp - 1);
136 vdest.v4++;
137 vdest.v4 >>= 1;
139 else if (tmp < 0)
141 vdest.v4 = (vsrc1.v4 + (1 << (-1 - tmp))) >> -tmp;
143 else
145 vdest.v4 = vsrc1.v4 << tmp;
148 while (0);;
151 union
153 neon_s8 v;
154 uint32_t i;
155 } conv_u;
156 conv_u.v = (vdest);
157 res = conv_u.i;
159 while (0);
160 return res;
163 extern void abort(void);
165 int main()
167 uint32_t r = helper_neon_rshl_s8 (0x05050505, 0x01010101);
168 if (r != 0x0a0a0a0a)
169 abort ();
170 return 0;