annotate gcc/testsuite/gcc.c-torture/execute/20030222-1.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Verify that we get the low part of the long long as an int. We
kono
parents:
diff changeset
2 used to get it wrong on big-endian machines, if register allocation
kono
parents:
diff changeset
3 succeeded at all. We use volatile to make sure the long long is
kono
parents:
diff changeset
4 actually truncated to int, in case a single register is wide enough
kono
parents:
diff changeset
5 for a long long. */
kono
parents:
diff changeset
6 /* { dg-skip-if "asm requires register allocation" { nvptx-*-* } } */
kono
parents:
diff changeset
7 #include <limits.h>
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 void
kono
parents:
diff changeset
10 ll_to_int (long long x, volatile int *p)
kono
parents:
diff changeset
11 {
kono
parents:
diff changeset
12 int i;
kono
parents:
diff changeset
13 asm ("" : "=r" (i) : "0" (x));
kono
parents:
diff changeset
14 *p = i;
kono
parents:
diff changeset
15 }
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 int val = INT_MIN + 1;
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 int main() {
kono
parents:
diff changeset
20 volatile int i;
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 ll_to_int ((long long)val, &i);
kono
parents:
diff changeset
23 if (i != val)
kono
parents:
diff changeset
24 abort ();
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 exit (0);
kono
parents:
diff changeset
27 }