From d03ca8a6148f55e119b8220a9c65147173b32065 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Thu, 29 Apr 2021 15:24:51 +0200 Subject: [PATCH] i386: Cleanup comparison predicates. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CCCmode is allowed only with GEU and LTU comparison codes. Also allow CCGZmode for these two codes. There is no need to check for trivial FP comparison operator, ix86_fp_compare_code_to_integer will return UNKNOWN code for unsupported operators. 2021-04-29 Uroš Bizjak gcc/ * config/i386/predicates.md (fcmov_comparison_operator): Do not check for trivial FP comparison operator. : Allow CCGZmode. : Do not allow CCCmode. (ix86_comparison_operator) : Allow only CCmode. (ix86_carry_flag_operator): Match only LTU and UNLT code. Do not check for trivial FP comparison operator. Allow CCGZmode. --- gcc/config/i386/predicates.md | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md index b1df8548af63..04a03a70b46c 100644 --- a/gcc/config/i386/predicates.md +++ b/gcc/config/i386/predicates.md @@ -1352,16 +1352,17 @@ enum rtx_code code = GET_CODE (op); if (inmode == CCFPmode) - { - if (!ix86_trivial_fp_comparison_operator (op, mode)) - return false; - code = ix86_fp_compare_code_to_integer (code); - } + code = ix86_fp_compare_code_to_integer (code); + /* i387 supports just limited amount of conditional codes. */ switch (code) { - case LTU: case GTU: case LEU: case GEU: - if (inmode == CCmode || inmode == CCFPmode || inmode == CCCmode) + case GEU: case LTU: + if (inmode == CCCmode || inmode == CCGZmode) + return true; + /* FALLTHRU */ + case GTU: case LEU: + if (inmode == CCmode || inmode == CCFPmode) return true; return false; case ORDERED: case UNORDERED: @@ -1418,11 +1419,11 @@ return true; return false; case GEU: case LTU: - if (inmode == CCGZmode) + if (inmode == CCCmode || inmode == CCGZmode) return true; /* FALLTHRU */ case GTU: case LEU: - if (inmode == CCmode || inmode == CCCmode || inmode == CCGZmode) + if (inmode == CCmode) return true; return false; case ORDERED: case UNORDERED: @@ -1441,20 +1442,14 @@ ;; Return true if OP is a valid comparison operator ;; testing carry flag to be set. (define_predicate "ix86_carry_flag_operator" - (match_code "ltu,lt,unlt,gtu,gt,ungt,le,unle,ge,unge,ltgt,uneq") + (match_code "ltu,unlt") { machine_mode inmode = GET_MODE (XEXP (op, 0)); enum rtx_code code = GET_CODE (op); if (inmode == CCFPmode) - { - if (!ix86_trivial_fp_comparison_operator (op, mode)) - return false; - code = ix86_fp_compare_code_to_integer (code); - } - else if (inmode == CCCmode) - return code == LTU || code == GTU; - else if (inmode != CCmode) + code = ix86_fp_compare_code_to_integer (code); + else if (inmode != CCmode && inmode != CCCmode && inmode != CCGZmode) return false; return code == LTU;