2 pr42833.c from the execute part of the gcc torture tests.
15 /* If SSIZE_MAX is defined in limits.h, then we are running in a POSIX */
16 /* environment that already has a ssize_t definition (which may have been */
17 /* included indirectly via string.h). In this case, use the guaranteed */
18 /* definition in sys/types.h, otherwise assume int compatible and hope */
21 #include <sys/types.h>
26 #ifndef __SDCC_pdk14 // Lack of memory
27 typedef struct { int8_t v1
; int8_t v2
; int8_t v3
; int8_t v4
; } neon_s8
;
29 uint32_t helper_neon_rshl_s8 (uint32_t arg1
, uint32_t arg2
);
32 helper_neon_rshl_s8 (uint32_t arg1
, uint32_t arg2
)
46 /*vsrc1 = conv_u.v; not in sdcc */
47 memcpy (&vsrc1
, &(conv_u
.v
), sizeof (neon_s8
));
58 /*vsrc2 = conv_u.v; not in sdcc*/
59 memcpy (&vsrc2
, &(conv_u
.v
), sizeof (neon_s8
));
65 tmp
= (int8_t) vsrc2
.v1
;
66 if (tmp
>= (ssize_t
) sizeof (vsrc1
.v1
) * 8)
70 else if (tmp
< -(ssize_t
) sizeof (vsrc1
.v1
) * 8)
72 vdest
.v1
= vsrc1
.v1
>> (sizeof (vsrc1
.v1
) * 8 - 1);
74 else if (tmp
== -(ssize_t
) sizeof (vsrc1
.v1
) * 8)
76 vdest
.v1
= vsrc1
.v1
>> (tmp
- 1);
82 vdest
.v1
= (vsrc1
.v1
+ (1 << (-1 - tmp
))) >> -tmp
;
86 vdest
.v1
= vsrc1
.v1
<< tmp
;
93 tmp
= (int8_t) vsrc2
.v2
;
94 if (tmp
>= (ssize_t
) sizeof (vsrc1
.v2
) * 8)
98 else if (tmp
< -(ssize_t
) sizeof (vsrc1
.v2
) * 8)
100 vdest
.v2
= vsrc1
.v2
>> (sizeof (vsrc1
.v2
) * 8 - 1);
102 else if (tmp
== -(ssize_t
) sizeof (vsrc1
.v2
) * 8)
104 vdest
.v2
= vsrc1
.v2
>> (tmp
- 1);
110 vdest
.v2
= (vsrc1
.v2
+ (1 << (-1 - tmp
))) >> -tmp
;
114 vdest
.v2
= vsrc1
.v2
<< tmp
;
121 tmp
= (int8_t) vsrc2
.v3
;
122 if (tmp
>= (ssize_t
) sizeof (vsrc1
.v3
) * 8)
126 else if (tmp
< -(ssize_t
) sizeof (vsrc1
.v3
) * 8)
128 vdest
.v3
= vsrc1
.v3
>> (sizeof (vsrc1
.v3
) * 8 - 1);
130 else if (tmp
== -(ssize_t
) sizeof (vsrc1
.v3
) * 8)
132 vdest
.v3
= vsrc1
.v3
>> (tmp
- 1);
138 vdest
.v3
= (vsrc1
.v3
+ (1 << (-1 - tmp
))) >> -tmp
;
142 vdest
.v3
= vsrc1
.v3
<< tmp
;
149 tmp
= (int8_t) vsrc2
.v4
;
150 if (tmp
>= (ssize_t
) sizeof (vsrc1
.v4
) * 8)
154 else if (tmp
< -(ssize_t
) sizeof (vsrc1
.v4
) * 8)
156 vdest
.v4
= vsrc1
.v4
>> (sizeof (vsrc1
.v4
) * 8 - 1);
158 else if (tmp
== -(ssize_t
) sizeof (vsrc1
.v4
) * 8)
160 vdest
.v4
= vsrc1
.v4
>> (tmp
- 1);
166 vdest
.v4
= (vsrc1
.v4
+ (1 << (-1 - tmp
))) >> -tmp
;
170 vdest
.v4
= vsrc1
.v4
<< tmp
;
181 /*conv_u.v = (vdest) not in sdcc */;
182 memcpy (&conv_u
.v
, &(vdest
), sizeof (neon_s8
));
191 testTortureExecute (void)
193 #if !(defined(__SDCC_pdk15) && defined(__SDCC_STACK_AUTO)) // Bug #2939
194 #ifndef __SDCC_pdk14 // Lack of memory
195 #if !(defined (__GNUC__) && __GNUC__ < 5)
196 uint32_t r
= helper_neon_rshl_s8 (0x05050505, 0x01010101);