mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[ewasm] Change eq() in polyfill to branch-less version
This commit is contained in:
@@ -90,9 +90,9 @@ function mul_64x64_128(x, y) -> hi, lo {
|
||||
// value split into four 64 bit values.
|
||||
function mul_128x128_256(x1, x2, y1, y2) -> r1, r2, r3, r4 {
|
||||
let ah, al := mul_64x64_128(x1, y1)
|
||||
let bh, bl := mul_64x64_128(x1, y2)
|
||||
let ch, cl := mul_64x64_128(x2, y1)
|
||||
let dh, dl := mul_64x64_128(x2, y2)
|
||||
let bh, bl := mul_64x64_128(x1, y2)
|
||||
let ch, cl := mul_64x64_128(x2, y1)
|
||||
let dh, dl := mul_64x64_128(x2, y2)
|
||||
r4 := dl
|
||||
let carry1, carry2
|
||||
let t1, t2
|
||||
|
||||
@@ -35,15 +35,18 @@ function iszero512(x1, x2, x3, x4, x5, x6, x7, x8) -> r:i32 {
|
||||
}
|
||||
|
||||
function eq(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4 {
|
||||
if i64.eq(x1, y1) {
|
||||
if i64.eq(x2, y2) {
|
||||
if i64.eq(x3, y3) {
|
||||
if i64.eq(x4, y4) {
|
||||
r4 := 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
r4 := i64.extend_i32_u(
|
||||
i32.and(
|
||||
i64.eq(x1, y1),
|
||||
i32.and(
|
||||
i64.eq(x2, y2),
|
||||
i32.and(
|
||||
i64.eq(x3, y3),
|
||||
i64.eq(x4, y4)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// returns 0 if a == b, -1 if a < b and 1 if a > b
|
||||
|
||||
Reference in New Issue
Block a user