llvm / llvm/llvm-project

MIPS: optimize some floating load to mfc1

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

Description

```c
double f(double a) {
return a * 4.0;
}
```
```asm
lui $2, %hi(_gp_disp)
addiu $2, $2, %lo(_gp_disp)
addu $1, $2, $25
lw $1, %got($CPI0_0)($1)
ldc1 $f0, %lo($CPI0_0)($1)
jr $ra
mul.d $f0, $f12, $f0
```

In fact we can use
```asm
lui 0x4010
mfhc1
```

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.