News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Replace FPU-instructions to SSE-instructions

Started by Mikl__, July 14, 2020, 11:33:19 AM

Previous topic - Next topic

Mikl__

Hi, All !
  • What instruction replaced the FPU-instruction FCHS? I use
xorps xmm0, xmm0
subss xmm0, xmm1; in the register xmm1 the value for which you want to change the sign
movss xmm1, xmm0
or soxorps xmm0, const80000000hBut is that right?
  • The FPU was many trigonometric instructions (FSIN, FCOS, FSINCOS, FPTAN, FPATAN) What it replace in SSE?
Thank you

hutch--

I have seen formulas around the internet for replacing trig functions with sse2. The attached PDF is what I have found so far.

TouEnMasm


The answer must be in the CRT using /Fa to get an asm translate.
Perhaps also is there some options to switch on in VS project.

Fa is a musical note to play with CL

Siekmanski

Floating point has 1 sign bit.
So we can flip the sign bit using boolean algebra ( Exclusive OR )

pxor / xorps / xorpd

.const
flip_bit dd 080000000H,080000000H,080000000H,080000000H

.code

xorps xmm0,dword ptr [flip_bit]
4 at once:
xorps xmm0,oword ptr [flip_bit]

square root functions in SSE:

SQRTSD Compute Square Root of Scalar Double-Precision Floating-Point Value
SQRTSS Compute Square Root of Scalar Single-Precision Value
SQRTPD Square Root of Packed Double-Precision Floating-Point Values
SQRTPS Square Root of Packed Single-Precision Floating-Point Values

RSQRTPS Compute Reciprocals of Square Roots of Packed Single-Precision Floating-Point Values
RSQRTSS Compute Reciprocal of Square Root of Scalar Single-Precision Floating-Point Value

Other trigonometric functions you have to create yourself.

for example: http://masm32.com/board/index.php?topic=4118.msg49276#msg49276
Creative coders use backward thinking techniques as a strategy.

Mikl__

Hi, hutch--, TouEnMasm, Siekmanski
Thank you very much

daydreamer

well sometimes you can eliminate change sign if you have mulps later in calculation
constants or variables for example taylor series use 1/3!,-1/5!,1/7!,-1/9!
use mulps -100.0, instead change sign and mulps 100.0


my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

Mikl__

Hi, daydreamer!
I will use your advice. Thank!