Article View: gnu.gcc.bug
Article #1360Bogus compare coming from `simplify_condition()'
From: will
Date: Wed, 11 Nov 1992 16:45
Date: Wed, 11 Nov 1992 16:45
50 lines
2404 bytes
2404 bytes
The following suggestion allows something useful to be done
with a bit field produced by a signed extraction compared against zero.
The RTL pattern
(set (reg:SI n)
(ashiftrt:SI (ashift (reg:SI) ;; from a bit field extraction
(const_int))
(const_int)))
(set (cc0)
(compare (reg:SI n)
(const_int 0)))
was being munged by `simplify_condition()' into
(set (cc0)
(subreg:BLK (reg:SI n) 0))
by adding the line denoted by /* WRA */ in the following
test in `simplify_condition()'
case ASHIFTRT:
/* If OP0 is a sign extension and CODE is not an unsigned comparison,
do the comparison in a narrower mode. */
if (! unsigned_comparison_p
&& GET_CODE (XEXP (op0, 1)) == CONST_INT
&& GET_CODE (XEXP (op0, 0)) == ASHIFT
&& XEXP (op0, 1) == XEXP (XEXP (op0, 0), 1)
&& (tmode = mode_for_size (mode_width - INTVAL (XEXP (op0, 1)),
MODE_INT, 1)) != VOIDmode
/* WRA */ && tmode != BLKmode
&& ((unsigned) const_op <= GET_MODE_MASK (tmode)
|| (unsigned) - const_op <= GET_MODE_MASK (tmode)))
{
op0 = gen_lowpart_for_combine (tmode, XEXP (XEXP (op0, 0), 0));
continue;
}
the RTL was reduced to the "correct" zero_extraction pattern.
(set (cc0)
(zero_extract (reg:SI n) ..))
----------------------------------------------------------------------
___________ William Athanasiou, Software Engineer
/ ________/__ ...!{harvard,decvax,uunet}!masscomp!will
/__/_______/ / will@westford.ccur.com
Concurrent /__________/ Phone: (508) 392-2647
Computer Corporation FAX: Fax? We don't need no stinkin Faxes!
----------------------------------------------------------------------
Technical Details
Message-ID:
<9211111145.aa07122@playroom.westford.ccur.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!eff!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!westford.ccur.COM!willShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!eff!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!westford.ccur.COM!will From: will@westford.ccur.COM Subject: Bogus compare coming from `simplify_condition()' Message-ID: <9211111145.aa07122@playroom.westford.ccur.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Wed, 11 Nov 1992 16:45:48 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 52