News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

FP10 to SSE register

Started by guga, February 12, 2022, 07:01:16 AM

Previous topic - Next topic

guga

Hi Guys

How to convert a FP10 value to a SSE register ? I mean, i wanted to copy things like this:

MyValue: T$ 1.568524184645454558155 ; T$ = FP10 value
to fill both quadwords of SSE register
xmm0 (1st quadword) = 1.568524184645454558
xmm0 (2nd quadword) = 155

I tried something like:
loaded the TenByte and save it on a register
fld T$MyValue | fstp T$MyValue

Tried to load it onto xmm0 register, but the resultant value is different
movupd xmm0 X$MyValue
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

HSE

   .data
      guga      real10 1.565
      oword1  oword  0

  .code
    lea eax, oword1
    fld guga
    fst real8 ptr [eax]
    fstp real8 ptr [eax+8]
    movupd XMM0, oword1

Equations in Assembly: SmplMath

guga

Hi Hse.

Tks....close. But it´s not there yet. It will create 2 Real 8 (a copy of them). I needed to know how to get the extra word of the Real10 and use it on xmm0 as a reminder, for example.

Something like this:

calculate some fpatan value. Save the result to FP10, and generates 2 complementary Real8 to be used in xmm0. Remember the thread about the Atan2 ? I´m trying to recreate the tangent table on a way that i can save it in a pair of Real8 and also shows the complete data in xmm register. The original code is this:


Proc CreateTangetTable:
    Local @Counter, @Value, @InternalCounter, @DecreaseRate
    Uses esi

    mov D@Counter TAN_TBL_SIZE
    mov D@InternalCounter 0
    fld1 | fstp F@DecreaseRate

    mov esi MyTangTBl
    add esi (TAN_TBL_SIZE*2*8) | sub esi (8*2)
    fld R$Float_PI | fstp R$esi

    dec D@Counter
    sub esi (8*2)
    mov D@Value 33 | fild D@Value | fstp F@Value
    .Do


        fld D@Value | fsub F@DecreaseRate | fst F@Value | fld1 | fpatan | fstp R$esi

        If D@InternalCounter = 16
            fld F@DecreaseRate | fmul F$Float_half | fstp F@DecreaseRate
            mov D@InternalCounter 0
        End_If

        inc D@InternalCounter
        sub esi (8*2)
        dec D@Counter
    .Loop_Until D@Counter = 0
L1:
EndP


Inside the loop, if i change it to something like:
[Mydata2: R$ 0, 0]

          fld D@Value | fsub F@DecreaseRate | fst F@Value | fld1 | fpatan | fst R$esi

          fst R$Mydata2 | fstp R$Mydata2+8 | movupd XMM0 X$Mydata2 ; <---- it will result in nan, infinite etc.
or
          fstp T$Mydata2 | movupd XMM0 X$Mydata2 ; <---- it will result in nan, infinite etc.

And not something like this:

MyValue: R$ 1.570796326794897, 6.123233995736766e-17
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

HSE

   .data
      guga      real10 1.565
      oword1  oword  0

  .code
    lea eax, oword1
    fld guga
    fst real8 ptr [eax]
    fsub real8 ptr [eax]
    fstp real8 ptr [eax+8]
    movupd XMM0, oword1

¿?
Equations in Assembly: SmplMath

guga

Oops..edited. Sorry...

I didn´t tried to subtract the result. I´ll make the test :azn:
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

guga

Great. Thanks, HSE  :thumbsup: :thumbsup: :thumbsup: :thumbsup: :thumbsup:

Now it worked
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com