From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Buck To: sabre@nondot.org (Chris Lattner) Cc: lucier@math.purdue.edu (Brad Lucier), gcc@gcc.gnu.org Subject: Re: floor on i386 Date: Wed, 12 Sep 2001 16:16:00 -0000 Message-id: <200109122315.QAA23171@atrus.synopsys.com> References: X-SW-Source: 2001-09/msg00491.html > > If one had tree nodes or RTL nodes to express the sequence > > > Save rounding mode > > Change rounding mode to round-down > > Convert to integer > > Restore rounding mode > > > then perhaps the rounding mode change changes could be moved > > outside of loops where they occur, if there were no floating-point > > instructions in the loop that needed the currently set rounding mode. Chris Lattner writes: > Actually you could probably represent this by adding a "hard register" > that effectively is the rounding mode flags. Doing this seems like a > natural way to allow existing optimizations to get rid of the > redundancies that are killing GCC here... and you wouldn't have to add any > new RTL semantics... Seems logical, but then I guess all FP instruction descriptions have to be modified to indicate that they read these registers. I'm not enough of an expert to know which approach (extra RTL to represent rounding modes, or explicit rounding mode registers) is less painful. But it seems that since changing the rounding mode registers flush the FP pipeline, it may not be easy to just treat them as ordinary regs and still get the costs right for scheduling.