Browse Source

[s390x] Improve handling of negative i32 constants (#6952)

After https://github.com/bytecodealliance/wasmtime/pull/6850 was merged,
the s390x back-end now always uses iilf instead of lhi to load negative
constants, which is a small code size regression.

Fix the isle predicate to get back lhi whenever possible.
pull/6959/head
Ulrich Weigand 1 year ago
committed by GitHub
parent
commit
5e7ee8ac8a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      cranelift/codegen/src/isa/s390x/inst.isle
  2. 4
      cranelift/filetests/filetests/isa/s390x/constants.clif

2
cranelift/codegen/src/isa/s390x/inst.isle

@ -2989,7 +2989,7 @@
dst))
;; 32-bit result type, value fits in i16
(rule 6 (imm (gpr32_ty ty) (i16_from_u64 n))
(rule 6 (imm (gpr32_ty ty) (u32_pair _ (i16_from_u32 n)))
(let ((dst WritableReg (temp_writable_reg ty))
(_ Unit (emit (MInst.Mov32SImm16 dst n))))
dst))

4
cranelift/filetests/filetests/isa/s390x/constants.clif

@ -189,11 +189,11 @@ block0:
; VCode:
; block0:
; iilf %r2, 4294967295
; lhi %r2, -1
; br %r14
;
; Disassembled:
; block0: ; offset 0x0
; iilf %r2, 0xffffffff
; lhi %r2, -1
; br %r14

Loading…
Cancel
Save