Issue 63347
Summary [NVPTX][bfloat] sitofp: `Cannot select: t12: bf16 = sint_to_fp t21`
Labels new issue
Assignees
Reporter qcolombet
    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 ...
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to