Index: cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def =================================================================== --- cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def +++ cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def @@ -36,6 +36,7 @@ // Instruction builtins. //===----------------------------------------------------------------------===// BUILTIN(__builtin_amdgcn_s_getreg, "UiIi", "n") +BUILTIN(__builtin_amdgcn_s_getpc, "LUi", "n") BUILTIN(__builtin_amdgcn_s_waitcnt, "vIi", "n") BUILTIN(__builtin_amdgcn_s_sendmsg, "vIiUi", "n") BUILTIN(__builtin_amdgcn_s_sendmsghalt, "vIiUi", "n") Index: cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl =================================================================== --- cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl +++ cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl @@ -481,6 +481,13 @@ *out = __builtin_amdgcn_fmed3f(a, b, c); } +// CHECK-LABEL: @test_s_getpc +// CHECK: call i64 @llvm.amdgcn.s.getpc() +void test_s_getpc(global ulong* out) +{ + *out = __builtin_amdgcn_s_getpc(); +} + // CHECK-DAG: [[WI_RANGE]] = !{i32 0, i32 1024} // CHECK-DAG: attributes #[[NOUNWIND_READONLY:[0-9]+]] = { nounwind readonly } // CHECK-DAG: attributes #[[READ_EXEC_ATTRS]] = { convergent }