This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix for GCC Bugzilla Bug 36133
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: Gunnar Von Boehn <gunnar at genesi-usa dot com>, gcc-patches at gcc dot gnu dot org
- Date: Sun, 31 Aug 2008 13:43:03 -0400 (EDT)
- Subject: Re: Fix for GCC Bugzilla Bug 36133
- References: <b989d750806060633v27924455t3d0ec17ae336865a@mail.gmail.com> <je7iconupp.fsf@sykes.suse.de> <b989d750806171011j1717346ao3b4fa723197ab495@mail.gmail.com> <jebq1zri8h.fsf@sykes.suse.de> <b989d750806190543s6093936cjb8333e3782a9728c@mail.gmail.com> <b989d750806240857k6f36e0baie7bcf64a4b2faa91@mail.gmail.com> <je7icd9w1i.fsf@sykes.suse.de>
On Wed, 25 Jun 2008, Andreas Schwab wrote:
(This ^ much behind on mailing lists. Whee.)
> "Gunnar Von Boehn" <gunnar@genesi-usa.com> writes:
>
> > Maybe I can summarize the question again.
> > When I understood your question correctly then it was:
> > "Does it make sense to mark the CC as invalid after a shift instruction."
> > Your point was that a shift will "trash" the carry flag.
> > If the CC is marked as valid GCC will but BCC instructions after the shift.
> > If the CC is marked as invalid then GCC will put a TST before the BCC
> > instruction to regenerate the conditions codes.
>
> You need to argue on the RTL insns that can be generated. I cannot
> prove that there will never be a bgtu/bltu insn following the lshiftr
> insn. If that can happen your change would introduce a wrong-code bug.
>
> In any case, the right place to change that is in notice_update_cc
> anyway.
Despite rth's "???" there *is* an almost-pre-packaged way:
"set cc_status.flags |= CC_NO_OVERFLOW" for those insns in
notice_update_cc (right, invalidating use of carry *and*
overflow, but in practive, no difference).
See the CRIS port (another cc0 target where most insns touch
cc0), where I use the insn attribute noov32 (because CRIS v32
behaves differently) which is tested in NOTICE_UPDATE_CC to
check that the carry is valid, setting CC_NO_OVERFLOW there if
not.
brgds, H-P