Skip to content

Commit

Permalink
Add return type for OpReadClockKHR SPIR-V friendly IR (#2562)
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
svenvh authored and uditagarwal97 committed Jan 26, 2025
1 parent 62c9e88 commit ee58b6c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/SPIRV/SPIRVReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3609,6 +3609,7 @@ Instruction *SPIRVToLLVM::transSPIRVBuiltinFromInst(SPIRVInstruction *BI,
case OpSDotAccSatKHR:
case OpUDotAccSatKHR:
case OpSUDotAccSatKHR:
case OpReadClockKHR:
case internal::OpJointMatrixLoadINTEL:
case OpCooperativeMatrixLoadKHR:
case internal::OpCooperativeMatrixLoadCheckedINTEL:
Expand All @@ -3629,6 +3630,7 @@ Instruction *SPIRVToLLVM::transSPIRVBuiltinFromInst(SPIRVInstruction *BI,
case OpUConvert:
case OpUDotKHR:
case OpUDotAccSatKHR:
case OpReadClockKHR:
IsRetSigned = false;
break;
case OpImageRead:
Expand Down
4 changes: 2 additions & 2 deletions test/extensions/KHR/SPV_KHR_shader_clock/shader_clock.ll
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ target triple = "spir64-unknown-unknown"
; CHECK-SPIRV: ReadClockKHR [[#I32v2Ty]] [[#]] [[I32ValId]]
; CHECK-SPIRV: ReadClockKHR [[#I64Ty]] [[#]] [[I32ValId]]

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

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

0 comments on commit ee58b6c

Please sign in to comment.