It is currently Wed Jan 20, 2021 4:50 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: XMM double IN OUT
PostPosted: Mon Sep 02, 2013 12:22 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Jan 12, 2004 11:40 pm
Posts: 777
Location: Okazaki, JAPAN
I want to following code by SSE2 XMM
Code:
; a.d = b.d
  FLD    qword [esp+8]
  FSTP   qword [esp]
; b.d = a,d
  FLD    qword [esp]
  FSTP   qword [esp+8]


Code:
Procedure LPF201(*buffer_audio_ptr, *lpf_table_ptr, *out_buffer_ptr)
  ;/ http://forum.purebasic.com/english/viewtopic.php?f=35&t=47679
  ; Thanks "Wilbert in Netherlands"
  !MOV Ecx, [p.p_lpf_table_ptr]
  !MOV Edx, [p.p_buffer_audio_ptr]
  !SUB Edx, 800
  !PXOR xmm2, xmm2
 
  !MOV Eax, 201
  !align 4
  !InterLoop3:
 
  !movq xmm0, [Ecx] ; lpf
  !movlhps xmm0, xmm0
  !cvtps2pd xmm1, [Edx] ; L + R  float
  !mulpd xmm1, xmm0
  !ADDPD xmm2, xmm1
  !ADD Ecx, 8
  !ADD Edx, 8
 
  !DEC Eax
  !JNZ InterLoop3
 
  !cvtpd2ps xmm2, xmm2 ; double to float
  !MOV Edx, [p.p_out_buffer_ptr]
  !movq [Edx], xmm2 ; float, *out_buffer_prt
EndProcedure


I want to remove "!cvtpd2ps xmm2, xmm2", How manage xmm double data?
Code:
Procedure LPF201(*buffer_audio_ptr, *lpf_table_ptr, *out_buffer_ptr)
  ;/ http://forum.purebasic.com/english/viewtopic.php?f=35&t=47679
  ; Thanks "Wilbert in Netherlands"
  !MOV Ecx, [p.p_lpf_table_ptr]
  !MOV Edx, [p.p_buffer_audio_ptr]
  !SUB Edx, 800
  !PXOR xmm2, xmm2
 
  !MOV Eax, 201
  !align 4
  !InterLoop3:
 
  !movq xmm0, [Ecx] ; lpf
  !movlhps xmm0, xmm0
  !cvtps2pd xmm1, [Edx] ; L + R  !! Double !!
  !mulpd xmm1, xmm0
  !ADDPD xmm2, xmm1
  !ADD Ecx, 8
  !ADD Edx, 8
 
  !DEC Eax
  !JNZ InterLoop3
 
  !cvtpd2ps xmm2, xmm2 ; !! Remove !! double to float
  !MOV Edx, [p.p_out_buffer_ptr]
  !movq [Edx], xmm2 ; !! double !!, *out_buffer_prt
EndProcedure


Thank you


Top
 Profile  
Reply with quote  
 Post subject: Re: XMM double IN OUT
PostPosted: Mon Sep 02, 2013 1:49 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Aug 08, 2004 5:21 am
Posts: 3710
Location: Netherlands
If you want to load two double precision samples instead of single precision, you can use
movupd xmm1, [Edx]
instead of
cvtps2pd xmm1, [Edx]
but in this case you will have to increase Edx by 16 instead of 8.

_________________
macOS 10.15 Catalina, Windows 10


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


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

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye