flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Tomasz Grysztar 03 Oct 2020, 15:58
The headers I published are focused on the instruction sets that ended up officially documented in Intel SDMs, and FMA4 was not among them - it was only officially supported with AMD's XOP, and I have not yet published packages for fasmg that would support AMD-specific extensions (like 3DNow! or XOP), mainly because there was no demand. With macro-based encoders it quite easy to implement new instruction sets, though, and you can support FMA4 with a simple header like:
Code: include 'cpu/ext/avx.inc' macro FMA4_instruction opcode,msize,dest,src,src2,src3 AVX.parse_operand @dest,dest AVX.parse_operand @src,src AVX.parse_operand @src2,src2 AVX.parse_operand @aux,src3 if @dest.type = 'mmreg' & @src.type = 'mmreg' & (@src2.type = 'mem' | @src2.type = 'mmreg') & (@aux.type = 'mem' | @aux.type = 'mmreg') if msize & (@dest.size < msize | (@dest.size > msize & @dest.size <> 16) | (@src2.type = 'mem' & @src2.size and not msize) | (@aux.type = 'mem' & @aux.size and not msize)) err 'invalid operand size' else if @src.size <> @dest.size | (@src2.size and not @dest.size & (@src2.type = 'mmreg' | msize = 0)) err 'operand sizes do not match' end if if @aux.type = 'mmreg' AVX.store_instruction @dest.size,VEX_66_0F3A_W0,opcode,@src2,@dest.rm,@src.rm,1,@aux.rm shl 4 else if @src2.type = 'mmreg' AVX.store_instruction @dest.size,VEX_66_0F3A_W1,opcode,@aux,@dest.rm,@src.rm,1,@src2.rm shl 4 else err 'invalid combination of operands' end if else err 'invalid combination of operands' end if end macro iterate <instr,opcode>, vfmaddsub,5Ch, vfmsubadd,5Eh, vfmadd,68h, vfmsub,6Ch, vfnmadd,78h, vfnmsub,7Ch macro instr#pd? dest*,src*,src2*,src3* FMA4_instruction opcode+1,0,dest,src,src2,src3 end macro macro instr#ps? dest*,src*,src2*,src3* FMA4_instruction opcode,0,dest,src,src2,src3 end macro if opcode > 60h macro instr#sd? dest*,src*,src2*,src3* FMA4_instruction opcode+3,8,dest,src,src2,src3 end macro macro instr#ss? dest*,src*,src2*,src3* FMA4_instruction opcode+2,4,dest,src,src2,src3 end macro end if end iterate PS. Perhaps you may also find these macros for fasm 1 interesting: Emulating FMA4 with FMA and vice versa. |
|||
![]() |
|
Melissa 04 Oct 2020, 11:13
Thanks!
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.