1/* PR middle-end/24003 */
2/* Contributed by Eric Botcazou <ebotcazou@adacore.com> */
3
4/* { dg-do run } */
5/* { dg-options "-std=c99 -O -fno-inline" } */
6/* { dg-options "-std=c99 -O -fno-inline -mtune=i686" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
7
8#include <limits.h>
9
10typedef unsigned long uns32_t;
11typedef unsigned long long uns64_t;
12
13extern void abort(void);
14
15uns32_t lo (uns64_t p)
16{
17  return (uns32_t)p;
18}
19
20uns64_t concat (uns32_t p1, uns32_t p2)
21{
22#if LLONG_MAX > 2147483647L
23  return ((uns64_t)p1 << 32) | p2;
24#else
25  return 0;
26#endif
27}
28
29uns64_t lshift32 (uns64_t p1, uns32_t p2)
30{
31  return concat (lo (p1), p2);
32}
33
34int main(void)
35{
36#if LLONG_MAX > 2147483647L
37  if (lshift32 (0xFFFFFFFF12345678ULL, 0x90ABCDEFUL) != 0x1234567890ABCDEFULL)
38    abort ();
39#endif
40
41  return 0;
42}
43