From f2f0a9602a03847ef4da72d015a52b15aca14354 Mon Sep 17 00:00:00 2001 From: Hui-May Chang Date: Tue, 29 May 2007 22:49:42 +0000 Subject: [PATCH] i386.c (ix86_function_regparm): Added checking of ix86_force_align_arg_pointer to determine the number of... * config/i386/i386.c (ix86_function_regparm): Added checking of ix86_force_align_arg_pointer to determine the number of register parameters. * gcc.target/i386/stack-realign.c: New. From-SVN: r125173 --- gcc/ChangeLog | 5 +++++ gcc/config/i386/i386.c | 3 ++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/i386/stack-realign.c | 16 ++++++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/stack-realign.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9c7429514df..8dca3071398 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2007-05-29 Hui-May Chang + * config/i386/i386.c (ix86_function_regparm): Added checking of + ix86_force_align_arg_pointer to determine the number of + register parameters. + 2007-05-29 Zdenek Dvorak * tree-vectorizer.h (DR_MISALIGNMENT): Cast aux to integer. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index f68dc6aabd2..51d7afe94bf 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -2837,7 +2837,8 @@ ix86_function_regparm (tree type, tree decl) /* We can't use regparm(3) for nested functions as these use static chain pointer in third argument. */ if (local_regparm == 3 - && decl_function_context (decl) + && (decl_function_context (decl) + || ix86_force_align_arg_pointer) && !DECL_NO_STATIC_CHAIN (decl)) local_regparm = 2; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6340ca4036e..8ed7efef2fa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2007-05-29 Hui-May Chang + + * gcc.target/i386/stack-realign.c: New. + 2007-05-29 Zdenek Dvorak * gcc.dg/tree-ssa/prefetch-6.c: New test. diff --git a/gcc/testsuite/gcc.target/i386/stack-realign.c b/gcc/testsuite/gcc.target/i386/stack-realign.c new file mode 100644 index 00000000000..75054e09c7e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/stack-realign.c @@ -0,0 +1,16 @@ +/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ +/* { dg-options "-mstackrealign -O2" } */ + +extern void abort (void); + +__attribute__((noinline)) static void foo (int i1, int i2, int i3) +{ + if (i3 != 3) + abort (); +} + +int main (int argc, char **argv) +{ + foo (1, 2, 3); + return 0; +}