The failure to mask the amount triggered a panic due to a subtraction overflow check; see https://bugzilla.mozilla.org/show_bug.cgi?id=1649432. Attempting to shift by an out-of-range amount should be defined to shift by an amount mod the operand size (i.e., masked to 5 bits for 32-bit shifts, or 6 bits for 64-bit shifts).
32 lines
556 B
Plaintext
32 lines
556 B
Plaintext
test compile
|
|
target aarch64
|
|
|
|
function %f(i64) -> i64 {
|
|
block0(v0: i64):
|
|
v1 = iconst.i64 3
|
|
v2 = ishl.i64 v0, v1
|
|
v3 = iadd.i64 v0, v2
|
|
return v3
|
|
}
|
|
|
|
; check: stp fp, lr, [sp, #-16]!
|
|
; nextln: mov fp, sp
|
|
; nextln: add x0, x0, x0, LSL 3
|
|
; nextln: mov sp, fp
|
|
; nextln: ldp fp, lr, [sp], #16
|
|
; nextln: ret
|
|
|
|
function %f(i32) -> i32 {
|
|
block0(v0: i32):
|
|
v1 = iconst.i32 53
|
|
v2 = ishl.i32 v0, v1
|
|
return v2
|
|
}
|
|
|
|
; check: stp fp, lr, [sp, #-16]!
|
|
; nextln: mov fp, sp
|
|
; nextln: lsl w0, w0, #21
|
|
; nextln: mov sp, fp
|
|
; nextln: ldp fp, lr, [sp], #16
|
|
; nextln: ret
|