* [PATCH] i386: Cleanup comparison predicates.
@ 2021-04-29 13:29 Uros Bizjak
0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2021-04-29 13:29 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 821 bytes --]
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 <ubizjak@gmail.com>
gcc/
* config/i386/predicates.md (fcmov_comparison_operator):
Do not check for trivial FP comparison operator.
<case GEU, case LTU>: Allow CCGZmode.
<case GTU, case LEU>: Do not allow CCCmode.
(ix86_comparison_operator) <case GTU, case LEU>: Allow only CCmode.
(ix86_carry_flag_operator): Match only LTU and UNLT code.
Do not check for trivial FP comparison operator. Allow CCGZmode.
Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
Pushed to master.
Uros.
[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 2267 bytes --]
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index b1df8548af6..04a03a70b46 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -1352,16 +1352,17 @@ (define_predicate "fcmov_comparison_operator"
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 @@ (define_predicate "ix86_comparison_operator"
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 @@ (define_predicate "ix86_comparison_operator"
;; 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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-29 13:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 13:29 [PATCH] i386: Cleanup comparison predicates Uros Bizjak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).