[SOLVED] Questions about SSE

Bare metal programming in PureBasic, for experienced users
User avatar
Mijikai
Addict
Addict
Posts: 1520
Joined: Sun Sep 11, 2016 2:17 pm

[SOLVED] Questions about SSE

Post by Mijikai »

I struggle with SSE :oops:

How can i make the Procedure return the result directly ?

How to compare two results and branch if they are less/greater ?
Why is cmpsd not recognised as instruction ?

Code:

Code: Select all

EnableExplicit

Procedure.d Dummy(A.d,B.d,*C)
  !movsd xmm0,[p.v_A]
  !movsd xmm1,[p.v_B]
  !divsd xmm0,xmm1;<- A = A / B
 
  ;i would like to compare two xmm
  ;!cmpsd xmm0,xmm1 <- invalid instruction !?
  
  !mov rax,[p.p_C]
  !movsd [rax],xmm0;<- returns to variable via ptr
  
  ProcedureReturn
EndProcedure

Procedure.i Main()
  Protected test.d
  
  Debug Dummy(100.0,2.0,@test)
  Debug test
  
  ProcedureReturn #Null
EndProcedure

End Main()
Last edited by Mijikai on Sat Sep 09, 2023 11:22 am, edited 1 time in total.
User avatar
STARGÅTE
Addict
Addict
Posts: 2231
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Questions about SSE

Post by STARGÅTE »

CMPSD needs a third parameter used as comparison predicate.

If you want to return a double directly (Procedure.d), you have to use the FPU instructions.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
Mijikai
Addict
Addict
Posts: 1520
Joined: Sun Sep 11, 2016 2:17 pm

Re: Questions about SSE

Post by Mijikai »

@STARGÅTE
Thanks for the quick help, i completely missed the third parameter :oops:
Post Reply