comparison gcc/testsuite/gcc.dg/multiword-1.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* { dg-do run } */
2 /* { dg-options "-O3" } */
3 /* { dg-require-effective-target ilp32 } */
4
5 typedef unsigned int u32;
6 typedef unsigned long long u64;
7
8 u64 __attribute__((noinline))
9 foo (u32 high, u32 low)
10 {
11 return ((u64)high << 32) | low;
12 }
13
14 u32 __attribute__((noinline))
15 right (u64 t)
16 {
17 return (u32)(t >> 32);
18 }
19
20 u64 __attribute__((noinline))
21 left (u32 t)
22 {
23 return (u64)t << 32;
24 }
25
26 u32 __attribute__((noinline))
27 right2 (u64 t)
28 {
29 return (u32)(t >> 40);
30 }
31
32 u64 __attribute__((noinline))
33 left2 (u32 t)
34 {
35 return (u64)t << 40;
36 }
37
38 u64 __attribute__((noinline))
39 zeroextend (u32 t)
40 {
41 return (u64)t;
42 }
43
44 extern void abort ();
45
46 int
47 main ()
48 {
49 if (foo (13000, 12000) != 55834574860000ULL)
50 abort ();
51
52 if (right (55834574860000ULL) != 13000)
53 abort ();
54
55 if (left (13000) != 55834574848000ULL)
56 abort ();
57
58 if (right2 (55834574860000ULL) != 50)
59 abort ();
60
61 if (left2 (13000) != 14293651161088000ULL)
62 abort ();
63
64 if (zeroextend (13000) != 13000ULL)
65 abort ();
66
67 return 0;
68 }