Skip to content

Commit 8685a5c

Browse files
svenvhsys-ce-bb
authored andcommitted
Add return type for OpReadClockKHR SPIR-V friendly IR (#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. Original commit: KhronosGroup/SPIRV-LLVM-Translator@cbb85269035c574
1 parent 4a240b7 commit 8685a5c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

llvm-spirv/lib/SPIRV/SPIRVReader.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3345,6 +3345,7 @@ Instruction *SPIRVToLLVM::transSPIRVBuiltinFromInst(SPIRVInstruction *BI,
33453345
case OpSDotAccSatKHR:
33463346
case OpUDotAccSatKHR:
33473347
case OpSUDotAccSatKHR:
3348+
case OpReadClockKHR:
33483349
case internal::OpJointMatrixLoadINTEL:
33493350
case OpCooperativeMatrixLoadKHR:
33503351
case internal::OpCooperativeMatrixLoadCheckedINTEL:
@@ -3366,6 +3367,7 @@ Instruction *SPIRVToLLVM::transSPIRVBuiltinFromInst(SPIRVInstruction *BI,
33663367
case OpUConvert:
33673368
case OpUDotKHR:
33683369
case OpUDotAccSatKHR:
3370+
case OpReadClockKHR:
33693371
IsRetSigned = false;
33703372
break;
33713373
case OpImageRead:

llvm-spirv/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)