This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch i386]: PR/38900 ICE for fastcall functions with -O2
Hello,
the first patch I posted just cured the ICE but produces wrong code.
So I modified patch and add an additional testcase for dllimport'ed
fastcall method with more then one argument to my patch. The problem
is that ecx and edx are used by fastcall functions for register
passing, This patch makes sure that for the case that ecx and edx are
used for argument passing to sibcalled function, eax is used as call
register.
2009-07-06 Kai Tietz <kai.tietz@onevision.com>
* config/i386/i386.md (sibcall_1): Set c,d to !c,!d.
(sibcall_value_1): Likewise.
ChangeLog for gcc/testsuite
2009-07-06 Kai Tietz <kai.tietz@onevision.com>
*gcc.dg/pr38900.c: New testcase.
*gcc.dg/pr38900-1.c: New testcase.
Tested for i686-pc-mingw32. Ok for trunk and then a back merge to
4.3,4.4 branches?
Cheers,
Kai
--
| (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination
Index: gcc/gcc/config/i386/i386.md
===================================================================
--- gcc.orig/gcc/config/i386/i386.md 2009-07-06 18:14:36.155670000 +0200
+++ gcc/gcc/config/i386/i386.md 2009-07-06 18:53:10.459670100 +0200
@@ -15536,7 +15536,7 @@
[(set_attr "type" "call")])
(define_insn "*sibcall_1"
- [(call (mem:QI (match_operand:SI 0 "sibcall_insn_operand" "s,c,d,a"))
+ [(call (mem:QI (match_operand:SI 0 "sibcall_insn_operand" "s,!c,!d,a"))
(match_operand 1 "" ""))]
"SIBLING_CALL_P (insn) && !TARGET_64BIT"
{
@@ -22183,7 +22183,7 @@
(define_insn "*sibcall_value_1"
[(set (match_operand 0 "" "")
- (call (mem:QI (match_operand:SI 1 "sibcall_insn_operand" "s,c,d,a"))
+ (call (mem:QI (match_operand:SI 1 "sibcall_insn_operand" "s,!c,!d,a"))
(match_operand:SI 2 "" "")))]
"SIBLING_CALL_P (insn) && !TARGET_64BIT"
{
Index: gcc/gcc/testsuite/gcc.dg/pr38900.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc/gcc/testsuite/gcc.dg/pr38900.c 2009-07-06 19:04:45.973670100 +0200
@@ -0,0 +1,9 @@
+/* { dg-do compile { target i?86-pc-mingw* } } */
+void __attribute__((dllimport,fastcall)) h(int,int);
+
+void f()
+{
+ h(2,1);
+ h(1,2);
+}
+
Index: gcc/gcc/testsuite/gcc.dg/pr38900-1.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc/gcc/testsuite/gcc.dg/pr38900-1.c 2009-07-06 19:04:23.965670100 +0200
@@ -0,0 +1,9 @@
+/* { dg-do compile { target i?86-pc-mingw* } } */
+void __attribute__((dllimport,fastcall)) h(int);
+
+void f()
+{
+ h(2);
+ h(1);
+}
+