flat assembler
Message board for the users of flat assembler.

Index > Main > Help FPU converting real8 -> real4

Author
Thread Post new topic Reply to topic
hopcode



Joined: 04 Mar 2008
Posts: 563
Location: Germany
hopcode
Hallo, is there a way to improve this code where
myvalue is a dqword and in eax should be the (truncated) dword as result ?:
Code:
 lea edx,[myvalue]
  fldz
  fld qword[edx]
  xor eax,eax
  ftst
  fstsw ax
  fwait
  sahf              
  ja @f   ;<-- should be in addition a jp .error_handler implemented ?
  fldz
@@:
  fist dword[edx]
  xchg eax,[edx]   ; <--- is this a read after write ?
    


Thanks,
hopcode


Last edited by hopcode on 23 Nov 2009, 00:51; edited 1 time in total
Post 22 Nov 2009, 14:50
View user's profile Send private message Visit poster's website Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan
cvtsd2ss - sse2
Post 22 Nov 2009, 15:12
View user's profile Send private message Reply with quote
hopcode



Joined: 04 Mar 2008
Posts: 563
Location: Germany
hopcode
asmfan wrote:
cvtsd2ss - sse2

Oh.. yes. I have looked up right now shortly in Intel docs...
CVTSD2SS—Convert Scalar Double-Precision FP Value to Scalar Single-
Precision FP Value

At a glance, it should be a wrapping around the fpu instructions...
Anyway useful and slim.
F2 0F 5A /r CVTSD2SS xmm1,xmm2/m64

Thanks

BTW:
Where can i find a sse good tutorial ?
Post 22 Nov 2009, 15:23
View user's profile Send private message Visit poster's website Reply with quote
chaoscode



Joined: 21 Nov 2006
Posts: 64
chaoscode
you don't need a tutorial for SSE.
you need SSE every time if you have to work on a lot of Floatingpoint Data.
and to implement an algorithm. Then is the only thing you need the docs, which SSE-Instructions exists and how they work.
Post 23 Nov 2009, 01:05
View user's profile Send private message ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.