1
# DP: Proposed patch for PR target/40718
3
2009-08-23 Uros Bizjak <ubizjak@gmail.com>
6
* config/i386/i386.c (*call_pop_1): Disable for sibling calls.
7
(*call_value_pop_1): Ditto.
8
(*sibcall_pop_1): New insn pattern.
9
(*sibcall_value_pop_1): Ditto.
11
2009-08-23 Uros Bizjak <ubizjak@gmail.com>
14
* gcc.target/i386/pr40718.c: New test.
16
Index: gcc/testsuite/gcc.target/i386/pr40718.c
17
===================================================================
18
--- a/src/gcc/testsuite/gcc.target/i386/pr40718.c (revision 0)
19
+++ b/src/gcc/testsuite/gcc.target/i386/pr40718.c (revision 151031)
22
+/* { dg-require-effective-target ilp32 } */
23
+/* { dg-options "-O1 -foptimize-sibling-calls" } */
29
+ void (__attribute__((__stdcall__)) *f) (struct S *);
33
+void __attribute__((__stdcall__))
39
+void __attribute__((__stdcall__))
48
+ struct S s = { foo, 0 };
57
Index: gcc/config/i386/i386.md
58
===================================================================
59
--- a/src/gcc/config/i386/i386.md (revision 151027)
60
+++ b/src/gcc/config/i386/i386.md (revision 151031)
61
@@ -15476,22 +15476,25 @@
62
(match_operand:SI 1 "" ""))
63
(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
64
(match_operand:SI 2 "immediate_operand" "i")))]
66
+ "!SIBLING_CALL_P (insn) && !TARGET_64BIT"
68
if (constant_call_address_operand (operands[0], Pmode))
70
- if (SIBLING_CALL_P (insn))
75
- if (SIBLING_CALL_P (insn))
82
[(set_attr "type" "call")])
84
+(define_insn "*sibcall_pop_1"
85
+ [(call (mem:QI (match_operand:SI 0 "sibcall_insn_operand" "s,U"))
86
+ (match_operand:SI 1 "" ""))
87
+ (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
88
+ (match_operand:SI 2 "immediate_operand" "i,i")))]
89
+ "SIBLING_CALL_P (insn) && !TARGET_64BIT"
93
+ [(set_attr "type" "call")])
96
[(call (match_operand:QI 0 "" "")
97
(match_operand 1 "" ""))
98
@@ -22092,22 +22095,26 @@
99
(match_operand:SI 2 "" "")))
100
(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
101
(match_operand:SI 3 "immediate_operand" "i")))]
103
+ "!SIBLING_CALL_P (insn) && !TARGET_64BIT"
105
if (constant_call_address_operand (operands[1], Pmode))
107
- if (SIBLING_CALL_P (insn))
110
- return "call\t%P1";
112
- if (SIBLING_CALL_P (insn))
115
- return "call\t%A1";
116
+ return "call\t%P1";
117
+ return "call\t%A1";
119
[(set_attr "type" "callv")])
121
+(define_insn "*sibcall_value_pop_1"
122
+ [(set (match_operand 0 "" "")
123
+ (call (mem:QI (match_operand:SI 1 "sibcall_insn_operand" "s,U"))
124
+ (match_operand:SI 2 "" "")))
125
+ (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
126
+ (match_operand:SI 3 "immediate_operand" "i,i")))]
127
+ "SIBLING_CALL_P (insn) && !TARGET_64BIT"
131
+ [(set_attr "type" "callv")])
133
(define_insn "*call_value_0"
134
[(set (match_operand 0 "" "")
135
(call (mem:QI (match_operand:SI 1 "constant_call_address_operand" ""))