This is the mail archive of the gcc@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]

Adding Rounding Mode to Operations Opcodes in Gimple and RTL


Hi,
I found quite an old bug PR34768 and was thinking of doing what was
suggested there.
Particularly, I was wondering about adding new subcodes to gimple and
rtl for describing operations with rounding.

Currently, I think the problem could be tackled in the following way:
In gimple we'll need to add a pass that would a) find regions with
constant, compile-time known rounding mode, b) replace operations with
subcodes like plus/minus/div/etc. with the corresponding operations
with rounding (plus_ru, plus_rd etc.), c) remove fesetround calls if
the region doesn't contain instructions that could depend on rounding
mode.
In RTL we'll need to support the instructions with rounding mode, and
also we'll need to be able to somehow emit such instructions.
Probably, we'll need a reverse transformation to insert fesetround
calls around the regions with instructions with rounding - that could
be done by mode_switching pass.

If this approach looks reasonable to you, then there are more questions:
1) What is the best way to represent operations with rounding in
Gimple and RTL? Should we add plus_round and add an attribute to
describe rounding mode, or we should add opcodes for different
rounding modes (plus_round_up, plus_round_down, etc.) - of course,
that should be done for all opcodes that are affected by rounding, not
only plus-opcode.
2) What's the best place to insert the new passes?

Any other input is more than welcome on this.


-- 
---
Best regards,
Michael V. Zolotukhin,
Software Engineer
Intel Corporation.


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