llvm-project/llvm/test/CodeGen/DirectX/dot4add_u8packed.ll
Justin Bogner f695c8d529
[DirectX][SPIRV] Fix the lowering of dot4add (#140315)
There were some issues with these ops:
- The overload wasn't being specified (`dx.op.dot4AddPacked` vs
`dx.op.dot4AddPacked.i32`)
- The versioning wasn't correct (These ops were added in SM 6.4)
- The argument order was off - while the HLSL function has the
accumulator as the last argument, the DXIL op lists it first.

This fixes the DXIL.td definition and adjusts the LLVM DX and SPIRV
intrinsics to match the argument order in DXIL rather than the argument
order in HLSL.

Fixes #139018
2025-05-17 10:38:24 -07:00

13 lines
429 B
LLVM

; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.4-compute %s | FileCheck %s
define void @main(i32 %acc, i32 %x, i32 %y) {
entry:
; CHECK: call i32 @dx.op.dot4AddPacked.i32(i32 164, i32 %acc, i32 %x, i32 %y) #[[#ATTR:]]
%0 = call i32 @llvm.dx.dot4add.u8packed(i32 %acc, i32 %x, i32 %y)
ret void
}
; CHECK: attributes #[[#ATTR]] = {{{.*}} memory(none) {{.*}}}
declare i32 @llvm.dx.dot4add.u8packed(i32, i32, i32)