Author Topic: Large integers and floats  (Read 10206 times)

nidud

  • Member
  • *****
  • Posts: 1980
    • https://github.com/nidud/asmc
Re: Large integers and floats
« Reply #30 on: July 09, 2020, 02:19:07 AM »
Added a test case for the Intel Software Development Emulator (SDE). This enables emulation for Advanced Vector Extensions 512 (AVX-512) instructions.

makefile
Code: [Select]
#
# Intel Software Development Emulator
#
# Download:
#     http://www.intel.com/software/sde
#
# Adjust the path to the SDE tools below:
#

SDE = \sde-external-8.35.0-2019-03-11-win

test.exe:
    asmc64 $*.asm
    linkw system con_64 file $*
    $(SDE)\sde -- $@
    pause

Biterider

  • Member
  • ****
  • Posts: 542
  • ObjAsm Developer
    • ObjAsm
Re: Large integers and floats
« Reply #31 on: July 09, 2020, 06:34:41 AM »
Thanks for the link!
Biterider

HSE

  • Member
  • *****
  • Posts: 1377
  • <AMD>< 7-32>
Re: Large integers and floats
« Reply #32 on: July 10, 2020, 09:12:05 AM »
Impressive!

Also work with sde external 8.50  :thumbsup:


I don't know if is a normal thing:
Code: [Select]
Missing: \lib\amd64\uuid.lib
Missing: \lib\amd64\quadmath.lib
Missing: \lib\amd64\directxmath.lib

nidud

  • Member
  • *****
  • Posts: 1980
    • https://github.com/nidud/asmc
Re: Large integers and floats
« Reply #33 on: July 11, 2020, 11:16:37 PM »
I don't know if is a normal thing:
Code: [Select]
Missing: \lib\amd64\uuid.lib
Missing: \lib\amd64\quadmath.lib
Missing: \lib\amd64\directxmath.lib

These libraries are not built by the installer so you need to build them if you plan on using them. The quadmath lib is needed for the Linux version of Asmc and some of the test samples use other libraries.

HSE

  • Member
  • *****
  • Posts: 1377
  • <AMD>< 7-32>
Re: Large integers and floats
« Reply #34 on: July 12, 2020, 02:49:48 AM »
Ok. Thanks  :thumbsup:

nidud

  • Member
  • *****
  • Posts: 1980
    • https://github.com/nidud/asmc
Re: Large integers and floats
« Reply #35 on: July 18, 2020, 10:32:35 PM »
Added command line switch /arch:AVX[2|512]

It doesn't do anything internally (at least not yet) other than add the Microsoft-specific defines.

AVX512:
    define_name( "__AVX512BW__", "1" );
    define_name( "__AVX512CD__", "1" );
    define_name( "__AVX512DQ__", "1" );
    define_name( "__AVX512F__",  "1" );
    define_name( "__AVX512VL__", "1" );
AVX2:
    define_name( "__AVX2__", "1" );
AVX:
    define_name( "__AVX__", "1" );

nidud

  • Member
  • *****
  • Posts: 1980
    • https://github.com/nidud/asmc
Re: Large integers and floats
« Reply #36 on: July 30, 2020, 01:45:09 AM »
Floats may now be evaluated as a const value.

    a = -1.0
    while a lt 5.0
        a = a + 1.0
        endm
    if a ge 5.0
        %echo @CatStr(%a)
    endif

SAR (and SAL) is added as binary operators.

    if (-1 shr 63 eq 1)
    if (-1 sar 63 eq -1)

nidud

  • Member
  • *****
  • Posts: 1980
    • https://github.com/nidud/asmc
Re: Large integers and floats
« Reply #37 on: August 04, 2020, 01:45:08 AM »
This opens up for 128 bit binary operations. The max size for integer values is still 64 bit but loaded as a float 128. ADD, SUB, MUL, DIV is added for binary 128.

float 128:

    +, -, *, /, EQ, NE, LT, LE, GT, GE

binary 128:

    ADD, SUB, MUL, DIV, MOD, NOT, SAL, SHL, SAR, SHR, AND, OR, XOR

Manipulating float using binary operators:

    sqrt_approx macro f

      local x

        x = f sub 00010000000000000000000000000000r
        x = x shr 1
        x = x add 20000000000000000000000000000000r
        exitm<x>
        endm

Get sign:

        sign = f and 80000000000000000000000000000000r
        sign = f shr 127
        sign = high64( f ) shr 63