new_ia32_branch internal compiler errors
Richard Henderson
rth@cygnus.com
Sat Jul 31 23:33:00 GMT 1999
On Fri, Jul 16, 1999 at 04:19:30PM -0700, Toshiyasu Morita wrote:
> With the new_ia32_branch compiler from cvs today (gcc-2.96 1990621)
> using only the "-O2" compiler option:
>
> ./g_phys.i: In function `ClipVelocity':
> ./g_phys.i:4067: internal error--unrecognizable insn:
> (insn 179 23 180 (set (reg:SI 82)
> (and:SI (zero_extract:SI (reg:HI 34)
> (const_int 8 [0x8])
> (const_int 8 [0x8]))
> (const_int 69 [0x45]))) -1 (insn_list 23 (nil))
> (expr_list:REG_DEAD (reg:HI 34)
> (nil)))
Puts the ug in ugly. I'd fixed a similar problem with cmove by making
jump re-recognize the insns it emits and fail the optimization. But for
setcc the call chain is much messier.
A more direct solution is to accept constructs we'd created before.
This also cures the loss of optimization seen in the cmove change.
r~
* i386.c (cmpsi_operand): New predicate.
* i386.h (PREDICATE_CODES): Add it.
* i386.md (cmpsi): Use it.
Index: i386.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/i386/i386.c,v
retrieving revision 1.81.2.10
diff -c -p -d -r1.81.2.10 i386.c
*** i386.c 1999/07/08 20:01:39 1.81.2.10
--- i386.c 1999/07/20 04:39:28
*************** memory_displacement_operand (op, mode)
*** 1175,1180 ****
--- 1175,1207 ----
return parts.disp != NULL_RTX;
}
+
+ /* To avoid problems when jump re-emits comparisons like testqi_ext_0,
+ re-recognize the operand to avoid a copy_to_mode_reg that will fail.
+
+ ??? It seems likely that this will only work because cmpsi is an
+ expander, and no actual insns use this. */
+
+ int
+ cmpsi_operand (op, mode)
+ rtx op;
+ enum machine_mode mode;
+ {
+ if (general_operand (op, mode))
+ return 1;
+
+ if (GET_CODE (op) == AND
+ && GET_MODE (op) == SImode
+ && GET_CODE (XEXP (op, 0)) == ZERO_EXTRACT
+ && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT
+ && GET_CODE (XEXP (XEXP (op, 0), 2)) == CONST_INT
+ && INTVAL (XEXP (XEXP (op, 0), 1)) == 8
+ && INTVAL (XEXP (XEXP (op, 0), 2)) == 8
+ && GET_CODE (XEXP (op, 1)) == CONST_INT)
+ return 1;
+
+ return 0;
+ }
/* Return true if the constant is something that can be loaded with
a special instruction. Only handle 0.0 and 1.0; others are less
Index: i386.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/i386/i386.h,v
retrieving revision 1.61.2.5
diff -c -p -d -r1.61.2.5 i386.h
*** i386.h 1999/07/01 17:04:18 1.61.2.5
--- i386.h 1999/07/20 04:39:28
*************** do { long l; \
*** 2387,2393 ****
UMIN, UMAX, COMPARE, MINUS, DIV, MOD, \
UDIV, UMOD, ASHIFT, ROTATE, ASHIFTRT, \
LSHIFTRT, ROTATERT}}, \
! {"memory_displacement_operand", {MEM}},
/* Functions in i386.c */
--- 2387,2395 ----
UMIN, UMAX, COMPARE, MINUS, DIV, MOD, \
UDIV, UMOD, ASHIFT, ROTATE, ASHIFTRT, \
LSHIFTRT, ROTATERT}}, \
! {"memory_displacement_operand", {MEM}}, \
! {"cmpsi_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \
! LABEL_REF, SUBREG, REG, MEM, AND}},
/* Functions in i386.c */
*************** extern int mult_operator XPARAMS((xrtx,
*** 2434,2439 ****
--- 2436,2442 ----
extern int div_operator XPARAMS((xrtx, xmode));
extern int arith_or_logical_operator XPARAMS((xrtx, xmode));
extern int memory_displacement_operand XPARAMS((xrtx, xmode));
+ extern int cmpsi_operand XPARAMS((xrtx, xmode));
extern int standard_80387_constant_p XPARAMS((xrtx));
extern int symbolic_reference_mentioned_p XPARAMS((xrtx));
Index: i386.md
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/i386/i386.md,v
retrieving revision 1.78.2.8
diff -c -p -d -r1.78.2.8 i386.md
*** i386.md 1999/07/08 19:42:27 1.78.2.8
--- i386.md 1999/07/20 04:39:28
***************
*** 604,610 ****
(define_expand "cmpsi"
[(set (reg:CC 17)
! (compare:CC (match_operand:SI 0 "general_operand" "")
(match_operand:SI 1 "general_operand" "")))]
""
"
--- 604,610 ----
(define_expand "cmpsi"
[(set (reg:CC 17)
! (compare:CC (match_operand:SI 0 "cmpsi_operand" "")
(match_operand:SI 1 "general_operand" "")))]
""
"
More information about the Gcc-bugs
mailing list