summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUros Bizjak <uros@gcc.gnu.org>2009-08-23 11:46:00 +0200
committerUros Bizjak <uros@gcc.gnu.org>2009-08-23 11:46:00 +0200
commit8c40d061eca6c784a919c666e363cac4116874cc (patch)
tree5efa39dfb4f50d17c08703d97e16086240be1957
parent98791cfdb3d796c9f0c4febc1b342621343f92ad (diff)
downloadgcc-8c40d061eca6c784a919c666e363cac4116874cc.tar.gz
re PR target/40718 (Invalid code produced with -foptimize-sibling-calls)
PR target/40718 * config/i386/i386.c (*call_pop_1): Disable for sibling calls. (*sibcall_pop_1): New insn pattern. testsuite/ChangeLog: PR target/40718 * gcc.target/i386/pr40718.c: New test. From-SVN: r151028
-rw-r--r--gcc/ChangeLog28
-rw-r--r--gcc/config/i386/i386.md25
-rw-r--r--gcc/testsuite/ChangeLog9
-rw-r--r--gcc/testsuite/gcc.target/i386/pr40718.c36
4 files changed, 71 insertions, 27 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2163e002589..defd6b7b431 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-23 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/40718
+ * config/i386/i386.c (*call_pop_1): Disable for sibling calls.
+ (*sibcall_pop_1): New insn pattern.
+
2009-08-23 Alan Modra <amodra@bigpond.net.au>
PR target/41081
@@ -71,8 +77,7 @@
PR target/40671
* config/rs6000/rs6000.c (rs6000_override_options): Use
- TARGET_64BIT instead of TARGET_POWERPC64 to set the size of
- pointers.
+ TARGET_64BIT instead of TARGET_POWERPC64 to set the size of pointers.
PR target/41145
* config/rs6000/rs6000.c (rs6000_handle_altivec_attribute): Fix
@@ -105,8 +110,7 @@
2009-08-20 Richard Guenther <rguenther@suse.de>
- * c-objc-common.h (LANG_HOOKS_DUP_LANG_SPECIFIC_DECL): Do not
- define.
+ * c-objc-common.h (LANG_HOOKS_DUP_LANG_SPECIFIC_DECL): Do not define.
* c-tree.h (c_dup_lang_specific_decl): Remove.
(struct lang_decl, struct lang_type): Move definitions ...
* c-lang.h: ... here. New file.
@@ -253,8 +257,7 @@
2009-08-16 Douglas B Rupp <rupp@gnat.com>
- * doc/invoke.texi (Target options):
- Add new option list for IA-64/VMS.
+ * doc/invoke.texi (Target options): Add new option list for IA-64/VMS.
(menu): Add IA-64/VMS Options.
(IA-64/VMS Options): Likewise.
@@ -337,15 +340,12 @@
* doc/extend.texi (Symbol-Renaming Pragmas): redefine_extname is
supported on all platforms.
- * target.h (struct gcc_target): Remove
- handle_pragma_redefine_extname.
- * c-cppbuiltin.c: Remove use of
- targetm.handle_pragma_redefine_extname.
+ * target.h (struct gcc_target): Remove handle_pragma_redefine_extname.
+ * c-cppbuiltin.c: Remove use of targetm.handle_pragma_redefine_extname.
* c-pragma.c: Likewise.
* target-def.h (TARGET_INITIALIZER): Remove
TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME.
- * config/sol2.h: Remove use of
- TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME.
+ * config/sol2.h: Remove use of TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME.
2009-08-14 Douglas B Rupp <rupp@gnat.com>
@@ -400,8 +400,8 @@
2009-08-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
PR middle-end/30789
- * builtins.c (do_mpc_arg2): Make extern, define for any MPC
- version. Move declaration...
+ * builtins.c (do_mpc_arg2): Make extern, define for any MPC version.
+ Move declaration...
* real.h (do_mpc_arg2): ... here.
* fold-const.c (const_binop): Use MPC for complex MULT_EXPR
and RDIV_EXPR.
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 3d832f11249..3be44d3cbe9 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -15476,22 +15476,25 @@
(match_operand:SI 1 "" ""))
(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
(match_operand:SI 2 "immediate_operand" "i")))]
- "!TARGET_64BIT"
+ "!SIBLING_CALL_P (insn) && !TARGET_64BIT"
{
if (constant_call_address_operand (operands[0], Pmode))
- {
- if (SIBLING_CALL_P (insn))
- return "jmp\t%P0";
- else
- return "call\t%P0";
- }
- if (SIBLING_CALL_P (insn))
- return "jmp\t%A0";
- else
- return "call\t%A0";
+ return "call\t%P0";
+ return "call\t%A0";
}
[(set_attr "type" "call")])
+(define_insn "*sibcall_pop_1"
+ [(call (mem:QI (match_operand:SI 0 "sibcall_insn_operand" "s,U"))
+ (match_operand:SI 1 "" ""))
+ (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
+ (match_operand:SI 2 "immediate_operand" "i,i")))]
+ "SIBLING_CALL_P (insn) && !TARGET_64BIT"
+ "@
+ jmp\t%P0
+ jmp\t%A0"
+ [(set_attr "type" "call")])
+
(define_expand "call"
[(call (match_operand:QI 0 "" "")
(match_operand 1 "" ""))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index db8a1959817..7fc7d23b95c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-23 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/40718
+ * gcc.target/i386/pr40718.c: New test.
+
2009-08-22 Steven G. Kargl <kargl@gcc.gnu.org>
* gfortran.dg/proc_ptr_24.f90: New test.
@@ -22,8 +27,8 @@
2009-08-21 Uros Bizjak <ubizjak@gmail.com>
- * gfortran.dg/boz_9.f90: Do not generate denormal floating
- point numbers. Remove -mieee option for alpha*-*-* targets.
+ * gfortran.dg/boz_9.f90: Do not load denormal floating
+ point constants. Remove -mieee option for alpha*-*-* targets.
2009-08-21 Janus Weil <janus@gcc.gnu.org>
diff --git a/gcc/testsuite/gcc.target/i386/pr40718.c b/gcc/testsuite/gcc.target/i386/pr40718.c
new file mode 100644
index 00000000000..f6029ed98ab
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr40718.c
@@ -0,0 +1,36 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O1 -foptimize-sibling-calls" } */
+
+void abort (void);
+
+struct S
+{
+ void (__attribute__((__stdcall__)) *f) (struct S *);
+ int i;
+};
+
+void __attribute__((__stdcall__))
+foo (struct S *s)
+{
+ s->i++;
+}
+
+void __attribute__((__stdcall__))
+bar (struct S *s)
+{
+ foo(s);
+ s->f(s);
+}
+
+int main (void)
+{
+ struct S s = { foo, 0 };
+
+ bar (&s);
+ if (s.i != 2)
+ abort ();
+
+ return 0;
+}
+