[llvm] [GISel][RISCV] Legalize `G_FREM` to use fmod (PR #93063)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 05:41:06 PDT 2024


dtcxzyw wrote:

> It should be possible to test the scalarize case

I tried the following 4 variants, but no one works :(
```
; unable to legalize instruction: %3:_(<2 x s32>) = G_LOAD %1:_(p0) :: (load (<2 x s32>) from %ir.py)
define void @test_v2f32(ptr %px, ptr %py) nounwind {
entry:
  %x = load <2 x float>, ptr %px
  %y = load <2 x float>, ptr %py
  %1 = frem <2 x float> %x, %y
  store <2 x float> %1, ptr %px
  ret void
}

; unable to lower arguments: ptr
define <2 x float> @test_v2f32(<2 x float> %x, <2 x float> %y) nounwind {
entry:
  %1 = frem <2 x float> %x, %y
  ret <2 x float> %1
}

; unable to translate instruction: frem
define void @test_nxv2f32(ptr %px, ptr %py) nounwind {
entry:
  %x = load <vscale x 2 x float>, ptr %px
  %y = load <vscale x 2 x float>, ptr %py
  %1 = frem <vscale x 2 x float> %x, %y
  store <vscale x 2 x float> %1, ptr %px
  ret void
}

; unable to translate instruction: frem
define <vscale x 2 x float> @test_nxv2f32(<vscale x 2 x float> %x, <vscale x 2 x float> %y) nounwind {
entry:
  %1 = frem <vscale x 2 x float> %x, %y
  ret <vscale x 2 x float> %1
}
```


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


More information about the llvm-commits mailing list