flat assembler
Message board for the users of flat assembler.

Index > Main > Sse text cut all space and shift symbols.

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1878
Roman 22 Aug 2023, 15:23
How do this?
Code:
Txt1 db "room in  Light " 

After all Sse manipulation 
Txt1 "roominLight" 
    


I know how find space and get mask in xmm register.
Pcmpgtb or pcmpeqb and get mask in xmm reg.

But how on this mask shifting symbols I don't know.
PEXT very slow on AMD.
Post 22 Aug 2023, 15:23
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1878
Roman 23 Aug 2023, 10:22
Code:
align 16
fann3 db '98  ','2 4 ','1163','7770'   ;simple text
tSpaces db 16 dup(32)
ttAa    db 16 dup(1)
ttAa2   db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 ;1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
xmmpos  db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
outTxt     db 16 dup(0) 

 movaps  xmm1,dqword [fann3]
 movaps  xmm0,xmm1
 pcmpeqb xmm0,dqword [tSpaces]  ;get all spaces xmm0
 pand    xmm0,dqword [ttAa]    ;in mask set all FF to 1
 ;pxor    xmm0,dqword [ttAa2]
 paddb   xmm0,dqword [xmmpos]  ;mask = 00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F
 pshufb  xmm1,xmm0 
 movaps dqword [outTxt],xmm1 ;xmm1= '98 2244111637770' text

;must be text '982411637770'
    
Post 23 Aug 2023, 10:22
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1878
Roman 25 Aug 2023, 07:52
Avx512
vpcompressb can do this.
Post 25 Aug 2023, 07:52
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.