s390x: clean up remnants of non-SSA code generation (#5096)

Eliminate a few remaining instances of non-SSA code.
Remove infrastructure previously used for non-SSA code emission.
Related cleanup around flags handling.
This commit is contained in:
Ulrich Weigand
2022-10-24 21:40:50 +02:00
committed by GitHub
parent 6917ba5ae9
commit bfcf6616fe
6 changed files with 256 additions and 364 deletions

View File

@@ -1211,8 +1211,8 @@
(let ((ext_reg Reg (put_in_reg_zext64 x))
;; Ask for a value of 64 in the all-zero 64-bit input case.
;; After compensation this will match the expected semantics.
(clz RegPair (clz_reg 64 ext_reg)))
(clz_offset ty (regpair_hi clz))))
(clz Reg (clz_reg 64 ext_reg)))
(clz_offset ty clz)))
;; Count leading zeros, 128-bit full vector.
(rule (lower (has_type $I128 (clz x)))
@@ -1245,8 +1245,8 @@
(let ((ext_reg Reg (put_in_reg_sext64 x))
(signbit_copies Reg (ashr_imm $I64 ext_reg 63))
(inv_reg Reg (xor_reg $I64 ext_reg signbit_copies))
(clz RegPair (clz_reg 64 inv_reg)))
(cls_offset ty (regpair_hi clz))))
(clz Reg (clz_reg 64 inv_reg)))
(cls_offset ty clz)))
;; Count leading sign-bit copies, 128-bit full vector.
(rule (lower (has_type $I128 (cls x)))
@@ -1281,8 +1281,8 @@
(rule 2 (lower (has_type (gpr32_ty ty) (ctz x)))
(let ((rx Reg (or_uimm16shifted $I64 x (ctz_guardbit ty)))
(lastbit Reg (and_reg $I64 rx (neg_reg $I64 rx)))
(clz RegPair (clz_reg 64 lastbit)))
(sub_reg ty (imm ty 63) (regpair_hi clz))))
(clz Reg (clz_reg 64 lastbit)))
(sub_reg ty (imm ty 63) clz)))
(decl ctz_guardbit (Type) UImm16Shifted)
(rule (ctz_guardbit $I8) (uimm16shifted 256 0))
@@ -1296,8 +1296,8 @@
(rule 1 (lower (has_type (gpr64_ty _ty) (ctz x)))
(let ((rx Reg x)
(lastbit Reg (and_reg $I64 rx (neg_reg $I64 rx)))
(clz RegPair (clz_reg -1 lastbit)))
(sub_reg $I64 (imm $I64 63) (regpair_hi clz))))
(clz Reg (clz_reg -1 lastbit)))
(sub_reg $I64 (imm $I64 63) clz)))
;; Count trailing zeros, 128-bit full vector.
(rule 0 (lower (has_type $I128 (ctz x)))
@@ -2286,7 +2286,7 @@
(let ((tls_offset WritableReg (temp_writable_reg $I64))
(libcall LibCallInfo (lib_call_info_tls_get_offset tls_offset got got_offset symbol))
(_ Unit (lib_accumulate_outgoing_args_size libcall))
(_ Unit (emit_side_effect (lib_call libcall))))
(_ InstOutput (side_effect (lib_call libcall))))
tls_offset))
;; Helper to extract the current thread pointer from %a0/%a1.
@@ -3882,20 +3882,16 @@
;; of the unsigned_add_overflow_condition call to the correct mask.
(rule (lower (trapif (IntCC.UnsignedGreaterThan)
(iadd_ifcout x y) trap_code))
(side_effect (trap_if_impl (mask_as_cond 3) trap_code)))
flags @ (iadd_ifcout _ _) trap_code))
(side_effect
(trap_if_bool (bool (flags_to_producesflags flags) (mask_as_cond 3))
trap_code)))
;;;; Rules for `return` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(rule (lower (return args))
(s390x_lower_return (range 0 (value_slice_len args)) args))
(decl s390x_lower_return (Range ValueSlice) InstOutput)
(rule (s390x_lower_return (range_empty) _) (output_none))
(rule (s390x_lower_return (range_unwrap head tail) args)
(let ((_ Unit (s390x_copy_to_regs (retval head) (value_slice_get args head))))
(s390x_lower_return tail args)))
(lower_return (range 0 (value_slice_len args)) args))
;;;; Rules for `call` and `call_indirect` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -3950,18 +3946,17 @@
(decl lower_call_args_slots (Sig CallArgListBuilder Range ValueSlice) InstOutput)
(rule (lower_call_args_slots abi _ (range_empty) _) (output_none))
(rule (lower_call_args_slots abi uses (range_unwrap head tail) args)
(let ((_ Unit (copy_to_arg uses (abi_lane_order abi)
0 (abi_get_arg abi head)
(value_slice_get args head))))
(let ((_ InstOutput (copy_to_arg uses (abi_lane_order abi)
0 (abi_get_arg abi head)
(value_slice_get args head))))
(lower_call_args_slots abi uses tail args)))
;; Lower function arguments (part 3): implicit return-area pointer.
(decl lower_call_ret_arg (Sig CallArgListBuilder) InstOutput)
(rule (lower_call_ret_arg (abi_no_ret_arg) _) (output_none))
(rule 1 (lower_call_ret_arg abi @ (abi_ret_arg (abi_arg_only_slot slot)) uses)
(let ((ret_arg Reg (load_addr (memarg_stack_off (abi_sized_stack_arg_space abi) 0)))
(_ Unit (copy_reg_to_arg_slot uses (abi_lane_order abi) 0 slot ret_arg)))
(output_none)))
(let ((mem MemArg (memarg_stack_off (abi_sized_stack_arg_space abi) 0)))
(copy_reg_to_arg_slot uses (abi_lane_order abi) 0 slot (load_addr mem))))
;; Lower function return values by collecting them from registers / stack slots.
(decl lower_call_rets (Sig CallRetList Range InstOutputBuilder) InstOutput)