All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: fsincos emulation on AMD CPUs
Date: Thu, 15 Dec 2011 11:34:07 +0100	[thread overview]
Message-ID: <4EE9CD1F.1020406@redhat.com> (raw)
In-Reply-To: <4EE9D6E40200007800068120@nat28.tlf.novell.com>

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

  reply	other threads:[~2011-12-15 10:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-15  8:38 fsincos emulation on AMD CPUs Jan Beulich
2011-12-15  8:54 ` Paolo Bonzini
2011-12-15 10:15   ` Jan Beulich
2011-12-15 10:34     ` Paolo Bonzini [this message]
2011-12-15 11:15       ` Jan Beulich
2011-12-15 12:27         ` Keir Fraser
2011-12-15 12:33           ` Keir Fraser
2011-12-15 13:08             ` Jan Beulich
2011-12-15 13:13               ` Keir Fraser
2011-12-15 13:19                 ` Jan Beulich
2011-12-15 16:52                   ` Keir Fraser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EE9CD1F.1020406@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=JBeulich@suse.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.