[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:55:27 PDT 2024


dtcxzyw wrote:

> > > It should be possible to test the scalarize case
> > 
> > 
> > I tried the following 4 variants, but no one works :(
> 
> This is the case where MIR tests are useful because you don't have to bring up all the other parts

These MIR tests don't work:
```
---
name:            frem_v2f32
body:             |
  bb.0.entry:
    ; unable to legalize instruction: %3:_(s32), %4:_(s32) = G_UNMERGE_VALUES %0:_(<2 x s32>)
    %0:_(<2 x s32>) = COPY $v8
    %1:_(<2 x s32>) = COPY $v9
    %2:_(<2 x s32>) = G_FREM %0, %1
    $v8 = COPY %2(<2 x s32>)
    PseudoRET implicit $v8

...
---
name:            frem_nxv2f32
body:             |
  bb.0.entry:
    ; Invalid size request on a scalable vector.
    %0:_(<vscale x 2 x s32>) = COPY $v8
    %1:_(<vscale x 2 x s32>) = COPY $v9
    %2:_(<vscale x 2 x s32>) = G_FREM %0, %1
    $v8 = COPY %2(<vscale x 2 x s32>)
    PseudoRET implicit $v8

...
```

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


More information about the llvm-commits mailing list