diff options
| author | Trevor Gross <tmgross@umich.edu> | 2025-02-08 04:09:59 +0000 |
|---|---|---|
| committer | Trevor Gross <t.gross35@gmail.com> | 2025-02-09 23:41:51 -0600 |
| commit | 2f0685a9a2a72248b10cd70ca9d013c0ab9bf286 (patch) | |
| tree | b6fc18124de9f7ea863131ea48dcc32ab554b0f3 /tests/codegen/patchable-function-entry | |
| parent | b7fdce0505cf015d4f983064adf2b6a31d52db69 (diff) | |
| download | rust-2f0685a9a2a72248b10cd70ca9d013c0ab9bf286.tar.gz rust-2f0685a9a2a72248b10cd70ca9d013c0ab9bf286.zip | |
Implement `u256` with two `u128`s rather than `u64`
This produces better assembly, e.g. on aarch64:
.globl libm::u128_wmul
.p2align 2
libm::u128_wmul:
Lfunc_begin124:
.cfi_startproc
mul x9, x2, x0
umulh x10, x2, x0
umulh x11, x3, x0
mul x12, x3, x0
umulh x13, x2, x1
mul x14, x2, x1
umulh x15, x3, x1
mul x16, x3, x1
adds x10, x10, x14
cinc x13, x13, hs
adds x13, x13, x16
cinc x14, x15, hs
adds x10, x10, x12
cinc x11, x11, hs
adds x11, x13, x11
stp x9, x10, [x8]
cinc x9, x14, hs
stp x11, x9, [x8, rust-lang/libm#16]
ret
The original was ~70 instructions so the improvement is significant.
With these changes, the result is reasonably close to what LLVM
generates using `u256` operands [1].
[1]: https://llvm.godbolt.org/z/re1aGdaqY
Diffstat (limited to 'tests/codegen/patchable-function-entry')
0 files changed, 0 insertions, 0 deletions
