Skip to content

Commit

Permalink
[spirv-ll] Fix a bug in s_mad24 translation
Browse files Browse the repository at this point in the history
We weren't correctly forcing a signed interpretation of the operands.
This showed up when the operands were `OpTypeInt` with the 'signedness'
bit set to 0.
  • Loading branch information
frasercrmck committed Nov 9, 2023
1 parent efb96c3 commit c1f8da5
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions modules/compiler/spirv-ll/source/builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,7 @@ llvm::Value *spirv_ll::Builder::createOCLBuiltinCall(
case OpenCLLIB::SMul_hi:
case OpenCLLIB::SSub_sat:
case OpenCLLIB::SMul24:
case OpenCLLIB::SMad24:
resMangleInfo = MangleInfo::getSigned(resTyId);
for (auto &arg : argInfo) {
arg.forceSign = MangleInfo::ForceSignInfo::ForceSigned;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

; All types, variables and constants
%void_t = OpTypeVoid
%i32_t = OpTypeInt 32 1
%i32_t = OpTypeInt 32 0
%s_mad24_fn_t = OpTypeFunction %void_t
%i32_1 = OpConstant %i32_t 1
%i32_2 = OpConstant %i32_t 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

; All types, variables and constants
%void_t = OpTypeVoid
%i32_t = OpTypeInt 32 1
%i32_t = OpTypeInt 32 0
%v16i32_t = OpTypeVector %i32_t 16
%s_mad24_fn_t = OpTypeFunction %void_t
%i32_1 = OpConstant %i32_t 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

; All types, variables and constants
%void_t = OpTypeVoid
%i32_t = OpTypeInt 32 1
%i32_t = OpTypeInt 32 0
%v2i32_t = OpTypeVector %i32_t 2
%s_mad24_fn_t = OpTypeFunction %void_t
%i32_1 = OpConstant %i32_t 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

; All types, variables and constants
%void_t = OpTypeVoid
%i32_t = OpTypeInt 32 1
%i32_t = OpTypeInt 32 0
%v3i32_t = OpTypeVector %i32_t 3
%s_mad24_fn_t = OpTypeFunction %void_t
%i32_1 = OpConstant %i32_t 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

; All types, variables and constants
%void_t = OpTypeVoid
%i32_t = OpTypeInt 32 1
%i32_t = OpTypeInt 32 0
%v4i32_t = OpTypeVector %i32_t 4
%s_mad24_fn_t = OpTypeFunction %void_t
%i32_1 = OpConstant %i32_t 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

; All types, variables and constants
%void_t = OpTypeVoid
%i32_t = OpTypeInt 32 1
%i32_t = OpTypeInt 32 0
%v8i32_t = OpTypeVector %i32_t 8
%s_mad24_fn_t = OpTypeFunction %void_t
%i32_1 = OpConstant %i32_t 1
Expand Down

0 comments on commit c1f8da5

Please sign in to comment.