;; and (xor ... (not ...)) to (not (xor ...)).
(define_predicate "cc_arith_not_operator"
(match_code "and,ior"))
+
+;; Return true if OP is an operator for a vec_cmp pattern
+;; VIS 4 is required for ordering comparisons if the mode is V8QI
+(define_predicate "vec_cmp_operator"
+ (match_operand 0 "comparison_operator")
+{
+ const enum rtx_code code = GET_CODE (op);
+
+ switch (GET_MODE (XEXP (op, 0)))
+ {
+ case V8QImode:
+ return code == EQ || code == NE || TARGET_VIS4;
+
+ default:
+ return true;
+ }
+})
+
+;; Return true if OP is an operator for a vec_cmpu pattern
+;; VIS 4 is required for ordering comparisons if the mode is not V8QI
+(define_predicate "vec_cmpu_operator"
+ (match_operand 0 "comparison_operator")
+{
+ const enum rtx_code code = GET_CODE (op);
+
+ switch (GET_MODE (XEXP (op, 0)))
+ {
+ case V8QImode:
+ return true;
+
+ default:
+ return code == EQ || code == NE || TARGET_VIS4;
+ }
+})
(define_expand "vec_cmp<FPCMP:mode><P:mode>"
[(set (match_operand:P 0 "register_operand" "")
- (match_operator:P 1 "comparison_operator"
+ (match_operator:P 1 "vec_cmp_operator"
[(match_operand:FPCMP 2 "register_operand" "")
(match_operand:FPCMP 3 "register_operand" "")]))]
"TARGET_VIS3"
{
enum rtx_code code = GET_CODE (operands[1]);
- /* VIS 4 is required for ordering comparisons if the mode is V8QI. */
- if (<FPCMP:MODE>mode == V8QImode && code != EQ && code != NE && !TARGET_VIS4)
- FAIL;
-
if (code == LT || code == GE)
{
PUT_CODE (operands[1], swap_condition (code));
(define_expand "vec_cmpu<FPCMP:mode><P:mode>"
[(set (match_operand:P 0 "register_operand" "")
- (match_operator:P 1 "comparison_operator"
+ (match_operator:P 1 "vec_cmpu_operator"
[(match_operand:FPCMP 2 "register_operand" "")
(match_operand:FPCMP 3 "register_operand" "")]))]
"TARGET_VIS3"
{
enum rtx_code code = GET_CODE (operands[1]);
- /* VIS 4 is required for ordering comparisons if the mode is not V8QI. */
- if (<FPCMP:MODE>mode != V8QImode && code != EQ && code != NE && !TARGET_VIS4)
- FAIL;
-
if (code == LTU || code == GEU)
{
PUT_CODE (operands[1], swap_condition (code));