[all-commits] [llvm/llvm-project] 28dd55: [RISCV][GISel] Do libcall for G_FPTOSI, G_FPTOUI w...
Gábor Spaits via All-commits
all-commits at lists.llvm.org
Fri Jun 7 12:28:11 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 28dd55b97372271591d7802fd7b7eede0832aaa9
https://github.com/llvm/llvm-project/commit/28dd55b97372271591d7802fd7b7eede0832aaa9
Author: Gábor Spaits <gaborspaits1 at gmail.com>
Date: 2024-06-07 (Fri, 07 Jun 2024)
Changed paths:
M llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
A llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-fptoi-rv32-libcall.mir
A llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-fptoi-rv64-libcall.mir
Log Message:
-----------
[RISCV][GISel] Do libcall for G_FPTOSI, G_FPTOUI when no D or F support (#94613)
When compiling the following code:
```cpp
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdbool.h>
int main() {
int a;
float f;
scanf("%d", &a);
scanf("%f", &f);
a += (int)f;
return a;
}
```
for `-march=rv32ima_zbb` we get a libcall:
```
call scanf
lw a0, -20(s0)
call __fixsfsi
mv a1, a0
```
When we try to use GlobalISel we get this error:
```
error in backend: unable to legalize instruction: %9:_(s32) = G_FPTOSI %8:_(s32) (in function: main)
```
(Here is a link to a reproducer in Godblot:
https://godbolt.org/z/f67vEEb41 )
The goal of this PR is to do a libcall for the legalization of
`G_FPTOSI` and `G_FPTOUI` instead of doing a fallback to Selection DAG
to do the same libcall later.
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