www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Druntime DMD/LDC/GDC architecture

reply "Ilya Yaroshenko" <ilyayaroshenko gmail.com> writes:
Hello all!

very simple code:

------------------
double[] a, c;
...
c[] += a[];
------------------

The DMD version I can find in _arraySliceSliceAddass_d, 
https://github.com/D-Programming-Language/druntime/blob/master/
rc/rt/arraydouble.d 
.

What about LDC and GDC?
The _arraySliceSliceAddass_d is the same, no any version(LDC).

When I compile code into assembler I found other code then in asm 
scope.

So I suppose LDC has it's own architecture.
Is it right?

Where I can find it for understanding what optimization can be 
done by LLVM optimizer?

Have GDC it's own architecture too?

Best Regards,
Ilya
Jun 23 2014
next sibling parent "John Colvin" <john.loughran.colvin gmail.com> writes:
On Monday, 23 June 2014 at 18:09:46 UTC, Ilya Yaroshenko wrote:
 Hello all!

 very simple code:

 ------------------
 double[] a, c;
 ...
 c[] += a[];
 ------------------

 The DMD version I can find in _arraySliceSliceAddass_d, 
 https://github.com/D-Programming-Language/druntime/blob/master/
rc/rt/arraydouble.d 
 .

 What about LDC and GDC?
 The _arraySliceSliceAddass_d is the same, no any version(LDC).

 When I compile code into assembler I found other code then in 
 asm scope.

 So I suppose LDC has it's own architecture.
 Is it right?

 Where I can find it for understanding what optimization can be 
 done by LLVM optimizer?

 Have GDC it's own architecture too?

 Best Regards,
 Ilya

If you look at the bottom of those _array functions you will find a regular loop doing the cleanup for anything missed by the inline asm. If I remember correctly, for gdc it is this loop doing the whole operation as the asm is versioned out.
Jun 23 2014
prev sibling next sibling parent "Ilya Yaroshenko" <ilyayaroshenko gmail.com> writes:
 If you look at the bottom of those _array functions you will 
 find a regular loop doing the cleanup for anything missed by 
 the inline asm. If I remember correctly, for gdc it is this 
 loop doing the whole operation as the asm is versioned out.

I think it is something different. LDC has standard D inline asm.
Jun 23 2014
prev sibling parent "Kai Nacke" <kai redstar.de> writes:
On Monday, 23 June 2014 at 18:09:46 UTC, Ilya Yaroshenko wrote:
 Hello all!

 very simple code:

 ------------------
 double[] a, c;
 ...
 c[] += a[];
 ------------------

 The DMD version I can find in _arraySliceSliceAddass_d, 
 https://github.com/D-Programming-Language/druntime/blob/master/
rc/rt/arraydouble.d 
 .

 What about LDC and GDC?
 The _arraySliceSliceAddass_d is the same, no any version(LDC).

 When I compile code into assembler I found other code then in 
 asm scope.

 So I suppose LDC has it's own architecture.
 Is it right?

 Where I can find it for understanding what optimization can be 
 done by LLVM optimizer?

 Have GDC it's own architecture too?

 Best Regards,
 Ilya

Hi Ilya, I am not sure if I understand your question. I compiled this code with ldc void main() { double[] a, c; a[] = 1; c[] = 2; c[] += a[]; } (options ldc2 -c -output-ll -output-s -release -O0) and get in the main function movq 120(%rsp), %r8 movq 128(%rsp), %r9 movq 104(%rsp), %rcx movq 112(%rsp), %rdx callq _arraySliceSliceAddass_d Using -O1 or higher optimizes the call away, maybe that is the problem. Could you post the source code you are using? Regards, Kai
Jun 24 2014