patch: problem with zero_extend
Herman ten Brugge
Haj.Ten.Brugge@net.HCC.nl
Sat Mar 2 11:15:00 GMT 2002
Hello,
I found a problem in combine.c for the c4x target (version 3.1 20020223).
The testcase that fails is gcc/testsuite/gcc.c-torture/execute/920501-6.c.
This testcase fails with compiler options '-O2 -funroll-loops'. The output is:
920501-6.c: In function `plist':
920501-6.c:77: Internal compiler error in simplify_unary_operation, at simplify-rtx.c:632
simplify_unary_operation is called with '(zero_extend:HI (const_int 3 [03h]))'.
I do not know why this zero_extend is done because we only support
zero_extend for QI mode on the c4x target. (QImode = 32 bits on c4x target and
HImode is 64 bits). I fixed the problem with the patch below.
I do not have write permission so can not make the change after aproval.
Herman.
2002-02-03 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
* combine.c (subst,combine_simplify_rtx): Do not call
simplify_unary_operation for ZERO_EXTEND with CONST_INT.
--- combine.c.org Sat Feb 23 18:58:56 2002
+++ combine.c Fri Mar 1 06:56:20 2002
@@ -3541,7 +3541,8 @@ subst (x, from, to, in_dest, unique_copy
abort ();
}
else if (GET_CODE (new) == CONST_INT
- && GET_CODE (x) == ZERO_EXTEND)
+ && GET_CODE (x) == ZERO_EXTEND
+ && GET_CODE (XEXP (x, 0)) != CONST_INT)
{
x = simplify_unary_operation (ZERO_EXTEND, GET_MODE (x),
new, GET_MODE (XEXP (x, 0)));
@@ -3746,7 +3747,9 @@ combine_simplify_rtx (x, op0_mode, last,
switch (GET_RTX_CLASS (code))
{
case '1':
- temp = simplify_unary_operation (code, mode, XEXP (x, 0), op0_mode);
+ if (GET_CODE (x) != ZERO_EXTEND ||
+ GET_CODE (XEXP (x, 0)) != CONST_INT)
+ temp = simplify_unary_operation (code, mode, XEXP (x, 0), op0_mode);
break;
case '<':
{
More information about the Gcc-patches
mailing list