<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/152585>152585</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[HLSL][DirectX] `dot2add` generating invalid DXILOpFunction
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kmpeng
</td>
</tr>
</table>
<pre>
Discovered while running the offload-test-suite.
https://godbolt.org/z/MYhG9xhTT
```hlsl
StructuredBuffer<half2> A : register(t0);
StructuredBuffer<half2> B : register(t1);
StructuredBuffer<float> Acc : register(t2);
RWStructuredBuffer<float> Out : register(u3);
[numthreads(1,1,1)]
void main() {
Out[0] = dot2add(A[0], B[0], Acc[0]);
}
```
This code is producing this error:
```
# .---command stdout------------
# | Function: main: error: 'dx.op.dot2AddHalf' is not a DXILOpFuncition for DXILOpcode 'Dot2AddHalf'.
# | note: at '%dx.dot2add.i47 = call float @dx.op.dot2AddHalf(i32 162, float %5, half %7, half %9, half %11, half %13) #3' in block 'entry' of function 'main'.
# | Function: dx.op.dot2AddHalf.f32: error: External function 'dx.op.dot2AddHalf.f32' is unused.
# | Validation failed.
# |
# `-----------------------------
# .---command stderr------------
# | clang-dxc: error: dxv command failed with exit code 1 (use -v to see invocation)
# `-----------------------------
# error: command failed with exit status: 1
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVVGPozYQ_jWTlxHI2CHAAw9kc-lV2uqk3qq9Pjq2Ce45dmSbbK6_vjLJpuR2b6tDiWCMv5lvPs8MPAS9t0q1UK6h3Cz4GAfn26-Ho7L7xc7Jb-1GB-FOyiuJz4M2Cv1orbZ7jINC1_fGcZlFFWIWRh1VDqQD0g0xHgOwDugW6Hbv5M6ZmDu_B7r9B-j2t7-GX5rz8PSUtq_I5TeYYIB0n6MfRRy9kuux75UH9jBw01NgH7BDYB16tdchKg-0jgRoA2z9P7j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