| Issue |
235234
|
| Summary |
[X86] sitofp/uitofp i128 to half shouldn't emit libcalls
|
| Labels |
backend:X86,
missed-optimization
|
| Assignees |
|
| Reporter |
Andarwinux
|
noticed from https://github.com/llvm/llvm-project/pull/235207
https://godbolt.org/z/Mx97Tfr14
```c
f16 src (s128 a){
return a;
}
```
```asm
src:
push rax
call __floattihf@PLT
pop rax
ret
```
should be
```c
f16 tgt (s128 a){
a = __builtin_elementwise_min(a,(s128)INT32_MAX);
a = __builtin_elementwise_max(a,(s128)INT32_MIN);
s32 x = a;
return x;
}
```
```asm
src:
push rax
call __floattihf@PLT
pop rax
ret
tgt:
mov rax, -2147483648
cmp rax, rdi
mov rcx, -1
sbb rdx, rcx, rsi
cmovl rcx, rsi
cmovl rax, rdi
cmp rax, 2147483647
sbb rcx, 0
mov ecx, 2147483647
cmovl ecx, eax
vcvtsi2sh xmm0, xmm31, ecx
ret
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs