This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix PR41268 (and possibly bootstrap on ia64-hpux)
- From: Michael Matz <matz at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Steve Ellcey <sje at cup dot hp dot com>
- Date: Tue, 8 Sep 2009 03:14:49 +0200 (CEST)
- Subject: Fix PR41268 (and possibly bootstrap on ia64-hpux)
Hi,
Trick question: What type do you assume would entities named
SUBREG_PROMOTED_UNSIGNED_P() or unsignedp have?
Bool.
*brzzzt* wrong. It's int. Because, of course, this _P_redicate actually
is a three-state thingy. Hmm, three states for unsignedness?
Let's see we have, ... signed numbers, ... hmm, unsigned number ... and,
(oh that tension) ... unsigned numbers! Again. Just for pointers.
Indicated by negative value. Without any comments indicating such
strangeness. Holy crap!
(It's documented in the texinfo docu)
Actually, Steve, it's kind of funny coincidence that ia64-hpux broke,
because you introduced this, errr, unfortunate change of semantics without
changing the name, back in 2002 :-)
In any case, I'll apply this once regstrapping is finished on x86_64-linux
(not that it matters there). It fixes the testcase (visual inspection
that the correct addp4 variant is generated). Steve, can you check if
this also fixes the miscompile in genmode when bootstrapping on ia64-hpux,
please?
Ciao,
Michael.
--
PR middle-end/41268
* cfgexpand.c (expand_gimple_stmt_1): Use an int for storing
SUBREG_PROMOTED_UNSIGNED_P, instead of a bool.
* rtl.h (struct rtx, SUBREG_PROMOTED_UNSIGNED_P): Update comments
to reflect reality.
Index: cfgexpand.c
===================================================================
--- cfgexpand.c (Revision 151494)
+++ cfgexpand.c (Arbeitskopie)
@@ -1920,19 +1920,19 @@ expand_gimple_stmt_1 (gimple stmt)
;
else if (promoted)
{
- bool unsigndp = SUBREG_PROMOTED_UNSIGNED_P (target);
+ int unsignedp = SUBREG_PROMOTED_UNSIGNED_P (target);
/* If TEMP is a VOIDmode constant, use convert_modes to make
sure that we properly convert it. */
if (CONSTANT_P (temp) && GET_MODE (temp) == VOIDmode)
{
temp = convert_modes (GET_MODE (target),
TYPE_MODE (ops.type),
- temp, unsigndp);
+ temp, unsignedp);
temp = convert_modes (GET_MODE (SUBREG_REG (target)),
- GET_MODE (target), temp, unsigndp);
+ GET_MODE (target), temp, unsignedp);
}
- convert_move (SUBREG_REG (target), temp, unsigndp);
+ convert_move (SUBREG_REG (target), temp, unsignedp);
}
else if (nontemporal && emit_storent_insn (target, temp))
;
Index: rtl.h
===================================================================
--- rtl.h (Revision 151494)
+++ rtl.h (Arbeitskopie)
@@ -255,8 +255,7 @@ struct GTY((chain_next ("RTX_NEXT (&%h)"
ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P. */
unsigned int call : 1;
/* 1 in a REG, MEM, or CONCAT if the value is set at most once, anywhere.
- 1 in a SUBREG if it references an unsigned object whose mode has been
- from a promoted to a wider mode.
+ 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P.
1 in a SYMBOL_REF if it addresses something in the per-function
constants pool.
1 in a CALL_INSN logically equivalent to ECF_CONST and TREE_READONLY.
@@ -268,7 +267,7 @@ struct GTY((chain_next ("RTX_NEXT (&%h)"
if it has been deleted.
1 in a REG expression if corresponds to a variable declared by the user,
0 for an internally generated temporary.
- 1 in a SUBREG with a negative value.
+ 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P.
1 in a LABEL_REF, REG_LABEL_TARGET or REG_LABEL_OPERAND note for a
non-local label.
In a SYMBOL_REF, this flag is used for machine-specific purposes.
@@ -1161,6 +1160,15 @@ do { \
_rtx->unchanging = (VAL); \
} \
} while (0)
+
+/* Valid for subregs which are SUBREG_PROMOTED_VAR_P(). In that case
+ this gives the necessary extensions:
+ 0 - signed
+ 1 - normal unsigned
+ -1 - pointer unsigned, which most often can be handled like unsigned
+ extension, except for generating instructions where we need to
+ emit special code (ptr_extend insns) on some architectures. */
+
#define SUBREG_PROMOTED_UNSIGNED_P(RTX) \
((RTL_FLAG_CHECK1("SUBREG_PROMOTED_UNSIGNED_P", (RTX), SUBREG)->volatil) \
? -1 : (int) (RTX)->unchanging)