[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] fsincos emulation on AMD CPUs



On 12/15/2011 11:15 AM, Jan Beulich wrote:
>  If you really cared, perhaps fsincos can be replaced by this sequence in
>  the emulator:
>
>                        ; x
>        fld   %st       ; x x
>        fsin            ; x sin(x)
>        fxch  %st(1)    ; sin(x) x
>        fcos            ; sin(x) cos(x)
I had thought of this at first too, but this is problematic in terms of
exception handling: fpu_handle_exception() expects to see an
exception only on the very first instruction (as it's assumed to be
the only one), and aborts the rest of the sequence if the exception
doesn't happen on the last instruction.

Can it just be (%0 is fic.insn_bytes):

            movb $4f-1f,%0  ; do nothing on exception here
1:          fld  %st        ; x x
            movb $3f-1f,%0  ; pop on exception here
1:          fsin            ; x sin(x)
            fxch %st(1)     ; sin(x) x
            movb $2f-1f,%0  ; xch+pop on exception here
1:          fcos            ; sin(x) cos(x)
            jmp  2f
4:          fxch %st(1)     ; x sin(x)
3:          fstp %st        ; x
2:

Paolo

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.