[llvm] [X86] Expand f32-to-bf16 conversions without libcalls (PR #221225)
Tim Besard via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 24 01:27:15 PDT 2026
maleadt wrote:
Rebased. When doing so, I ran into a pre-existing bug though: `llvm.canonicalize on <8 x bfloat>`/`<16 x bfloat>` fails with "Cannot select: v8bf16 = fcanonicalize" on every target where these types are legal (AVX512BF16, AVX-NE-CONVERT, AVX512FP16, AVX10.2). The operation was left at its default Legal action, but there's no pattern for it. Since this PR also makes `v8bf16` legal on plain AVX, it would have spread that crash to all AVX targets. I fixed it here by adding `ISD::FCANONICALIZE` to the ops promoted to `f32` (it's a one-liner, and it now lowers to a packed `vmulps` by 1.0), and added a test to `bfloat-conversion-vector.ll`. `v32bf16` has the same problem but is set up in a separate block, so I left it alone.
The rebase also picked up #223628, which removed the bf16 INSERT_VECTOR_ELT hook upstream, so this PR no longer touches it.
https://github.com/llvm/llvm-project/pull/221225
More information about the llvm-commits
mailing list