2008-01-25 Douglas Gregor <doug.gregor@gmail.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / multiword-1.c
blobc08161791d6884b86ff7df14550692957416d8fb
1 /* { dg-do run } */
2 /* { dg-options "-O3" } */
3 /* { dg-require-effective-target ilp32 } */
5 typedef unsigned int u32;
6 typedef unsigned long long u64;
8 u64 __attribute__((noinline))
9 foo (u32 high, u32 low)
11 return ((u64)high << 32) | low;
14 u32 __attribute__((noinline))
15 right (u64 t)
17 return (u32)(t >> 32);
20 u64 __attribute__((noinline))
21 left (u32 t)
23 return (u64)t << 32;
26 u32 __attribute__((noinline))
27 right2 (u64 t)
29 return (u32)(t >> 40);
32 u64 __attribute__((noinline))
33 left2 (u32 t)
35 return (u64)t << 40;
38 u64 __attribute__((noinline))
39 zeroextend (u32 t)
41 return (u64)t;
44 extern void abort ();
46 int
47 main ()
49 if (foo (13000, 12000) != 55834574860000ULL)
50 abort ();
52 if (right (55834574860000ULL) != 13000)
53 abort ();
55 if (left (13000) != 55834574848000ULL)
56 abort ();
58 if (right2 (55834574860000ULL) != 50)
59 abort ();
61 if (left2 (13000) != 14293651161088000ULL)
62 abort ();
64 if (zeroextend (13000) != 13000ULL)
65 abort ();
67 return 0;