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]

Re: regmove pass with x87 sincos() instruction


Jim Wilson wrote:

I would like to ask somebody with more knowledge in this area, if there is a way to make some kind of peephole2-like optimization _before_ regmove pass, which would detect unused register and in this case convert sincos() instruction back to sin() instruction before regmove starts to insert move instructions.


The problem seems to be that sin uses the 'u' constraint, and thus will always get the second FP register, even if the cos result is not used, which is not what we want.

I don't see an easy solution to this. Maybe it can be worked around with some hackery in reg-stack.c?

It doesn't seem reasonable to add an extra optimization pass before regpass to handle this special case.

I agree. I have solved this problem with define_split instead of define_peephole2, with define_split guarded with (!reload_completed && !reload_in_progress). By using define_split, sincosdf3 is changed back to *sindf2 in lreg pass. Sincos intruction is handled with a little hackery in reg-stack.c, and everything works as expected now. Please, see complete patch in http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00239.html .


Thanks,
Uros.


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