Author Topic: Backend change in SmplMath  (Read 188 times)

HSE

  • Member
  • ****
  • Posts: 545
  • <AMD>< 7-32>
Backend change in SmplMath
« on: October 23, 2017, 12:40:01 PM »
Hi qWord!

I change between fpu and sse2:
Code: [Select]
    ifidn abb_backend_entity, <FSLV_X86_FPU_ENTITY>
    fSlv8 = 0.85
    else           ; FSLV_X86_SSE2_FPU_ENTITY
    fSlv8 tempR8 = 0.85
    fld tempR8
    endif

It's not a good solution, for sure there is a better one.

I don't know if it's posible to force the backend in some program fragment.

Thanks.

qWord

  • Member
  • *****
  • Posts: 1462
  • The base type of a type is the type itself
    • SmplMath macros
Re: Backend change in SmplMath
« Reply #1 on: October 26, 2017, 08:52:34 AM »
You can change the back-end in several ways, e.g. fSlvLoadBackEnd or fSlvSelectBackEnd (see doc). However, there is no push/pop semantic for that, so it is up to you keep track of current used back-end.


BTW: I've upload anew version that contains some bug fixes that had been collected over the years
https://sourceforge.net/projects/smplmath/files/2.0.2/SmplMath.rar/download
MREAL macros - when you need floating point arithmetic while assembling!

HSE

  • Member
  • ****
  • Posts: 545
  • <AMD>< 7-32>
Re: Backend change in SmplMath
« Reply #2 on: October 26, 2017, 10:16:45 AM »
Thanks very much. Next week I will try new version.

HSE

  • Member
  • ****
  • Posts: 545
  • <AMD>< 7-32>
Re: Backend change in SmplMath
« Reply #3 on: November 05, 2017, 07:03:34 AM »
Hi qWord!

Itsn't working.

If you remove  "FSBE_PROC %FSBE_LOAD_ARG,%fcmpx_factor,0"
then " !fTest([esi].Observation.weight_lb, NaN)" fail.


qWord

  • Member
  • *****
  • Posts: 1462
  • The base type of a type is the type itself
    • SmplMath macros
Re: Backend change in SmplMath
« Reply #4 on: November 05, 2017, 08:50:22 AM »
HSE,

please show a small test case reproducing the unexpected behavior. Regardless that, testing if some value is negligible in compare to an NaN-Encoding (Not a Number) doesn't look right.

regards
MREAL macros - when you need floating point arithmetic while assembling!

HSE

  • Member
  • ****
  • Posts: 545
  • <AMD>< 7-32>
Re: Backend change in SmplMath
« Reply #5 on: November 05, 2017, 09:54:10 AM »
Yes, I was thinking to make something little because what I'm running now is unpublished.

And Yes, certainlly there is a better way to represent missing data, just I don't know it. But work very well with SmplMath 2.0.1 (except for fpu-stack imbalance, of course).

qWord

  • Member
  • *****
  • Posts: 1462
  • The base type of a type is the type itself
    • SmplMath macros
Re: Backend change in SmplMath
« Reply #6 on: November 05, 2017, 10:14:11 AM »
There are the macros r4IsValid and r8IsValid that test the passed variable for NaN:
Code: [Select]
.if r4IsValid(myreal4)
; not a NaN
.elseif
; is NaN
.endif

MREAL macros - when you need floating point arithmetic while assembling!

HSE

  • Member
  • ****
  • Posts: 545
  • <AMD>< 7-32>
Re: Backend change in SmplMath
« Reply #7 on: November 05, 2017, 11:53:17 AM »
Perfect  :t

Perhaps more specific in this case:
Code: [Select]
r8IsNotNaN macro mem64:req
IF @WordSize EQ 4
push DWORD ptr mem64+4
and DWORD ptr [esp],7FF80000h
xor DWORD ptr [esp],7FF80000h
lea esp,[esp+4]
ELSE
push rax
mov eax,DWORD ptr mem64+4
and eax,7FF80000h
xor eax,7FF80000h
pop rax
ENDIF
EXITM <!ZERO?>
endm
Thanks.