This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR12308


Oops! I just realized I forgot the ChangeLog; sorry, here it is:

2004-01-15 Caroline Tice <ctice@apple.com>

* config/i386/i386.md (fix_truncxfdi2): Add clause to clobber
flags register.
(fix_truncdfdi2): Likewise.
(fix_truncsfdi2): Likewise.
(*fix_truncdi_1): Likewise.
(fix_truncxfsi2): Likewise.
(fix_truncdfsi2): Likewise.
(fix_truncsfsi2): Likewise.
(*fix_truncsi_1): Likewise.
(fix_truncxfhi2): Likewise.
(fix_truncdfhi2): Likewise.
(fix_truncsfhi2): Likewise.
(*fix_trunchi_1): Likewise.

On Jan 15, 2004, at 12:49 PM, Caroline Tice wrote:

This patch fixes bug PR12308, which is an i386-specific bug.

The *real* problem is that, in order to do proper mode switching for floating point math
on the x86, optimize_mode_switching ends up creating a new bit of rtl, about two-thirds of the
way through the back end. This new bit of rtl happens to clobber the flags register. It also
happens to be inserted immediately prior to the first "fix" rtl, which is where it is needed.
So far, so good. The problem is that the previous optimizations have been freely moving the
"fix" rtl all over the place since "fix", BY ITSELF, does not clobber anything. But suddenly there's a clobber of the flags register happening immediately prior to the "fix" rtl. This
can be a big problem if the "fix" rtl happens to land between a set and a use of the flags
register, (e.g. between a compare and a conditional jump), which it does for this bug.

The really correct way to fix this problem would be to issue the mode switching rtl at
the same time the "fix" is issued, and to indicate 1). the mode switching rtl clobbers the
flags register, and 2). the "fix" rtl needs the results of the mode switching rtl. That's
pretty messy and complicated. The patch I am offering takes the easier route of
marking the "fix" rtl as clobbering the flags registers.

This patch has been tested on an i386 machine running Linux. It bootstraps and
passes the DejaGnu tests.

Is this okay to commit? If so, where would be the appropriate place to put it?

-- Caroline Tice
ctice@apple.com


<gcc5-i386-diff.txt>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]