2 arith-rand-ll.c from the execute part of the gcc torture tests.
7 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
11 static unsigned long long seed
= 47114711;
12 unsigned long long this = seed
* 1103515245 + 12345;
17 unsigned long long int
20 unsigned long long int x
;
29 n_bits
= (ran
>> 1) % 16;
38 x
|= (1 << n_bits
) - 1;
40 if (tot_bits
> 8 * sizeof (long long) + 6)
47 #define ABS(x) ((x) >= 0 ? (x) : -(x))
50 testTortureExecute (void)
52 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
53 #ifndef __SDCC_mcs51 // Not enough internal RAM for area OSEG.
56 for (i
= 0; i
< 10 /* GCC original was 10000 - take too much time */; i
++)
58 unsigned long long x
, y
;
59 x
= random_bitstring ();
60 y
= random_bitstring ();
62 if (sizeof (int) == sizeof (long long))
65 { unsigned long long xx
= x
, yy
= y
, r1
, r2
;
66 if (yy
== 0) continue;
69 if (r2
>= yy
|| r1
* yy
+ r2
!= xx
)
72 { signed long long xx
= x
, yy
= y
, r1
, r2
;
73 if ((unsigned long long) xx
<< 1 == 0 && yy
== -1)
77 if (ABS (r2
) >= (unsigned long long) ABS (yy
) || (signed long long) (r1
* yy
+ r2
) != xx
)
81 { unsigned int xx
= x
, yy
= y
, r1
, r2
;
82 if (yy
== 0) continue;
85 if (r2
>= yy
|| r1
* yy
+ r2
!= xx
)
88 { signed int xx
= x
, yy
= y
, r1
, r2
;
89 if ((unsigned int) xx
<< 1 == 0 && yy
== -1)
93 if (ABS (r2
) >= (unsigned int) ABS (yy
) || (signed int) (r1
* yy
+ r2
) != xx
|| ((xx
< 0) != (r2
< 0) && r2
))
96 { unsigned short xx
= x
, yy
= y
, r1
, r2
;
97 if (yy
== 0) continue;
100 if (r2
>= yy
|| r1
* yy
+ r2
!= xx
)
103 { signed short xx
= x
, yy
= y
, r1
, r2
;
106 if (ABS (r2
) >= (unsigned short) ABS (yy
) || (signed short) (r1
* yy
+ r2
) != xx
)
109 { unsigned char xx
= x
, yy
= y
, r1
, r2
;
110 if (yy
== 0) continue;
113 if (r2
>= yy
|| r1
* yy
+ r2
!= xx
)
116 { signed char xx
= x
, yy
= y
, r1
, r2
;
119 if (ABS (r2
) >= (unsigned char) ABS (yy
) || (signed char) (r1
* yy
+ r2
) != xx
)