From: "Markus Schöpflin" <no.spam@spam.spam>
Subject: Re: GNAT and register allocation
Date: Fri, 20 Apr 2012 15:48:06 +0200
Date: 2012-04-20T15:48:06+02:00 [thread overview]
Message-ID: <jmrpej$cao$1@speranza.aioe.org> (raw)
In-Reply-To: 4f9145b5$0$6557$9b4e6d93@newsspool4.arcor-online.net
Am 20.04.2012 13:17, schrieb Georg Bauhaus:
> On 20.04.12 12:21, Georg Bauhaus wrote:
>> Hi,
>>
>> in short, is there anything that one can do to make
>> GNAT use many registers? MMX registers in particular,
>> but not only.
>
> SSE, that is, darn, the registers being named xmmN.
>
>> It appears that the number of registers allocated increases
>> with inline expansion enabled. But only so much.
>
> In the (meaningless) example below, the translations of both
> Comp.A and Comp.B will use the same set of registers, xmm0 .. xmm1.
> If they were instead using xmm0 .. xmm1 and xmm2 .. xmm3,
> respectively, speed might well double.
[snip code]
As long as the functions are not inlined, I'd expect them to obey the calling
convention of the ABI of the platform on which they are compiled. Therefore
you won't see A using xmm0/1 and B using xmm2/3.
If they are inlined however, things look quite different. Here is what I get
when I compile your code:
---%<---
> gnatmake -g -O3 comp
gcc-4.4 -c -g -O3 comp.adb
> objdump -d comp.o
comp.o: file format elf64-x86-64
Disassembly of section .text:
...
0000000000000050 <comp___elabb>:
...
5b: e8 00 00 00 00 callq 60 <comp___elabb+0x10>
60: 84 c0 test %al,%al
62: 0f 84 8f 00 00 00 je f7 <comp___elabb+0xa7>
68: 66 0f 57 c9 xorpd %xmm1,%xmm1
6c: 31 c0 xor %eax,%eax
6e: f2 0f 10 05 00 00 00 movsd 0x0(%rip),%xmm0 # 76
<comp___elabb+0x26>
75: 00
76: f2 0f 10 15 00 00 00 movsd 0x0(%rip),%xmm2 # 7e
<comp___elabb+0x2e>
7d: 00
7e: f2 0f 5c c8 subsd %xmm0,%xmm1
82: f2 0f 10 35 00 00 00 movsd 0x0(%rip),%xmm6 # 8a
<comp___elabb+0x3a>
89: 00
8a: f2 0f 10 2d 00 00 00 movsd 0x0(%rip),%xmm5 # 92
<comp___elabb+0x42>
91: 00
92: f2 0f 10 25 00 00 00 movsd 0x0(%rip),%xmm4 # 9a
<comp___elabb+0x4a>
99: 00
9a: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1)
a0: 66 0f 28 d9 movapd %xmm1,%xmm3
a4: f2 0f 59 cd mulsd %xmm5,%xmm1
a8: f2 0f 5c c2 subsd %xmm2,%xmm0
ac: 83 c0 01 add $0x1,%eax
af: f2 0f 5e de divsd %xmm6,%xmm3
b3: 3d 40 42 0f 00 cmp $0xf4240,%eax
b8: f2 0f 58 c9 addsd %xmm1,%xmm1
bc: f2 0f 58 c0 addsd %xmm0,%xmm0
c0: f2 0f 58 c3 addsd %xmm3,%xmm0
c4: f2 0f 59 c0 mulsd %xmm0,%xmm0
c8: 66 0f 28 d8 movapd %xmm0,%xmm3
cc: f2 0f 58 da addsd %xmm2,%xmm3
d0: f2 0f 58 cb addsd %xmm3,%xmm1
d4: f2 0f 59 c9 mulsd %xmm1,%xmm1
d8: f2 0f 5e cc divsd %xmm4,%xmm1
dc: 75 c2 jne a0 <comp___elabb+0x50>
de: f2 0f 58 c1 addsd %xmm1,%xmm0
e2: f2 0f 59 05 00 00 00 mulsd 0x0(%rip),%xmm0 # ea
<comp___elabb+0x9a>
e9: 00
ea: f2 0f 11 05 00 00 00 movsd %xmm0,0x0(%rip) # f2
<comp___elabb+0xa2>
--->%---
As you can see, the xmmN registers up to xmm6 are used. Do you get different
results?
Markus
next prev parent reply other threads:[~2012-04-20 13:48 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-20 10:21 GNAT and register allocation Georg Bauhaus
2012-04-20 11:17 ` Georg Bauhaus
2012-04-20 13:48 ` Markus Schöpflin [this message]
2012-04-20 15:34 ` Georg Bauhaus
2012-04-21 12:10 ` Stephen Leake
2012-04-22 16:43 ` Georg Bauhaus
2012-04-22 17:39 ` Jacob Sparre Andersen
2012-04-22 21:14 ` Georg Bauhaus
2012-04-24 12:24 ` Stephen Leake
2012-04-24 13:27 ` Georg Bauhaus
2012-04-24 18:40 ` "gnatchop" and ".gpr" files? (Was: GNAT and register allocation) Jacob Sparre Andersen
2012-04-25 11:51 ` GNAT and register allocation Stephen Leake
2012-04-25 12:54 ` Georg Bauhaus
2012-04-26 10:55 ` Stephen Leake
2012-04-26 17:15 ` Georg Bauhaus
2012-04-24 12:21 ` Stephen Leake
2012-04-22 17:30 ` Georg Bauhaus
2012-04-21 15:41 ` Florian Weimer
2012-04-22 16:53 ` Georg Bauhaus
2012-04-22 20:53 ` gautier_niouzes
2012-04-22 21:24 ` Georg Bauhaus
2012-04-23 8:43 ` gautier_niouzes
2012-04-23 16:46 ` Georg Bauhaus
2012-04-23 9:11 ` gautier_niouzes
2012-04-23 16:47 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox