Index: clang/include/clang/Basic/TokenKinds.def =================================================================== --- clang/include/clang/Basic/TokenKinds.def +++ clang/include/clang/Basic/TokenKinds.def @@ -586,7 +586,7 @@ ALIAS("read_write", __read_write , KEYOPENCLC | KEYOPENCLCXX) // OpenCL builtins KEYWORD(__builtin_astype , KEYOPENCLC | KEYOPENCLCXX) -UNARY_EXPR_OR_TYPE_TRAIT(vec_step, VecStep, KEYOPENCLC | KEYALTIVEC | KEYZVECTOR) +UNARY_EXPR_OR_TYPE_TRAIT(vec_step, VecStep, KEYOPENCLC | KEYOPENCLCXX | KEYALTIVEC | KEYZVECTOR) #define GENERIC_IMAGE_TYPE(ImgType, Id) KEYWORD(ImgType##_t, KEYOPENCLC | KEYOPENCLCXX) #include "clang/Basic/OpenCLImageTypes.def" KEYWORD(pipe , KEYOPENCLC | KEYOPENCLCXX) Index: clang/test/CodeGenOpenCLCXX/constexpr.cl =================================================================== --- clang/test/CodeGenOpenCLCXX/constexpr.cl +++ clang/test/CodeGenOpenCLCXX/constexpr.cl @@ -52,3 +52,13 @@ kernel void vecEval2(global int2 *x) { *x = fromConstexprFunc; } + +// Test evaluation of vec_step +// CHECK-LABEL: define spir_kernel void @vec_step_test +// CHECK: store i32 6 +constexpr int vsize1 = vec_step(fromConstexprFunc); +constexpr int vsize2 = vec_step(int4); + +kernel void vec_step_test(global int *x) { + *x = vsize1 + vsize2; +}