Skip to content

Commit a96b74e

Browse files
committed
Add return type for OpReadClockKHR SPIR-V friendly IR
`OpReadClockKHR` can return unsigned `i64` or `<2 x i32>`. Include the return type in the SPIR-V friendly IR function name, to be able to distinguish between both versions.
1 parent 08835f4 commit a96b74e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/SPIRV/SPIRVReader.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3370,6 +3370,7 @@ Instruction *SPIRVToLLVM::transSPIRVBuiltinFromInst(SPIRVInstruction *BI,
33703370
case OpSDotAccSatKHR:
33713371
case OpUDotAccSatKHR:
33723372
case OpSUDotAccSatKHR:
3373+
case OpReadClockKHR:
33733374
case internal::OpJointMatrixLoadINTEL:
33743375
case OpCooperativeMatrixLoadKHR:
33753376
case internal::OpCooperativeMatrixLoadCheckedINTEL:
@@ -3391,6 +3392,7 @@ Instruction *SPIRVToLLVM::transSPIRVBuiltinFromInst(SPIRVInstruction *BI,
33913392
case OpUConvert:
33923393
case OpUDotKHR:
33933394
case OpUDotAccSatKHR:
3395+
case OpReadClockKHR:
33943396
IsRetSigned = false;
33953397
break;
33963398
case OpImageRead:

test/extensions/KHR/SPV_KHR_shader_clock/shader_clock.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ target triple = "spir64-unknown-unknown"
2424
; CHECK-SPIRV: ReadClockKHR [[#I32v2Ty]] [[#]] [[I32ValId]]
2525
; CHECK-SPIRV: ReadClockKHR [[#I64Ty]] [[#]] [[I32ValId]]
2626

27-
; CHECK-LLVM: call spir_func <2 x i32> @_Z20__spirv_ReadClockKHR
28-
; CHECK-LLVM: call spir_func i64 @_Z20__spirv_ReadClockKHR
27+
; CHECK-LLVM: call spir_func <2 x i32> @_Z27__spirv_ReadClockKHR_Ruint2i(
28+
; CHECK-LLVM: call spir_func i64 @_Z27__spirv_ReadClockKHR_Rulongi(
2929

3030
define spir_func void @_Z7read_types(i32 %a) {
3131
%1 = tail call spir_func <2 x i32> @_Z20__spirv_ReadClockKHRIDv2_jET_j(i32 %a)

0 commit comments

Comments
 (0)