llvm / llvm/llvm-project

RISC-V/NO_ZFA: switch FMAXIMUM of f32/f64 to Expand

Open
#173,446 1 comment 0 reactions 0 assignees View on GitHub
backend:RISC-V missed-optimization
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

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

If this PR is merged, we can switch FMAXIMUM of f32/f64 to Expand, which will get some better performace:

```
f: # @f
# %bb.0: # %entry
feq.d a0, fa0, fa0
fmv.d fa5, fa1
beqz a0, .LBB0_3
# %bb.1: # %entry
feq.d a0, fa1, fa1
beqz a0, .LBB0_4
.LBB0_2: # %entry
fmin.d fa0, fa0, fa5
ret
.LBB0_3: # %entry
fmv.d fa5, fa0
feq.d a0, fa1, fa1
bnez a0, .LBB0_2
.LBB0_4: # %entry
fmin.d fa0, fa1, fa5
ret
```

vs

```
f: # @f
# %bb.0: # %entry
feq.d a0, fa1, fa1
feq.d a1, fa0, fa0
and a0, a1, a0
beqz a0, .LBB0_2
# %bb.1: # %entry
fmin.d fa0, fa0, fa1
ret
.LBB0_2:
lui a0, 4095
slli a0, a0, 39
fmv.d.x fa0, a0
ret
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.