Skip to content

Commit 7253825

Browse files
Add return type for OpReadClockKHR SPIR-V friendly IR (#2562) (#2972)
`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. Co-authored-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
1 parent 62c9e88 commit 7253825

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
@@ -3609,6 +3609,7 @@ Instruction *SPIRVToLLVM::transSPIRVBuiltinFromInst(SPIRVInstruction *BI,
36093609
case OpSDotAccSatKHR:
36103610
case OpUDotAccSatKHR:
36113611
case OpSUDotAccSatKHR:
3612+
case OpReadClockKHR:
36123613
case internal::OpJointMatrixLoadINTEL:
36133614
case OpCooperativeMatrixLoadKHR:
36143615
case internal::OpCooperativeMatrixLoadCheckedINTEL:
@@ -3629,6 +3630,7 @@ Instruction *SPIRVToLLVM::transSPIRVBuiltinFromInst(SPIRVInstruction *BI,
36293630
case OpUConvert:
36303631
case OpUDotKHR:
36313632
case OpUDotAccSatKHR:
3633+
case OpReadClockKHR:
36323634
IsRetSigned = false;
36333635
break;
36343636
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)