bytecodealliance / bytecodealliance/wasmtime
[cranelift][x64][arm] Folding fneg + fabs
Open
cranelift
cranelift:area:machinst
cranelift:goal:optimize-speed
enhancement
performance
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 126
Description
`fneg(fabs(x))` could be possible after `copysign(x, -C) -> fneg(fabs(x))` peephole optimization on LLVM / Binaryen, so I guess it's make sense to simplify it further on cranelift during lowering stage.
`x64`:
```asm
orsd xmm0, #0x8000000000000000
```
`ppc`:
```asm
fnabs 1,1
```
`s390x`:
```asm
lndbr %f0,%f0
```
the rest is preserving `fneg + fabs`
Contributor guide
Assessment
This issue has not been assessed yet.