Issue 239041
Summary [NVPTX] "Cannot select: i64 = lround" for llvm.lround / llvm.llround on half and bfloat
Labels new issue
Assignees
Reporter jeffchen006
    `llvm.lround` and `llvm.llround` on `half` and `bfloat` crash ISel at -O0 and -O3 on sm_50 to sm_103a (LLVM 20.1.8, 22.1.8, 23.1.4, main 2d6c6a1ec82b, nightly 2026-11-04); `float` and `double` compile.

```llvm
target triple = "nvptx64-nvidia-cuda"

define i64 @f(half %x) {
  %r = call i64 @llvm.lround.i64.f16(half %x)
  ret i64 %r
}
declare i64 @llvm.lround.i64.f16(half)
```

```
$ llc -mcpu=sm_100a lround.ll -o -
LLVM ERROR: Cannot select: 0x...: i64 = lround 0x...
```

Possible fix: NVPTXISelLowering.cpp:1040 sets Expand for `{ISD::LROUND, ISD::LLROUND}` only on `{MVT::f32, MVT::f64}`, so f16 and bf16 stay Legal with no pattern; add them to that list or promote them to f32.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to