Files
wasmtime/cranelift/filetests/filetests/isa/aarch64/constants.clif
Alex Crichton 03b5dbb3e0 aarch64: Use VCodeConstant for f64/v128 constants (#5997)
* aarch64: Translate float and splat lowering to ISLE

I was looking into `constant_f128` and its fallback lowering into memory
and to get familiar with the code I figured it'd be good to port some
Rust logic to ISLE. This commit ports the `constant_{f128,f64,f32}`
helpers into ISLE from Rust as well as the `splat_const` helper which
ended up being closely related.

Tests reflect a number of regalloc changes that happened but also namely
one major difference is that in the lowering of `f32` a 32-bit immediate
is created now instead of a 64-bit immediate (in a GP register before
it's moved into a FP register). This semantically has no change but the
generated code is slightly different in a few minor cases.

* aarch64: Load f64/v128 constants from a pool

This commit removes the `LoadFpuConst64` and `LoadFpuConst128`
pseudo-instructions from the AArch64 backend which internally loaded a
nearby constant and then jumped over it. Constants now go through the
`VCodeConstant` infrastructure which gets placed at the end of the
function similar to how x64 works. Some minor support was added in as
well to add a new addressing mode for a `MachLabel`-relative load.
2023-03-13 19:33:52 +00:00

451 lines
5.7 KiB
Plaintext

test compile precise-output
set unwind_info=false
target aarch64
function %f() -> i8 {
block0:
v0 = iconst.i8 -1
return v0
}
; VCode:
; block0:
; movz w0, #255
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov w0, #0xff
; ret
function %f() -> i16 {
block0:
v0 = iconst.i16 0
return v0
}
; VCode:
; block0:
; movz w0, #0
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov w0, #0
; ret
function %f() -> i64 {
block0:
v0 = iconst.i64 0
return v0
}
; VCode:
; block0:
; movz x0, #0
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov x0, #0
; ret
function %f() -> i64 {
block0:
v0 = iconst.i64 0xffff
return v0
}
; VCode:
; block0:
; movz x0, #65535
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov x0, #0xffff
; ret
function %f() -> i64 {
block0:
v0 = iconst.i64 0xffff0000
return v0
}
; VCode:
; block0:
; movz x0, #65535, LSL #16
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov x0, #0xffff0000
; ret
function %f() -> i64 {
block0:
v0 = iconst.i64 0xffff00000000
return v0
}
; VCode:
; block0:
; movz x0, #65535, LSL #32
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov x0, #0xffff00000000
; ret
function %f() -> i64 {
block0:
v0 = iconst.i64 0xffff000000000000
return v0
}
; VCode:
; block0:
; movz x0, #65535, LSL #48
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov x0, #-0x1000000000000
; ret
function %f() -> i64 {
block0:
v0 = iconst.i64 0xffffffffffffffff
return v0
}
; VCode:
; block0:
; movn x0, #0
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov x0, #-1
; ret
function %f() -> i64 {
block0:
v0 = iconst.i64 0xffffffffffff0000
return v0
}
; VCode:
; block0:
; movn x0, #65535
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov x0, #-0x10000
; ret
function %f() -> i64 {
block0:
v0 = iconst.i64 0xffffffff0000ffff
return v0
}
; VCode:
; block0:
; movn x0, #65535, LSL #16
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov x0, #-0xffff0001
; ret
function %f() -> i64 {
block0:
v0 = iconst.i64 0xffff0000ffffffff
return v0
}
; VCode:
; block0:
; movn x0, #65535, LSL #32
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov x0, #-0xffff00000001
; ret
function %f() -> i64 {
block0:
v0 = iconst.i64 0x0000ffffffffffff
return v0
}
; VCode:
; block0:
; movn x0, #65535, LSL #48
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov x0, #0xffffffffffff
; ret
function %f() -> i64 {
block0:
v0 = iconst.i64 0xf34bf0a31212003a ;; random digits
return v0
}
; VCode:
; block0:
; movz x0, #58
; movk x0, x0, #4626, LSL #16
; movk x0, x0, #61603, LSL #32
; movk x0, x0, #62283, LSL #48
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov x0, #0x3a
; movk x0, #0x1212, lsl #16
; movk x0, #0xf0a3, lsl #32
; movk x0, #0xf34b, lsl #48
; ret
function %f() -> i64 {
block0:
v0 = iconst.i64 0x12e900001ef40000 ;; random digits with 2 clear half words
return v0
}
; VCode:
; block0:
; movz x0, #7924, LSL #16
; movk x0, x0, #4841, LSL #48
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov x0, #0x1ef40000
; movk x0, #0x12e9, lsl #48
; ret
function %f() -> i64 {
block0:
v0 = iconst.i64 0x12e9ffff1ef4ffff ;; random digits with 2 full half words
return v0
}
; VCode:
; block0:
; movn x0, #57611, LSL #16
; movk x0, x0, #4841, LSL #48
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov x0, #-0xe10b0001
; movk x0, #0x12e9, lsl #48
; ret
function %f() -> i32 {
block0:
v0 = iconst.i32 -1
return v0
}
; VCode:
; block0:
; movn w0, #0
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov w0, #-1
; ret
function %f() -> i32 {
block0:
v0 = iconst.i32 0xfffffff7
return v0
}
; VCode:
; block0:
; movn w0, #8
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov w0, #-9
; ret
function %f() -> i64 {
block0:
v0 = iconst.i64 0xfffffff7
return v0
}
; VCode:
; block0:
; movn w0, #8
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov w0, #-9
; ret
function %f() -> i64 {
block0:
v0 = iconst.i64 0xfffffffffffffff7
return v0
}
; VCode:
; block0:
; movn x0, #8
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov x0, #-9
; ret
function %f() -> f64 {
block0:
v0 = f64const 0x1.0
return v0
}
; VCode:
; block0:
; fmov d0, #1
; ret
;
; Disassembled:
; block0: ; offset 0x0
; fmov d0, #1.00000000
; ret
function %f() -> f32 {
block0:
v0 = f32const 0x5.0
return v0
}
; VCode:
; block0:
; fmov s0, #5
; ret
;
; Disassembled:
; block0: ; offset 0x0
; fmov s0, #5.00000000
; ret
function %f() -> f64 {
block0:
v0 = f64const 0x32.0
return v0
}
; VCode:
; block0:
; movz x0, #16457, LSL #48
; fmov d0, x0
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov x0, #0x4049000000000000
; fmov d0, x0
; ret
function %f() -> f32 {
block0:
v0 = f32const 0x32.0
return v0
}
; VCode:
; block0:
; movz w0, #16968, LSL #16
; fmov s0, w0
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov w0, #0x42480000
; fmov s0, w0
; ret
function %f() -> f64 {
block0:
v0 = f64const 0x0.0
return v0
}
; VCode:
; block0:
; movi v0.2s, #0
; ret
;
; Disassembled:
; block0: ; offset 0x0
; movi v0.2s, #0
; ret
function %f() -> f32 {
block0:
v0 = f32const 0x0.0
return v0
}
; VCode:
; block0:
; movi v0.2s, #0
; ret
;
; Disassembled:
; block0: ; offset 0x0
; movi v0.2s, #0
; ret
function %f() -> f64 {
block0:
v0 = f64const -0x10.0
return v0
}
; VCode:
; block0:
; fmov d0, #-16
; ret
;
; Disassembled:
; block0: ; offset 0x0
; fmov d0, #-16.00000000
; ret
function %f() -> f32 {
block0:
v0 = f32const -0x10.0
return v0
}
; VCode:
; block0:
; fmov s0, #-16
; ret
;
; Disassembled:
; block0: ; offset 0x0
; fmov s0, #-16.00000000
; ret