[LLVMdev] Swaps of FP registers
Jonas Maebe
jonas.maebe at elis.ugent.be
Tue Jul 3 23:52:09 PDT 2007
On 04 Jul 2007, at 02:10, Scott Graham wrote:
> On 7/3/07, Fernando Magno Quintao Pereira <fernando at cs.ucla.edu>
> wrote:
>>
>> what is the best way to implement a swap of floating point
>> registers
>> in X86? For the integer registers, I am using xchg. Is there a
>> similar
>> instruction for floating point?
>
> FXCH swaps stN with st0, but you'd have to use memory for arbitrary
> swaps I
> believe.
Well, you can use 3 FXCH's too (stX<->st0, stY<->st0, stX<->st0). I
guess that would still be a lot faster than passing via memory (not
to mention that you need an extra fpu stack location if you'd do it
via memory).
Jonas
More information about the llvm-dev
mailing list