* Avoid LOAD_EXTEND_OP on non-integer mode
@ 2008-10-12 18:44 Joseph S. Myers
2008-10-13 21:30 ` Adam Nemet
2008-10-14 5:15 ` Eric Botcazou
0 siblings, 2 replies; 3+ messages in thread
From: Joseph S. Myers @ 2008-10-12 18:44 UTC (permalink / raw)
To: gcc-patches
The documentation for LOAD_EXTEND_OP says:
This macro is not called with @var{mem_mode} non-integral or with a
width greater than or equal to @code{BITS_PER_WORD}, so you may return
any value in this case.
However, it does appear to be called for floating-point modes in some
cases. In 4.3-based sources I observed it being called from
simplify_set when loading an SFmode value, resulting in zero_extend:DI
of such a value - zero_extend of a floating-point value not being
well-defined. In turn simplify_const_unary_operation ICEd on an
operation it was not expecting for floating-point modes. The test, on
MIPS N64 soft-float, was from the glibc testsuite and reduced to:
extern float cf (float _Complex);
static float p, m;
void
c (void)
{
_Complex float r, r2;
__real__ r = p;
__imag__ r = 1.0;
cf (r);
__real__ r2 = m;
__imag__ r2 = 1.0;
cf (r2);
}
but I do not have a test showing an ICE for FSF sources. I did
however verify that if I add (in FSF sources) an assert to
simplify_set that the mode is an integer mode in the case where
LOAD_EXTEND_OP would be called, the assert triggered while building
libgcc.
This patch avoids calling LOAD_EXTEND_OP for non-integer modes in the
particular case where I observed this problem (I suspect it may arise
in other cases as well). Tested with no regressions with cross to
mips64octeon-linux-gnu. OK to commit?
2008-10-12 Joseph Myers <joseph@codesourcery.com>
* combine.c (simplify_set): Avoid calling LOAD_EXTEND_OP on
non-integer modes.
Index: gcc/combine.c
===================================================================
--- gcc/combine.c (revision 141048)
+++ gcc/combine.c (working copy)
@@ -5843,6 +5843,7 @@
zero_extend to avoid the reload that would otherwise be required. */
if (GET_CODE (src) == SUBREG && subreg_lowpart_p (src)
+ && GET_MODE_CLASS (GET_MODE (SUBREG_REG (src))) == MODE_INT
&& LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (src))) != UNKNOWN
&& SUBREG_BYTE (src) == 0
&& (GET_MODE_SIZE (GET_MODE (src))
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Avoid LOAD_EXTEND_OP on non-integer mode
2008-10-12 18:44 Avoid LOAD_EXTEND_OP on non-integer mode Joseph S. Myers
@ 2008-10-13 21:30 ` Adam Nemet
2008-10-14 5:15 ` Eric Botcazou
1 sibling, 0 replies; 3+ messages in thread
From: Adam Nemet @ 2008-10-13 21:30 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: gcc-patches
"Joseph S. Myers" <joseph@codesourcery.com> writes:
> * combine.c (simplify_set): Avoid calling LOAD_EXTEND_OP on
> non-integer modes.
>
> Index: gcc/combine.c
> ===================================================================
> --- gcc/combine.c (revision 141048)
> +++ gcc/combine.c (working copy)
> @@ -5843,6 +5843,7 @@
> zero_extend to avoid the reload that would otherwise be required. */
>
> if (GET_CODE (src) == SUBREG && subreg_lowpart_p (src)
> + && GET_MODE_CLASS (GET_MODE (SUBREG_REG (src))) == MODE_INT
> && LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (src))) != UNKNOWN
> && SUBREG_BYTE (src) == 0
> && (GET_MODE_SIZE (GET_MODE (src))
FWIW, we used to have the same change (except formulated with INTEGRAL_MODE_P)
in our older (3.4) compiler.
Adam
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Avoid LOAD_EXTEND_OP on non-integer mode
2008-10-12 18:44 Avoid LOAD_EXTEND_OP on non-integer mode Joseph S. Myers
2008-10-13 21:30 ` Adam Nemet
@ 2008-10-14 5:15 ` Eric Botcazou
1 sibling, 0 replies; 3+ messages in thread
From: Eric Botcazou @ 2008-10-14 5:15 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: gcc-patches
> This patch avoids calling LOAD_EXTEND_OP for non-integer modes in the
> particular case where I observed this problem (I suspect it may arise
> in other cases as well). Tested with no regressions with cross to
> mips64octeon-linux-gnu. OK to commit?
>
> 2008-10-12 Joseph Myers <joseph@codesourcery.com>
>
> * combine.c (simplify_set): Avoid calling LOAD_EXTEND_OP on
> non-integer modes.
I'd mimic reload.c and use INTEGRAL_MODE_P as suggested by Adam. OK with this
change.
--
Eric Botcazou
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-10-13 19:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-12 18:44 Avoid LOAD_EXTEND_OP on non-integer mode Joseph S. Myers
2008-10-13 21:30 ` Adam Nemet
2008-10-14 5:15 ` Eric Botcazou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).