[llvm] [RISCV][GISel] Do libcall for G_FPTOSI, G_FPTOUI when no D or F support (PR #94613)
Gábor Spaits via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 6 14:53:08 PDT 2024
spaits wrote:
@topperc I have updated the PR. I have discovered, that I could move the test for the libcall cases into the same file in which the non-libcall test are with the help of file check. When running the tests fail in some cases with this:
```
LLVM ERROR: unable to legalize instruction: %4:_(s32), %5:_(s32) = G_UNMERGE_VALUES %0:_(s64) (in function: fptosi_s1_s64)
```
So it says that we have an illegal unmerge that can not be legalized. This does not makes sense to me. I was editing the test for merge a few hours back today and I think this should be legalized by the current rules.
I have then realized, that when we are not on an rv32 system that has D extension we never have a `legalIf` or `legalFor` call. When I add a `legalFor` call then the legalization will be fine.
This is the commit, that introduced that if that made the `legalFor` call for only a specific case: https://github.com/llvm/llvm-project/commit/dbb9043dea238fa4e5b6a9a7fef99623b543493e .
Looking at the instruction selection and register bank info I don't really see why we shouldn't have a `legalFor` when the D extension is not present.
How should I proceed with this PR? Why is there no legal `G_UNMERGE` call when we have a CPU that is not rv32 and has no D extension?
I would really appreciate your help.
https://github.com/llvm/llvm-project/pull/94613
More information about the llvm-commits
mailing list