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]

PATCH: PR12308


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


Attachment: gcc5-i386-diff.txt
Description: Text document


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