[Bug c/29186] optimzation breaks floating point exception flag reading

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sun Nov 19 12:14:00 GMT 2006



------- Comment #19 from rguenth at gcc dot gnu dot org  2006-11-19 12:14 -------
The problem is that the division is in no ways special to optimizers.  One
possibility I see would be to introduce either a builtin function or a new
tree-code to access the exception flags.  Of course the fact that flags are
supposed to accumulate doesn't help to simplify things here...

It would be the frontends task to emit compound expressions.  Like instead
of

  D.2529 = x / y;

emit

  { D.2529 = x / y; __builtin_update_except (D.2529); }

(note that __builtin_update_except has to be subject to read/write global
memory to support exception flow across the call-graph).

I bet it's a mess to optimize this stuff correctly without some "clever"
hacks.  Like

  { D.2529 = x / y; *__builtin_flags = __builtin_update_except (D.2529,
*__builtin_flags); }

where we can then make __builtin_update_except const [ideally *__builtin_flags
would just be a special alias tag used and clobbered by the various
exception functions]


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29186



More information about the Gcc-bugs mailing list