Match: Support form 2 for scalar signed integer .SAT_ADD
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20030222-1.c
blobd619b8159b4c77e05df677a899f6b0a1aa5a4863
1 /* Verify that we get the low part of the long long as an int. We
2 used to get it wrong on big-endian machines, if register allocation
3 succeeded at all. We use volatile to make sure the long long is
4 actually truncated to int, in case a single register is wide enough
5 for a long long. */
6 /* { dg-skip-if "asm requires register allocation" { nvptx-*-* } } */
7 #include <limits.h>
9 void abort (void);
10 void exit (int);
12 void
13 ll_to_int (long long x, volatile int *p)
15 int i;
16 asm ("" : "=r" (i) : "0" (x));
17 *p = i;
20 int val = INT_MIN + 1;
22 int main() {
23 volatile int i;
25 ll_to_int ((long long)val, &i);
26 if (i != val)
27 abort ();
29 exit (0);