<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63347>63347</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[NVPTX][bfloat] sitofp: `Cannot select: t12: bf16 = sint_to_fp t21`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
qcolombet
</td>
</tr>
</table>
<pre>
The NVPTX backend is not able to take advantage of the `bfloat` conversions introduced in PTX 7.8.
When trying to compile the following IR:
```llvm
target datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64"
target triple = "nvptx64-nvidia-cuda"
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
define void @foo(ptr noalias readonly align 16 %arg, ptr noalias align 16 %arg1) local_unnamed_addr #0 {
bb:
%i = addrspacecast ptr %arg1 to ptr addrspace(1)
%i2 = addrspacecast ptr %arg to ptr addrspace(1)
%i11 = load i8, ptr addrspace(1) %i2
%cvt = sitofp i8 %i11 to bfloat
store bfloat %cvt, ptr addrspace(1) %i
ret void
}
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!nvvm.annotations = !{!0, !1, !2, !3}
!0 = !{ptr @foo, !"kernel", i32 1}
!1 = !{ptr @foo, !"maxntidx", i32 64}
!2 = !{ptr @foo, !"maxntidy", i32 1}
!3 = !{ptr @foo, !"maxntidz", i32 1}
```
With:
```
llc -o - <in>.ll -mcpu=sm_90
```
I get:
```
LLVM ERROR: Cannot select: t12: bf16 = sint_to_fp t21
```
I would instead have expected that the compiler would generate:
```
... ld
cvt.bf16.s8 ...
st ...
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8Vk1v2zgQ_TX0ZSBBImVZPviQ1A1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