fix arm64

This commit is contained in:
kbkpbot 2025-08-08 14:04:22 +08:00
parent de303701f5
commit a5114893a7

View file

@ -10,22 +10,18 @@ module bits
// This function's execution time does not depend on the inputs.
@[inline]
pub fn mul_64(x u64, y u64) (u64, u64) {
$if android {
return mul_64_default(x, y)
} $else {
mut hi := u64(0)
mut lo := u64(0)
asm arm64 {
mul lo, x, y
umulh hi, x, y
; =r (hi)
=r (lo)
; +r (hi)
+r (lo)
; r (x)
r (y)
; cc
}
return hi, lo
}
}
// mul_add_64 returns the 128-bit result of x * y + z: (hi, lo) = x * y + z
@ -33,9 +29,6 @@ pub fn mul_64(x u64, y u64) (u64, u64) {
// half returned in lo.
@[inline]
pub fn mul_add_64(x u64, y u64, z u64) (u64, u64) {
$if android {
return mul_add_64_default(x, y, z)
} $else {
mut hi := u64(0)
mut lo := u64(0)
asm arm64 {
@ -43,13 +36,12 @@ pub fn mul_add_64(x u64, y u64, z u64) (u64, u64) {
umulh hi, x, y
adds lo, lo, z
adc hi, hi, xzr
; =r (hi)
=r (lo)
; +r (hi)
+r (lo)
; r (x)
r (y)
r (z)
; cc
}
return hi, lo
}
}