flat assembler
Message board for the users of flat assembler.

Index > Windows > SSE or AVX convert float to string.

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 815
Roman
I looking example convert float dd 1.0 or float dq 1.0 to asc2 string.
Post 18 Sep 2020, 08:40
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 815
Roman
I try do this AVX in fasm 1.73. Code compiled but crash. My CPU Intel I5 2320
Code:
align 16
Abss dq 1.0,2.0,2.0,2.0
Start:
vcvtps2dq       ymm0, YWORD [Abss] ;ok
vpxor   xmm1, xmm1, xmm1             ;ok
vpackssdw       ymm0, ymm0, ymm1 ;this crash my program
vpermq  ymm0, ymm0, 216              ;this crash my program
    


This not crash
Code:
vpackssdw       xmm0, xmm0, xmm1
    
Post 18 Sep 2020, 09:52
View user's profile Send private message Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 1520
Furs
Your CPU only supports AVX, not AVX2. You can't use ymm registers. (the first one is probably treated as xmm0 or whatever by your CPU).
Post 18 Sep 2020, 13:23
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7796
Location: Kraków, Poland
Tomasz Grysztar
Furs wrote:
Your CPU only supports AVX, not AVX2. You can't use ymm registers. (the first one is probably treated as xmm0 or whatever by your CPU).
AVX2 is not a requirement to use 256-bit registers (ymm). But AVX2 is needed for VPERMQ and a 256-bit variant of VPACKSSDW to be available.

You can test this with fasmg's instruction set packages:
Code:
        include 'align.inc'
        include 'cpu/x64.inc'

        include 'cpu/ext/avx.inc'
        ;include 'cpu/ext/avx2.inc'     ; try switching this

align 16
Abss dq 1.0,2.0,2.0,2.0
Start:
vcvtps2dq       ymm0, YWORD [Abss]
vpxor   xmm1, xmm1, xmm1            
vpackssdw       ymm0, ymm0, ymm1 
vpermq  ymm0, ymm0, 216                  
Code:
>fasmg test.asm -e10
flat assembler  version g.j1gh
test.asm [13]:
        vpackssdw ymm0, ymm0, ymm1
macro vpackssdw [1] macro basic_instruction [6]
Custom error: invalid operand size.
test.asm [14]:
        vpermq ymm0, ymm0, 216
Processed: vpermq ymm0, ymm0, 216
Error: illegal instruction.    
Post 18 Sep 2020, 18:52
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 202
Overclick
Isn't fistp enough for that?
Post 25 Sep 2020, 17:28
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.