[llvm] [X86] Add support for `__bf16` to `f16` conversion (PR #134859)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 8 07:27:48 PDT 2025


================
@@ -2456,6 +2456,11 @@ let Predicates = [HasFP16] in {
             (VCMPSHZrmi FR16X:$src1, addr:$src2, (X86cmpm_imm_commute timm:$cc))>;
 }
 
+let Predicates = [HasAVX512, HasBF16] in {
+  def : Pat<(f16 (bitconvert (bf16 FR16X:$src))), (f16 FR16X:$src)>;
+  def : Pat<(bf16 (bitconvert (f16 FR16X:$src))), (bf16 FR16X:$src)>;
+}
----------------
phoebewang wrote:

Yes, we can use `FR16X` for bf16. We used in this way for different vector types within the same size. It just requires updating affected patterns with explicit type cast.

https://github.com/llvm/llvm-project/pull/134859


More information about the llvm-commits mailing list