s390x: Support scalar min/max clif instructions (#5762)

We don't have ISA instructions for that, so simply expand them
to icmp + select.

Also enable fuzzing for those clif instructions now.
This commit is contained in:
Ulrich Weigand
2023-02-15 12:45:09 +01:00
committed by GitHub
parent 255fd6be0a
commit e10094dcd6
3 changed files with 273 additions and 6 deletions

View File

@@ -238,20 +238,35 @@
;;;; Rules for `umax` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Unsigned maximum of two scalar integers - expand to icmp + select.
(rule 1 (lower (has_type (ty_int ty) (umax x y)))
(let ((cond ProducesBool (icmp_val $false (IntCC.UnsignedLessThan) x y)))
(select_bool_reg ty cond y x)))
;; Unsigned maximum of two vector registers.
(rule (lower (has_type (ty_vec128 ty) (umax x y)))
(rule 0 (lower (has_type (ty_vec128 ty) (umax x y)))
(vec_umax ty x y))
;;;; Rules for `umin` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Unsigned minimum of two scalar integers - expand to icmp + select.
(rule 1 (lower (has_type (ty_int ty) (umin x y)))
(let ((cond ProducesBool (icmp_val $false (IntCC.UnsignedGreaterThan) x y)))
(select_bool_reg ty cond y x)))
;; Unsigned minimum of two vector registers.
(rule (lower (has_type (ty_vec128 ty) (umin x y)))
(rule 0 (lower (has_type (ty_vec128 ty) (umin x y)))
(vec_umin ty x y))
;;;; Rules for `smax` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Signed maximum of two scalar integers - expand to icmp + select.
(rule 1 (lower (has_type (ty_int ty) (smax x y)))
(let ((cond ProducesBool (icmp_val $false (IntCC.SignedLessThan) x y)))
(select_bool_reg ty cond y x)))
;; Signed maximum of two vector registers.
(rule (lower (has_type (ty_vec128 ty) (smax x y)))
(vec_smax ty x y))
@@ -259,6 +274,11 @@
;;;; Rules for `smin` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Signed minimum of two scalar integers - expand to icmp + select.
(rule 1 (lower (has_type (ty_int ty) (smin x y)))
(let ((cond ProducesBool (icmp_val $false (IntCC.SignedGreaterThan) x y)))
(select_bool_reg ty cond y x)))
;; Signed minimum of two vector registers.
(rule (lower (has_type (ty_vec128 ty) (smin x y)))
(vec_smin ty x y))