blob: f71927c7cf644a7431bf15dc2307a7c639bb5c5e [file] [log] [blame]
Joey Gouly627b4632013-01-24 15:14:22 +00001// RUN: %clang_cc1 -x cl -O0 -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s
2// OpenCL essentially reduces all shift amounts to the last word-size bits before evaluating.
3// Test this both for variables and constants evaluated in the front-end.
4
5//CHECK: @negativeShift32
6int negativeShift32(int a,int b) {
7 //CHECK: %array0 = alloca [256 x i8]
8 char array0[((int)1)<<40];
9 //CHECK: %array1 = alloca [256 x i8]
10 char array1[((int)1)<<(-24)];
11
12 //CHECK: ret i32 65536
13 return ((int)1)<<(-16);
14}