Issue 243004
Summary [RISCV][P-ext] Crash when combining byte multiply-parts intrinsics with add
Labels backend:RISC-V, crash-on-valid
Assignees zeyi2
Reporter zeyi2
    LLVM crashes when compiling an addition of an accumulator and the result of a P-extension byte multiply-parts intrinsic.

### Reproducer

https://godbolt.org/z/6c7cT1bEv

```llvm
define i32 @test(i32 %rd, i32 %a, i32 %b) {
  %acc = bitcast i32 %rd to <2 x i16>
 %av = bitcast i32 %a to <4 x i8>
  %bv = bitcast i32 %b to <4 x i8>
  %m = call <2 x i16> @llvm.riscv.pmul.00.v2i16(<4 x i8> %av, <4 x i8> %bv)
  %r = add <2 x i16> %acc, %m
  %res = bitcast <2 x i16> %r to i32
  ret i32 %res
}

declare <2 x i16> @llvm.riscv.pmul.00.v2i16(<4 x i8>, <4 x i8>)
```

Compile with:

```sh
llc -mtriple=riscv32 -mattr=+experimental-p -O2 -verify-machineinstrs repro.ll
llc -mtriple=riscv64 -mattr=+experimental-p -O2 -verify-machineinstrs repro.ll
```

### Actual behavior

On RV32:

```text
LLVM ERROR: Cannot select: ... v2i16 = RISCVISD::PMACC_HALVES_00 ...
```

On RV64 with assertions enabled:

```text
Don't know how to custom type legalize this intrinsic!
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to