[all-commits] [llvm/llvm-project] b55020: [MIPS] add f16 vector bitcast patterns (#226287)

Folkert de Vries via All-commits all-commits at lists.llvm.org
Mon Sep 28 08:48:52 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b550208f48a83a889910e50456003438fc81cd76
      https://github.com/llvm/llvm-project/commit/b550208f48a83a889910e50456003438fc81cd76
  Author: Folkert de Vries <folkert at folkertdev.nl>
  Date:   2026-09-28 (Mon, 28 Sep 2026)

  Changed paths:
    M llvm/lib/Target/Mips/MipsMSAInstrInfo.td
    M llvm/test/CodeGen/Mips/msa/bitcast.ll

  Log Message:
  -----------
  [MIPS] add f16 vector bitcast patterns (#226287)

came across this failure

https://godbolt.org/z/YPK78ea76

```llvm
; -O0 -mtriple=mipsel-linux-gnu -mcpu=mips32r5 -mattr=+msa,+fp64

define <4 x float> @f(<8 x half> %a) {
  %b = bitcast <8 x half> %a to <4 x float>
  ret <4 x float> %b
}
```

Gives 

```
LLVM ERROR: Cannot select: 0x3b4ac900: v8f16 = bitcast 0x3b4acf90
  0x3b4acf90: v4i32 = insert_vector_elt 0x3b4aceb0, 0x3b4ac5f0, Constant:i32<3>
    0x3b4aceb0: v4i32 = insert_vector_elt 0x3b4acdd0, 0x3b4ac510, Constant:i32<2>
      0x3b4acdd0: v4i32 = insert_vector_elt 0x3b4accf0, 0x3b4ac3c0, Constant:i32<1>
        0x3b4accf0: v4i32 = insert_vector_elt undef:v4i32, 0x3b4ac2e0, Constant:i32<0>
          0x3b4ac2e0: i32,ch = CopyFromReg 0x3b3c7b88, Register:i32 %1
        0x3b4ac3c0: i32,ch = CopyFromReg 0x3b3c7b88, Register:i32 %2
      0x3b4ac510: i32,ch = load<(load (s32) from %fixed-stack.1)> 0x3b3c7b88, FrameIndex:i32<-1>, poison:i32
    0x3b4ac5f0: i32,ch = load<(load (s32) from %fixed-stack.0)> 0x3b3c7b88, FrameIndex:i32<-2>, poison:i32
In function: f
```

Just adding the patterns fixes that, and seems straightforward enough.
I'm using `fexupl` in the tests to force the bitcast, otherwise the
bitcast just gets optimized out (and just a store of the input vector
type happens).

This test should maybe start using the automatic update script?



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list