aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-12-14 19:00:39 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2007-12-14 19:00:39 +0100
commit18117c0574ff93712f6b1710c5bdd70b68695637 (patch)
treec4441421464bc00c96de471a7e07b6a70025b6e9 /gcc/config
parent05c219bb4943a1ebfc30df747e1d97897b3494a1 (diff)
downloadgcc-18117c0574ff93712f6b1710c5bdd70b68695637.zip
gcc-18117c0574ff93712f6b1710c5bdd70b68695637.tar.gz
gcc-18117c0574ff93712f6b1710c5bdd70b68695637.tar.bz2
re PR target/29978 (redundant jumps)
PR target/29978 * config/i386/i386.c (ix86_expand_branch): Optimize LE/LEU/GT/GTU DImode comparisons against constant with all 1's in the lower word. * gcc.target/i386/pr29978.c: New test. From-SVN: r130938
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/i386/i386.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index fcae077..95a3496 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -12093,16 +12093,28 @@ ix86_expand_branch (enum rtx_code code, rtx label)
/* Otherwise, if we are doing less-than or greater-or-equal-than,
op1 is a constant and the low word is zero, then we can just
- examine the high word. */
+ examine the high word. Similarly for low word -1 and
+ less-or-equal-than or greater-than. */
- if (CONST_INT_P (hi[1]) && lo[1] == const0_rtx)
+ if (CONST_INT_P (hi[1]))
switch (code)
{
case LT: case LTU: case GE: case GEU:
- ix86_compare_op0 = hi[0];
- ix86_compare_op1 = hi[1];
- ix86_expand_branch (code, label);
- return;
+ if (lo[1] == const0_rtx)
+ {
+ ix86_compare_op0 = hi[0];
+ ix86_compare_op1 = hi[1];
+ ix86_expand_branch (code, label);
+ return;
+ }
+ case LE: case LEU: case GT: case GTU:
+ if (lo[1] == constm1_rtx)
+ {
+ ix86_compare_op0 = hi[0];
+ ix86_compare_op1 = hi[1];
+ ix86_expand_branch (code, label);
+ return;
+ }
default:
break;
}