Home | History | Annotate | Download | only in SemaOpenCL
      1 // 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: @gtest1 = constant i64 2147483648
      6 __constant const unsigned long gtest1 = 1UL << 31;
      7 
      8 // CHECK: @negativeShift32
      9 int negativeShift32(int a,int b) {
     10   // CHECK: %array0 = alloca [256 x i8]
     11   char array0[((int)1)<<40];
     12   // CHECK: %array1 = alloca [256 x i8]
     13   char array1[((int)1)<<(-24)];
     14 
     15   // CHECK: ret i32 65536
     16   return ((int)1)<<(-16);
     17 }
     18