Skip to content

Commit

Permalink
Review feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
cfallin committed Jan 23, 2025
1 parent c214eea commit 9a932fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
19 changes: 7 additions & 12 deletions cranelift/codegen/src/isa/s390x/inst.isle
Original file line number Diff line number Diff line change
Expand Up @@ -2694,10 +2694,13 @@
(rule (cond_br taken not_taken cond)
(ConsumesFlags.ConsumesFlagsSideEffect (MInst.CondBr taken not_taken cond)))

;; Helper for emitting `MInst.JTSequence` instructions.
(decl jt_sequence (Reg MachLabel Cond BoxVecMachLabel) ConsumesFlags)
(rule (jt_sequence ridx default default_cond targets)
(ConsumesFlags.ConsumesFlagsSideEffect (MInst.JTSequence ridx default default_cond targets)))
;; Helper for emitting `MInst.JTSequence` instructions with a
;; ProducesBool for the default-label condition.
(decl jt_sequence (Reg MachLabel ProducesBool BoxVecMachLabel) SideEffectNoResult)
(rule (jt_sequence ridx default (ProducesBool.ProducesBool default_cond_producer default_cond) targets)
(with_flags_side_effect
default_cond_producer
(ConsumesFlags.ConsumesFlagsSideEffect (MInst.JTSequence ridx default default_cond targets))))

;; Helpers for instruction sequences ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Expand Down Expand Up @@ -3310,14 +3313,6 @@
(decl bool (ProducesFlags Cond) ProducesBool)
(rule (bool producer cond) (ProducesBool.ProducesBool producer cond))

;; Get the producer from a ProducesBool.
(decl bool_producer (ProducesBool) ProducesFlags)
(rule (bool_producer (ProducesBool.ProducesBool producer _)) producer)

;; Get the condition from a ProducesBool.
(decl bool_cond (ProducesBool) Cond)
(rule (bool_cond (ProducesBool.ProducesBool _ cond)) cond)

;; Invert boolean condition.
(decl invert_bool (ProducesBool) ProducesBool)
(rule (invert_bool (ProducesBool.ProducesBool producer cond))
Expand Down
8 changes: 2 additions & 6 deletions cranelift/codegen/src/isa/s390x/lower.isle
Original file line number Diff line number Diff line change
Expand Up @@ -3733,9 +3733,7 @@
;; denotes the "default target" condition.
(cond ProducesBool
(bool (icmpu_uimm32 $I64 idx (jump_table_size targets))
(intcc_as_cond (IntCC.UnsignedGreaterThanOrEqual))))
(default_cond_producer ProducesFlags (bool_producer cond))
(default_cond Cond (bool_cond cond)))
(intcc_as_cond (IntCC.UnsignedGreaterThanOrEqual)))))
;; Scale the index by the element size, and then emit the
;; compound instruction that does:
;;
Expand All @@ -3752,9 +3750,7 @@
;; (The alternative is to introduce a relocation pass
;; for inlined jumptables, which is much worse, IMHO.)
(let ((shifted_idx Reg (lshl_imm $I64 idx 2)))
(emit_side_effect (with_flags_side_effect
default_cond_producer
(jt_sequence shifted_idx default default_cond targets))))))
(emit_side_effect (jt_sequence shifted_idx default cond targets)))))


;;;; Rules for `brif` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Expand Down

0 comments on commit 9a932fe

Please sign in to comment.