digitalmars.D - GDC and leaf functions
- Manu (10/10) Mar 04 2013 I'm doing a lot of experiments with GDC, and I'm noticing that leaf
- David Nadlinger (5/18) Mar 04 2013 http://d.godbolt.org/#%7B%22version%22%3A3%2C%22filterAsm%22%3A%7B%22lab...
- Manu (38/64) Mar 04 2013 Hmm, it seems PPC is working too.
I'm doing a lot of experiments with GDC, and I'm noticing that leaf
functions are still generating a stack frame and doing pointless work...
int leaf() pure nothrow
{
return 0;
}
compile with -frelease -finline -O3, etc
I expect 2 opcodes, load immediate and return, but I get a whole pointless
function including memory access O_O
Any ideas? Is this normal?
Mar 04 2013
On Monday, 4 March 2013 at 15:25:43 UTC, Manu wrote:
I'm doing a lot of experiments with GDC, and I'm noticing that
leaf
functions are still generating a stack frame and doing
pointless work...
int leaf() pure nothrow
{
return 0;
}
compile with -frelease -finline -O3, etc
I expect 2 opcodes, load immediate and return, but I get a
whole pointless
function including memory access O_O
Any ideas? Is this normal?
The rest is just code for registering the ModuleInfo of the given
module in the global list.
David
Mar 04 2013
Hmm, it seems PPC is working too.
Actually, maybe it's just SH4. I think my tests on other arch's were thrown
by bad compiler options.
Hmmm...
extern(C) float testfunc(float v, float v2)
{
return v*v2 + v2;
}
PPC:
testfunc:
fmadds 1,1,2,2
blr
MIPS:
testfunc:
j $31
madd.s $f0,$f13,$f12,$f13
SH4 Produces:
testfunc:
mov.l .L3,r1
lds.l r1+,fpscr
fmov fr4,fr0
fmac fr0,fr5,fr0
rts
lds.l r1+,fpscr
But it should be:
testfunc:
fmov fr4,fr0
fmac fr0,fr5,fr0
rts
On 5 March 2013 03:39, David Nadlinger <see klickverbot.at> wrote:
On Monday, 4 March 2013 at 15:25:43 UTC, Manu wrote:
I'm doing a lot of experiments with GDC, and I'm noticing that leaf
functions are still generating a stack frame and doing pointless work...
int leaf() pure nothrow
{
return 0;
}
compile with -frelease -finline -O3, etc
I expect 2 opcodes, load immediate and return, but I get a whole pointle=
ss
function including memory access O_O
Any ideas? Is this normal?
22filterAsm%22%3A%7B%22labels%**22%3Atrue%2C%22directives%22%**
3Atrue%2C%22commentOnly%22%**3Atrue%2C%22intel%22%3Atrue%**
7D%2C%22compilers%22%3A%5B%7B%**22source%22%3A%22int%20leaf()%**
20pure%20nothrow%5Cn%7B%5Cn%**20%20return%200%3B%5Cn%7D%22%**
2C%22compiler%22%3A%22%2Fusr%**2Fbin%2Fgdc%22%2C%22options%**
ersion%22%3A3%2C%22filterAsm%22%3A%7B%22labels%22%3Atrue%2C%22directives%22=
%3Atrue%2C%22commentOnly%22%3Atrue%2C%22intel%22%3Atrue%7D%2C%22compilers%2=
2%3A%5B%7B%22source%22%3A%22int%20leaf()%20pure%20nothrow%5Cn%7B%5Cn%20%20r=
eturn%200%3B%5Cn%7D%22%2C%22compiler%22%3A%22%2Fusr%2Fbin%2Fgdc%22%2C%22opt=
ions%22%3A%22-O3%20-march%3Dnative%22%7D%5D%7D>
The rest is just code for registering the ModuleInfo of the given module
in the global list.
David
Mar 04 2013








Manu <turkeyman gmail.com>