Re: [fpc-devel] implementation AVX for Intel/AMD Prozessors

2011-09-19 Thread Daniël Mantione



Op Sun, 18 Sep 2011, schreef Torsten:


I do not know exactly which functions need to be changed. I'm hoping for tips.


You will have to be a bit exploring here; AVX is a major upgrade to the 
x86 instruction set, and there will likely not be a few routines that need 
to be changed.


First step is to make sure they can be used in assembler routines. The 
assembler is largely table driven, so it you have added them to the 
tables, a lot should work already.


Nevertheless, I expect that modifications are necessary in the both the 
assembler generators (ag*.pas) and assembler readers (ra*.pas) due to the 
additional operand that needs to be written/parsed.


Only when the point is reached that the instructions are handled well by 
the assembler reader/writers you could start by adding code generator 
support.


Daniël___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] implementation AVX for Intel/AMD Prozessors

2011-09-18 Thread Torsten

Hi,

im starting with implementation of AVX (Intel/AMD) in fpc-assemblercode.

I use in first step a external assembler (linux as). In this case, it 
is easy to use XMM-Register (max. 3 parameter) (only change the file 
x86ins.dat, examble:


[VMOVDQA]
(Ch All, Ch None, Ch None)
xmmreg, xmmrm \361\...


For use of YMM-Register i have change the file x86reg.dat


NR_YMM0,$0700,ymm0,%ymm0,ymm0,ymm0,21,21,17,OT_YMMREG,0
NR_YMM1,$0701,ymm1,%ymm1,ymm1,ymm1,22,22,18,OT_YMMREG,1
NR_YMM2,$0702,ymm2,%ymm2,ymm2,ymm2,23,23,19,OT_YMMREG,2
NR_YMM3,$0703,ymm3,%ymm3,ymm3,ymm3,24,24,20,OT_YMMREG,3
NR_YMM4,$0704,ymm4,%ymm4,ymm4,ymm4,25,25,21,OT_YMMREG,4
NR_YMM5,$0705,ymm5,%ymm5,ymm5,ymm5,26,26,22,OT_YMMREG,5
NR_YMM6,$0706,ymm6,%ymm6,ymm6,ymm6,27,27,23,OT_YMMREG,6
NR_YMM7,$0707,ymm7,%ymm7,ymm7,ymm7,28,28,24,OT_YMMREG,7
NR_YMM8,$0708,ymm8,%ymm8,ymm8,ymm8,-1,-1,25,OT_YMMREG,0,64
NR_YMM9,$0709,ymm9,%ymm9,ymm9,ymm9,-1,-1,26,OT_YMMREG,1,64
NR_YMM10,$070a,ymm10,%ymm10,ymm10,ymm10,-1,-1,27,OT_YMMREG,2,64
NR_YMM11,$070b,ymm11,%ymm11,ymm11,ymm11,-1,-1,28,OT_YMMREG,3,64
NR_YMM12,$070c,ymm12,%ymm12,ymm12,ymm12,-1,-1,29,OT_YMMREG,4,64
NR_YMM13,$070d,ymm13,%ymm13,ymm13,ymm13,-1,-1,30,OT_YMMREG,5,64
NR_YMM14,$070e,ymm14,%ymm14,ymm14,ymm14,-1,-1,31,OT_YMMREG,6,64
NR_YMM15,$070f,ymm15,%ymm15,ymm15,ymm15,-1,-1,32,OT_YMMREG,7,64

Next step is change the files cpubase, cgbase, aasmcpu, 
What do i consider?


Regards
Torsten


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] implementation AVX for Intel/AMD Prozessors

2011-09-18 Thread Florian Klämpfl
Am 18.09.2011 10:54, schrieb Torsten:
 Hi,
 
 im starting with implementation of AVX (Intel/AMD) in fpc-assemblercode.
 
 I use in first step a external assembler (linux as). In this case, it
 is easy to use XMM-Register (max. 3 parameter) (only change the file
 x86ins.dat, examble:
 
 [VMOVDQA]
 (Ch All, Ch None, Ch None)
 xmmreg, xmmrm \361\...

Problem is probably the correct encoding sequence.

 
 
 For use of YMM-Register i have change the file x86reg.dat
 
 
 NR_YMM0,$0700,ymm0,%ymm0,ymm0,ymm0,21,21,17,OT_YMMREG,0
 NR_YMM1,$0701,ymm1,%ymm1,ymm1,ymm1,22,22,18,OT_YMMREG,1
 NR_YMM2,$0702,ymm2,%ymm2,ymm2,ymm2,23,23,19,OT_YMMREG,2
 NR_YMM3,$0703,ymm3,%ymm3,ymm3,ymm3,24,24,20,OT_YMMREG,3
 NR_YMM4,$0704,ymm4,%ymm4,ymm4,ymm4,25,25,21,OT_YMMREG,4
 NR_YMM5,$0705,ymm5,%ymm5,ymm5,ymm5,26,26,22,OT_YMMREG,5
 NR_YMM6,$0706,ymm6,%ymm6,ymm6,ymm6,27,27,23,OT_YMMREG,6
 NR_YMM7,$0707,ymm7,%ymm7,ymm7,ymm7,28,28,24,OT_YMMREG,7
 NR_YMM8,$0708,ymm8,%ymm8,ymm8,ymm8,-1,-1,25,OT_YMMREG,0,64
 NR_YMM9,$0709,ymm9,%ymm9,ymm9,ymm9,-1,-1,26,OT_YMMREG,1,64
 NR_YMM10,$070a,ymm10,%ymm10,ymm10,ymm10,-1,-1,27,OT_YMMREG,2,64
 NR_YMM11,$070b,ymm11,%ymm11,ymm11,ymm11,-1,-1,28,OT_YMMREG,3,64
 NR_YMM12,$070c,ymm12,%ymm12,ymm12,ymm12,-1,-1,29,OT_YMMREG,4,64
 NR_YMM13,$070d,ymm13,%ymm13,ymm13,ymm13,-1,-1,30,OT_YMMREG,5,64
 NR_YMM14,$070e,ymm14,%ymm14,ymm14,ymm14,-1,-1,31,OT_YMMREG,6,64
 NR_YMM15,$070f,ymm15,%ymm15,ymm15,ymm15,-1,-1,32,OT_YMMREG,7,64

I'am not sure if the ymm registers should be an own register class.
After all, they are a superset of xmm

 
 Next step is change the files cpubase, cgbase, aasmcpu, 
 What do i consider?

In which regard?
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] implementation AVX for Intel/AMD Prozessors

2011-09-18 Thread Daniël Mantione



Op Sun, 18 Sep 2011, schreef Florian Klämpfl:


I'am not sure if the ymm registers should be an own register class.
After all, they are a superset of xmm


Exactly. Since if xmm0 is allocated, ymm0 is allocated too; the register 
allocator should treat them as a single register. xmm0 and ymm0 are a 
subregister of the same superregister.


Daniël___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] implementation AVX for Intel/AMD Prozessors

2011-09-18 Thread Torsten

Am 18.09.2011 11:02, schrieb Florian Klämpfl:

Am 18.09.2011 10:54, schrieb Torsten:

Hi,

im starting with implementation of AVX (Intel/AMD) in fpc-assemblercode.

I use in first step a external assembler (linux as). In this case, it
is easy to use XMM-Register (max. 3 parameter) (only change the file
x86ins.dat, examble:

[VMOVDQA]
(Ch All, Ch None, Ch None)
xmmreg, xmmrm \361\...

Problem is probably the correct encoding sequence.
Yes, i known. I think that is important for the internal assembler, but 
not external.






For use of YMM-Register i have change the file x86reg.dat


NR_YMM0,$0700,ymm0,%ymm0,ymm0,ymm0,21,21,17,OT_YMMREG,0
NR_YMM1,$0701,ymm1,%ymm1,ymm1,ymm1,22,22,18,OT_YMMREG,1
NR_YMM2,$0702,ymm2,%ymm2,ymm2,ymm2,23,23,19,OT_YMMREG,2
NR_YMM3,$0703,ymm3,%ymm3,ymm3,ymm3,24,24,20,OT_YMMREG,3
NR_YMM4,$0704,ymm4,%ymm4,ymm4,ymm4,25,25,21,OT_YMMREG,4
NR_YMM5,$0705,ymm5,%ymm5,ymm5,ymm5,26,26,22,OT_YMMREG,5
NR_YMM6,$0706,ymm6,%ymm6,ymm6,ymm6,27,27,23,OT_YMMREG,6
NR_YMM7,$0707,ymm7,%ymm7,ymm7,ymm7,28,28,24,OT_YMMREG,7
NR_YMM8,$0708,ymm8,%ymm8,ymm8,ymm8,-1,-1,25,OT_YMMREG,0,64
NR_YMM9,$0709,ymm9,%ymm9,ymm9,ymm9,-1,-1,26,OT_YMMREG,1,64
NR_YMM10,$070a,ymm10,%ymm10,ymm10,ymm10,-1,-1,27,OT_YMMREG,2,64
NR_YMM11,$070b,ymm11,%ymm11,ymm11,ymm11,-1,-1,28,OT_YMMREG,3,64
NR_YMM12,$070c,ymm12,%ymm12,ymm12,ymm12,-1,-1,29,OT_YMMREG,4,64
NR_YMM13,$070d,ymm13,%ymm13,ymm13,ymm13,-1,-1,30,OT_YMMREG,5,64
NR_YMM14,$070e,ymm14,%ymm14,ymm14,ymm14,-1,-1,31,OT_YMMREG,6,64
NR_YMM15,$070f,ymm15,%ymm15,ymm15,ymm15,-1,-1,32,OT_YMMREG,7,64

I'am not sure if the ymm registers should be an own register class.
After all, they are a superset of xmm


OK.


Next step is change the files cpubase, cgbase, aasmcpu, 
What do i consider?

In which regard?


I do not know exactly which functions need to be changed. I'm hoping for 
tips.



___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel




___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel