flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [fasm2] problem with evex compression with rm=5

Author
Thread Post new topic Reply to topic
tthsqe



Joined: 20 May 2009
Posts: 771
tthsqe 28 Mar 2026, 09:18
Code:
                        check   (mode > 16 & rm = 5) | (mode = 16 & rm = 6)
                        jyes    no_displacement_compression
    

seems to me it should be mod != 0 & mod != 3 for mode > 16.
Code:
$ ~/fasm/fasm test.asm test1 && hd test1
flat assembler  version 1.73.30  (16384 kilobytes memory)
1 passes, 33 bytes.
00000000  62 f1 f5 48 59 80 01 00  00 00 cc 62 d1 f5 48 59  |b..HY......b..HY|
00000010  85 01 00 00 00 cc 62 f1  f5 48 59 85 01 00 00 00  |......b..HY.....|
00000020  cc                                                |.|
00000021

$ ~/fasm2/fasm2-master/fasm2 test.asm test2 && hd test2
flat assembler  version g.l4gs
test.asm [8]:
        vmulpd zmm0,zmm1,zword[rbp+1]
macro vmulpd? [1] macro AVX_512.basic_instruction_bcst_er [13] AVX_512.store_instruction@src2 [188] (CALM)
Processed: AVX_512.store_instruction@src2 @dest.size,VEX_66_0F_W0,EVEX_W1+EVEX_VL,59h,@dest.mask,@dest.rm,@src.rm
Error: the value of symbol 'AVX_512.store_instruction@src2:compressed_displacement' is not valid for this use.

$ cat test.asm
use64
org 0
vmulpd zmm0,zmm1,zword[rax+1]
int3
vmulpd zmm0,zmm1,zword[r13+1]
int3
vmulpd zmm0,zmm1,zword[rbp+1]
int3
    
Post 28 Mar 2026, 09:18
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8520
Location: Kraków, Poland
Tomasz Grysztar 28 Mar 2026, 10:40
tthsqe wrote:
seems to me it should be mod != 0 & mod != 3 for mode > 16
I'm correcting it for both modes, it should be symmetrical to 5 and 6 cases here: https://github.com/tgrysztar/fasm2/blob/f5487a01c12b9374b96729b429942fe916325408/include/x86-2.inc#L971
Post 28 Mar 2026, 10:40
View user's profile Send private message Visit poster's website Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 771
tthsqe 28 Mar 2026, 15:10
Next you have to explain how the previous version of fasm2 was able to correctly assemble rbp+64 in the same code. Also, this gets fasm2 stuck in an infinite loop:
Code:
vmulpd zmm0,zmm1,rax{1to8}    
Post 28 Mar 2026, 15:10
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8520
Location: Kraków, Poland
Tomasz Grysztar 28 Mar 2026, 17:47
Fixed.
Post 28 Mar 2026, 17:47
View user's profile Send private message Visit poster's website 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-2026, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.