Skip to content

Commit 75193bd

Browse files
svenvhuditagarwal97
authored andcommitted
Add return type for OpReadClockKHR SPIR-V friendly IR (KhronosGroup#2562)
`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 43ff06d commit 75193bd

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
@@ -3580,6 +3580,7 @@ Instruction *SPIRVToLLVM::transSPIRVBuiltinFromInst(SPIRVInstruction *BI,
35803580
case OpSDotAccSatKHR:
35813581
case OpUDotAccSatKHR:
35823582
case OpSUDotAccSatKHR:
3583+
case OpReadClockKHR:
35833584
case internal::OpJointMatrixLoadINTEL:
35843585
case OpCooperativeMatrixLoadKHR:
35853586
case internal::OpCooperativeMatrixLoadCheckedINTEL:
@@ -3600,6 +3601,7 @@ Instruction *SPIRVToLLVM::transSPIRVBuiltinFromInst(SPIRVInstruction *BI,
36003601
case OpUConvert:
36013602
case OpUDotKHR:
36023603
case OpUDotAccSatKHR:
3604+
case OpReadClockKHR:
36033605
IsRetSigned = false;
36043606
break;
36053607
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)