mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 13:06:18 +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
|
type
|
||||||
|
|
||||||
TTestFileTyp = (tfNasm, tfFPC);
|
TTestFileTyp = (tfNasm, tfFPC, tfFasm);
|
||||||
|
|
||||||
TAVXTestGenerator = class(TObject)
|
TAVXTestGenerator = class(TObject)
|
||||||
private
|
private
|
||||||
@ -52,7 +52,7 @@ end;
|
|||||||
procedure TAVXTestGenerator.Init;
|
procedure TAVXTestGenerator.Init;
|
||||||
begin
|
begin
|
||||||
FOpCodeList.Add('VADDPD,1,1,XMMREG,XMMREG,XMMRM,');
|
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,XMMREG,XMMREG,XMMRM,');
|
||||||
FOpCodeList.Add('VADDPS,1,1,YMMREG,YMMREG,YMMRM,');
|
FOpCodeList.Add('VADDPS,1,1,YMMREG,YMMREG,YMMRM,');
|
||||||
FOpCodeList.Add('VADDSD,1,1,XMMREG,XMMREG,MEM64,');
|
FOpCodeList.Add('VADDSD,1,1,XMMREG,XMMREG,MEM64,');
|
||||||
@ -772,7 +772,7 @@ begin
|
|||||||
FOpCodeList.Add('VFNMSUB231SD,1,1,XMMREG,XMMREG,XMMRM,');
|
FOpCodeList.Add('VFNMSUB231SD,1,1,XMMREG,XMMREG,XMMRM,');
|
||||||
FOpCodeList.Add('VFNMSUB132SS,1,1,XMMREG,XMMREG,XMMRM,');
|
FOpCodeList.Add('VFNMSUB132SS,1,1,XMMREG,XMMREG,XMMRM,');
|
||||||
FOpCodeList.Add('VFNMSUB213SS,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;
|
end;
|
||||||
|
|
||||||
function TAVXTestGenerator.InternalMakeTestFiles(aX64: boolean; aDestPath, aFileExt: String;
|
function TAVXTestGenerator.InternalMakeTestFiles(aX64: boolean; aDestPath, aFileExt: String;
|
||||||
@ -899,7 +899,7 @@ begin
|
|||||||
slFooter.Add('end.');
|
slFooter.Add('end.');
|
||||||
end;
|
end;
|
||||||
tfNasm: begin
|
tfNasm: begin
|
||||||
writeln(format('outputformat: fpc platform: %s path: %s',
|
writeln(format('outputformat: Nasm platform: %s path: %s',
|
||||||
[cPlatform[aX64], aDestPath]));
|
[cPlatform[aX64], aDestPath]));
|
||||||
|
|
||||||
FileExt := '.asm';
|
FileExt := '.asm';
|
||||||
@ -907,6 +907,24 @@ begin
|
|||||||
if aX64 then slHeader.Add('[BITS 64]')
|
if aX64 then slHeader.Add('[BITS 64]')
|
||||||
else slHeader.Add('[BITS 32]');
|
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
|
for i := 1 to 10 do
|
||||||
slHeader.Add('NOP');
|
slHeader.Add('NOP');
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ begin
|
|||||||
writeln('make avx assembler-testfiles');
|
writeln('make avx assembler-testfiles');
|
||||||
writeln('');
|
writeln('');
|
||||||
writeln('-h help');
|
writeln('-h help');
|
||||||
writeln('-f [fpc,nasm] outputformat');
|
writeln('-f [fpc,nasm,fasm] outputformat');
|
||||||
writeln('-p [x8664] codegenerator for x86_64 platform');
|
writeln('-p [x8664] codegenerator for x86_64 platform');
|
||||||
writeln('-o destination path');
|
writeln('-o destination path');
|
||||||
writeln('');
|
writeln('');
|
||||||
@ -51,6 +51,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
case OutputFormat of
|
case OutputFormat of
|
||||||
'f': MakeTestFiles(tfFPC, x64, Path);
|
'f': MakeTestFiles(tfFPC, x64, Path);
|
||||||
|
'F': MakeTestFiles(tfFasm, x64, Path);
|
||||||
'n': MakeTestFiles(tfNasm, x64, Path);
|
'n': MakeTestFiles(tfNasm, x64, Path);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -83,6 +83,7 @@ begin
|
|||||||
'h': FHelp := true;
|
'h': FHelp := true;
|
||||||
'f': if sValue = 'fpc' then FOutputFormat := 'f'
|
'f': if sValue = 'fpc' then FOutputFormat := 'f'
|
||||||
else if sValue = 'nasm' then FOutputFormat := 'n'
|
else if sValue = 'nasm' then FOutputFormat := 'n'
|
||||||
|
else if sValue = 'fasm' then FOutputFormat := 'F'
|
||||||
else IsInvalidParam := true;
|
else IsInvalidParam := true;
|
||||||
'p': if sValue = 'x8664' then
|
'p': if sValue = 'x8664' then
|
||||||
begin
|
begin
|
||||||
|
@ -31,6 +31,12 @@ for %%a in (*.asm) do nasm -fwin64 %%a
|
|||||||
cd ..
|
cd ..
|
||||||
avxtestfilecmp -mtmp\*.obj -dtmp -eexe -s
|
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:
|
compare binary-files:
|
||||||
|
|
||||||
@ -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.10 /r] operand encoding: RVM
|
||||||
VMOVSD xmm1, xmm2, xmm3 [VEX.NDS.LIG.F2.0F.WIG.11 /r] operand encoding: MVR
|
VMOVSD xmm1, xmm2, xmm3 [VEX.NDS.LIG.F2.0F.WIG.11 /r] operand encoding: MVR
|
||||||
|
|
||||||
|
|
||||||
currently (AVX I):
|
currently (AVX I):
|
||||||
|
|
||||||
VMOVAPD
|
VMOVAPD
|
||||||
|
Loading…
Reference in New Issue
Block a user