Commit 30fd79c
authored
Rollup merge of #63767 - lzutao:integer-ord-suboptimal, r=nagisa
Use more optimal Ord implementation for integers
Closes #63758
r? @nagisa
### Compare results
([godbolt link](https://godbolt.org/z/dsbczy))
Old assembly:
```asm
example::cmp1:
mov eax, dword ptr [rdi]
mov ecx, dword ptr [rsi]
cmp eax, ecx
setae dl
add dl, dl
add dl, -1
xor esi, esi
cmp eax, ecx
movzx eax, dl
cmove eax, esi
ret
```
New assembly:
```asm
example::cmp2:
mov eax, dword ptr [rdi]
xor ecx, ecx
cmp eax, dword ptr [rsi]
seta cl
mov eax, 255
cmovae eax, ecx
ret
```
Old llvm-mca statistics:
```
Iterations: 100
Instructions: 1100
Total Cycles: 243
Total uOps: 1300
Dispatch Width: 6
uOps Per Cycle: 5.35
IPC: 4.53
Block RThroughput: 2.2
```
New llvm-mca statistics:
```
Iterations: 100
Instructions: 700
Total Cycles: 217
Total uOps: 1100
Dispatch Width: 6
uOps Per Cycle: 5.07
IPC: 3.23
Block RThroughput: 1.8
```2 files changed
+33
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1012 | 1012 | | |
1013 | 1013 | | |
1014 | 1014 | | |
1015 | | - | |
1016 | | - | |
1017 | | - | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
1018 | 1020 | | |
1019 | 1021 | | |
1020 | 1022 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
0 commit comments