flat assembler
Message board for the users of flat assembler.

flat assembler > Macroinstructions > [fasmg][x86] Missing/incomplete instructions macros

Author
Thread Post new topic Reply to topic
GamoveR



Joined: 19 May 2019
Posts: 2
I generaly use fasmg for write high performance functions. So sometimes I have to use "seldom used instructions". I've noticed that instruction "prefetchw" have no macro in "fasmg package". I wrote my own based on macros for "prefetcht* instructions:
Code:
macro prefetchw? src*
        x86.parse_operand @src,src
        if @src.type = 'mem'
                if @src.size and not 1
                        err 'invalid operand size'
                end if
                x86.store_instruction <0Fh,0Dh>,@src,1
        else
                err 'invalid operand'
        end if
end macro
    



Also I found that "movnti" macro works only with 32 bits registers. I try to improve this macro to use also 64 bits registers:
Code:
macro movnti? dest*,src*
        x86.parse_operand @dest,dest
        x86.parse_operand @src,src
        local size
        if @dest.size = 0 & @src.size = 0
                err 'operand size not specified'
        else if @dest.size <> 0 & @src.size <> 0 & @dest.size <> @src.size
                err 'operand sizes do not match'
        else
                size = @dest.size or @src.size
        end if

        if @dest.type = 'mem' & @src.type = 'reg'
                if size <> 4 & size <> 8
                        err 'invalid operand size'
                end if
                x86.select_operand_prefix @dest,size
                x86.store_instruction <0Fh,0C3h>,@dest,@src.rm
        else
                err 'invalid combination of operands'
        end if
end macro
    
Post 01 Jul 2019, 12:16
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7318
Location: Kraków, Poland
Thank you! This is an ongoing process that I have trouble finishing, but I hoped that the macros should be manageable enough for people to tweak them whenever a need arises, and you are proving that my trust was not misplaced. Wink

If I remember correctly, PREFETCHW was originally introduced by AMD 3DNow! and this extension is not in my macro sets because I wanted to go purely for Intel-branded extensions at first. On the other hand, nowadays Intel has it too and there should probably be a separate include file for just this single instruction.

Ideally, I should probably just go through the list of all CPUID feature flags and make sure that there is an include file for each one of them...
Post 01 Jul 2019, 18:54
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-2019, Tomasz Grysztar.

Powered by rwasa.