re PR target/39496 (GCC uses non-standard calling conventions for static functions with -O0.)
PR target/39496 * config/i386/i386.c (ix86_function_regparm): Don't optimize local functions using regparm calling conventions when not optimizing. (ix86_function_sseregparm): Similarly for sseregparm calling conventions. * gcc.target/i386/pr39496.c: New test. * g++.dg/other/pr39496.C: New test. From-SVN: r144955
This commit is contained in:
parent
9e517d61f7
commit
f57c2f04ae
@ -1,3 +1,11 @@
|
||||
2009-03-19 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR target/39496
|
||||
* config/i386/i386.c (ix86_function_regparm): Don't optimize local
|
||||
functions using regparm calling conventions when not optimizing.
|
||||
(ix86_function_sseregparm): Similarly for sseregparm calling
|
||||
conventions.
|
||||
|
||||
2009-03-19 Li Feng <nemokingdom@gmail.com>
|
||||
|
||||
PR middle-end/39500
|
||||
|
@ -4309,7 +4309,9 @@ ix86_function_regparm (const_tree type, const_tree decl)
|
||||
return 2;
|
||||
|
||||
/* Use register calling convention for local functions when possible. */
|
||||
if (decl && TREE_CODE (decl) == FUNCTION_DECL
|
||||
if (decl
|
||||
&& TREE_CODE (decl) == FUNCTION_DECL
|
||||
&& optimize
|
||||
&& !profile_flag)
|
||||
{
|
||||
/* FIXME: remove this CONST_CAST when cgraph.[ch] is constified. */
|
||||
@ -4394,7 +4396,7 @@ ix86_function_sseregparm (const_tree type, const_tree decl, bool warn)
|
||||
|
||||
/* For local functions, pass up to SSE_REGPARM_MAX SFmode
|
||||
(and DFmode for SSE2) arguments in SSE registers. */
|
||||
if (decl && TARGET_SSE_MATH && !profile_flag)
|
||||
if (decl && TARGET_SSE_MATH && optimize && !profile_flag)
|
||||
{
|
||||
/* FIXME: remove this CONST_CAST when cgraph.[ch] is constified. */
|
||||
struct cgraph_local_info *i = cgraph_local_info (CONST_CAST_TREE(decl));
|
||||
|
@ -1,3 +1,9 @@
|
||||
2009-03-19 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR target/39496
|
||||
* gcc.target/i386/pr39496.c: New test.
|
||||
* g++.dg/other/pr39496.C: New test.
|
||||
|
||||
2009-03-19 Li Feng <nemokingdom@gmail.com>
|
||||
|
||||
PR middle-end/39500
|
||||
|
35
gcc/testsuite/g++.dg/other/pr39496.C
Normal file
35
gcc/testsuite/g++.dg/other/pr39496.C
Normal file
@ -0,0 +1,35 @@
|
||||
// PR target/39496
|
||||
// { dg-do compile { target { { i?86-*-linux* x86_64-*-linux* } && ilp32 } } }
|
||||
// { dg-options "-O0 -fverbose-asm -fno-omit-frame-pointer -msse2 -mfpmath=sse" }
|
||||
// Verify that {foo,bar}{,2}param are all passed on the stack, using
|
||||
// normal calling conventions, when not optimizing.
|
||||
// { dg-final { scan-assembler "\[^0-9-\]8\\(%ebp\\),\[^\n\]*fooparam," } }
|
||||
// { dg-final { scan-assembler "\[^0-9-\]8\\(%ebp\\),\[^\n\]*barparam," } }
|
||||
// { dg-final { scan-assembler "\[^0-9-\]8\\(%ebp\\),\[^\n\]*foo2param," } }
|
||||
// { dg-final { scan-assembler "\[^0-9-\]8\\(%ebp\\),\[^\n\]*bar2param," } }
|
||||
|
||||
static inline int foo (int fooparam)
|
||||
{
|
||||
return fooparam;
|
||||
}
|
||||
|
||||
static int bar (int barparam)
|
||||
{
|
||||
return foo (barparam);
|
||||
}
|
||||
|
||||
static inline double foo2 (double foo2param)
|
||||
{
|
||||
return foo2param;
|
||||
}
|
||||
|
||||
static double bar2 (double bar2param)
|
||||
{
|
||||
return foo2 (bar2param);
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return bar (0) + bar2 (0.0);
|
||||
}
|
35
gcc/testsuite/gcc.target/i386/pr39496.c
Normal file
35
gcc/testsuite/gcc.target/i386/pr39496.c
Normal file
@ -0,0 +1,35 @@
|
||||
/* PR target/39496 */
|
||||
/* { dg-do compile { target { { i?86-*-linux* x86_64-*-linux* } && ilp32 } } } */
|
||||
/* { dg-options "-O0 -fverbose-asm -fno-omit-frame-pointer -msse2 -mfpmath=sse" } */
|
||||
/* Verify that {foo,bar}{,2}param are all passed on the stack, using
|
||||
normal calling conventions, when not optimizing. */
|
||||
/* { dg-final { scan-assembler "\[^0-9-\]8\\(%ebp\\),\[^\n\]*fooparam," } } */
|
||||
/* { dg-final { scan-assembler "\[^0-9-\]8\\(%ebp\\),\[^\n\]*barparam," } } */
|
||||
/* { dg-final { scan-assembler "\[^0-9-\]8\\(%ebp\\),\[^\n\]*foo2param," } } */
|
||||
/* { dg-final { scan-assembler "\[^0-9-\]8\\(%ebp\\),\[^\n\]*bar2param," } } */
|
||||
|
||||
static inline int foo (int fooparam)
|
||||
{
|
||||
return fooparam;
|
||||
}
|
||||
|
||||
static int bar (int barparam)
|
||||
{
|
||||
return foo (barparam);
|
||||
}
|
||||
|
||||
static inline double foo2 (double foo2param)
|
||||
{
|
||||
return foo2param;
|
||||
}
|
||||
|
||||
static double bar2 (double bar2param)
|
||||
{
|
||||
return foo2 (bar2param);
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return bar (0) + bar2 (0.0);
|
||||
}
|
Loading…
Reference in New Issue
Block a user