delphi - divpd unrecognized opcode x64 -
i have created quite assembler optimized library matrix operations meant delphi 2007+.
the code works quite under delphi wanted support freepascal , got quite far until encountered assembler syntax error on line like:
divdp xmm1, [r9 + rax - 112];
freepascal (actually lazaraus) reports there error: unrecognized opcoded divp
i'm bit puzzled since standard assembler directive... knows how can "teach" freepascal understand type of instruction?
(note don't want introduce db instructions...)
assembly code tricky running on new system.
first, delphi uses intel x86 assembly syntax, register names bare rax , xmm1; while freepascal default uses gnu/at&t syntax, operands listed destination-last, , register names decorated %rax , %xmm1. if prefer intel syntax, can switch default syntax either adding "-rintel" fpc command line, or add asmmode intel directive top of source code file:
{$asmmode intel}
second, divpd sse2 instruction, may need enable sse compiler's "fpu instruction set". seems default on fpc 2.6.2 64-bit install, other machines may need add "-cfsse3" flag fpc command line.
together, sse inline assembly works on freepascal compiler default flags.
{$asmmode intel} program ssedemo; var x: int32; begin writeln('starting sse now:'); asm mov eax,40 cvtsi2sd xmm1,eax mov ecx,10 cvtsi2sd xmm2,ecx divsd xmm1,xmm2 cvtsd2si eax,xmm1 mov x,eax end; writeln(x); end.
Comments
Post a Comment