mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 07:39:25 +02:00
+ support for FASM output, using it for testing does not work though, see readme.txt
git-svn-id: trunk@27227 -
This commit is contained in:
parent
b3b9041f54
commit
3b14b28161
@ -8,7 +8,7 @@ uses Classes;
|
||||
|
||||
type
|
||||
|
||||
TTestFileTyp = (tfNasm, tfFPC);
|
||||
TTestFileTyp = (tfNasm, tfFPC, tfFasm);
|
||||
|
||||
TAVXTestGenerator = class(TObject)
|
||||
private
|
||||
@ -52,7 +52,7 @@ end;
|
||||
procedure TAVXTestGenerator.Init;
|
||||
begin
|
||||
FOpCodeList.Add('VADDPD,1,1,XMMREG,XMMREG,XMMRM,');
|
||||
FOpCodeList.Add('VADDPD,1,1,YMMREG,YMMREG,YMMRM,');
|
||||
{ FOpCodeList.Add('VADDPD,1,1,YMMREG,YMMREG,YMMRM,');
|
||||
FOpCodeList.Add('VADDPS,1,1,XMMREG,XMMREG,XMMRM,');
|
||||
FOpCodeList.Add('VADDPS,1,1,YMMREG,YMMREG,YMMRM,');
|
||||
FOpCodeList.Add('VADDSD,1,1,XMMREG,XMMREG,MEM64,');
|
||||
@ -772,7 +772,7 @@ begin
|
||||
FOpCodeList.Add('VFNMSUB231SD,1,1,XMMREG,XMMREG,XMMRM,');
|
||||
FOpCodeList.Add('VFNMSUB132SS,1,1,XMMREG,XMMREG,XMMRM,');
|
||||
FOpCodeList.Add('VFNMSUB213SS,1,1,XMMREG,XMMREG,XMMRM,');
|
||||
FOpCodeList.Add('VFNMSUB231SS,1,1,XMMREG,XMMREG,XMMRM,');
|
||||
FOpCodeList.Add('VFNMSUB231SS,1,1,XMMREG,XMMREG,XMMRM,'); }
|
||||
end;
|
||||
|
||||
function TAVXTestGenerator.InternalMakeTestFiles(aX64: boolean; aDestPath, aFileExt: String;
|
||||
@ -899,7 +899,7 @@ begin
|
||||
slFooter.Add('end.');
|
||||
end;
|
||||
tfNasm: begin
|
||||
writeln(format('outputformat: fpc platform: %s path: %s',
|
||||
writeln(format('outputformat: Nasm platform: %s path: %s',
|
||||
[cPlatform[aX64], aDestPath]));
|
||||
|
||||
FileExt := '.asm';
|
||||
@ -907,6 +907,24 @@ begin
|
||||
if aX64 then slHeader.Add('[BITS 64]')
|
||||
else slHeader.Add('[BITS 32]');
|
||||
|
||||
for i := 1 to 10 do
|
||||
slHeader.Add('NOP');
|
||||
|
||||
for i := 1 to 10 do
|
||||
slFooter.Add('NOP');
|
||||
end;
|
||||
tfFasm: begin
|
||||
writeln(format('outputformat: Fasm platform: %s path: %s',
|
||||
[cPlatform[aX64], aDestPath]));
|
||||
|
||||
FileExt := '.asm';
|
||||
|
||||
if aX64 then slHeader.Add('format MS64 COFF')
|
||||
else slHeader.Add('format MS COFF');
|
||||
|
||||
slHeader.Add('section ''.text'' code readable executable');
|
||||
slHeader.Add('myproc:');
|
||||
|
||||
for i := 1 to 10 do
|
||||
slHeader.Add('NOP');
|
||||
|
||||
|
@ -42,7 +42,7 @@ begin
|
||||
writeln('make avx assembler-testfiles');
|
||||
writeln('');
|
||||
writeln('-h help');
|
||||
writeln('-f [fpc,nasm] outputformat');
|
||||
writeln('-f [fpc,nasm,fasm] outputformat');
|
||||
writeln('-p [x8664] codegenerator for x86_64 platform');
|
||||
writeln('-o destination path');
|
||||
writeln('');
|
||||
@ -51,6 +51,7 @@ begin
|
||||
begin
|
||||
case OutputFormat of
|
||||
'f': MakeTestFiles(tfFPC, x64, Path);
|
||||
'F': MakeTestFiles(tfFasm, x64, Path);
|
||||
'n': MakeTestFiles(tfNasm, x64, Path);
|
||||
end;
|
||||
end;
|
||||
|
@ -83,6 +83,7 @@ begin
|
||||
'h': FHelp := true;
|
||||
'f': if sValue = 'fpc' then FOutputFormat := 'f'
|
||||
else if sValue = 'nasm' then FOutputFormat := 'n'
|
||||
else if sValue = 'fasm' then FOutputFormat := 'F'
|
||||
else IsInvalidParam := true;
|
||||
'p': if sValue = 'x8664' then
|
||||
begin
|
||||
|
@ -31,6 +31,12 @@ for %%a in (*.asm) do nasm -fwin64 %%a
|
||||
cd ..
|
||||
avxtestfilecmp -mtmp\*.obj -dtmp -eexe -s
|
||||
|
||||
****************************************************************************************************
|
||||
Note:
|
||||
While avxtestgenerator supports FASM output, testing with FASM does not work because
|
||||
FASM assembles slightly different from FPC, e.g. it swaps base and index register
|
||||
in references if this is benefical (e.g. [rbp+rax] => [rax+rbp] saves one byte).
|
||||
****************************************************************************************************
|
||||
|
||||
compare binary-files:
|
||||
|
||||
@ -41,7 +47,7 @@ e.g.
|
||||
|
||||
possible binary-codes:
|
||||
VMOVAPD xmm1, xmm2/m128 [VEX.128.66.0F.28 /r]
|
||||
VMOVAPD xmm2/m128, xmm1 [VEX.128.66.0F.29 /r]
|
||||
VMOVAPD xmm2/m128, xmm1 [VEX.128.66.0F.29 /r]
|
||||
|
||||
|
||||
VMOVSD XMM1, XMM2, XMM3
|
||||
@ -50,7 +56,6 @@ e.g.
|
||||
VMOVSD xmm1, xmm2, xmm3 [VEX.NDS.LIG.F2.0F.WIG.10 /r] operand encoding: RVM
|
||||
VMOVSD xmm1, xmm2, xmm3 [VEX.NDS.LIG.F2.0F.WIG.11 /r] operand encoding: MVR
|
||||
|
||||
|
||||
currently (AVX I):
|
||||
|
||||
VMOVAPD
|
||||
|
Loading…
Reference in New Issue
Block a user