This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] i386 DImode >= 0 optimization
- To: gcc-patches at gcc dot gnu dot org
- Subject: [PATCH] i386 DImode >= 0 optimization
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Thu, 24 Aug 2000 09:14:06 -0400
- Reply-To: Jakub Jelinek <jakub at redhat dot com>
Hi!
>= 0xNNNNNNNN00000000LL can be handled the same way as <, if the high order
word is >= 0xNNNNNNNN, then the condition is met, otherwise it is not.
The compiler usually optimizes out the third comparison (because it is
GEU (const_int 0)), but the second comparison is kept even at -O2.
Ok to commit?
2000-08-24 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386.c (ix86_expand_branch): Treat GE and GEU the same
way as LT and LTU when the second operand has 0 in low word.
--- gcc/config/i386/i386.c.jj Mon Jul 31 20:05:09 2000
+++ gcc/config/i386/i386.c Thu Aug 24 15:11:22 2000
@@ -4951,17 +4951,21 @@ ix86_expand_branch (code, label)
return;
}
- /* Otherwise, if we are doing less-than, op1 is a constant and the
- low word is zero, then we can just examine the high word. */
+ /* 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. */
- if (GET_CODE (hi[1]) == CONST_INT && lo[1] == const0_rtx
- && (code == LT || code == LTU))
- {
- ix86_compare_op0 = hi[0];
- ix86_compare_op1 = hi[1];
- ix86_expand_branch (code, label);
- return;
- }
+ if (GET_CODE (hi[1]) == CONST_INT && lo[1] == const0_rtx)
+ 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;
+ default:
+ break;
+ }
/* Otherwise, we need two or three jumps. */
Jakub