Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 282189
Collapse All | Expand All

(-)gcc/testsuite/gcc.target/i386/pr40718.c (+36 lines)
Line 0 Link Here
1
/* { dg-do run } */
2
/* { dg-require-effective-target ilp32 } */
3
/* { dg-options "-O1 -foptimize-sibling-calls" } */
4
5
void abort (void);
6
7
struct S
8
{
9
  void (__attribute__((__stdcall__)) *f) (struct S *);
10
  int i;
11
};
12
13
void __attribute__((__stdcall__))
14
foo (struct S *s)
15
{
16
  s->i++;
17
}
18
19
void __attribute__((__stdcall__))
20
bar (struct S *s)
21
{
22
  foo(s);
23
  s->f(s);
24
}
25
26
int main (void)
27
{
28
  struct S s = { foo, 0 };
29
30
  bar (&s);
31
  if (s.i != 2)
32
    abort ();
33
34
  return 0;
35
}
36
(-)gcc/config/i386/i386.md (-22 / +29 lines)
Lines 14973-14994 Link Here
14973
	 (match_operand:SI 1 "" ""))
14973
	 (match_operand:SI 1 "" ""))
14974
   (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
14974
   (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
14975
			    (match_operand:SI 2 "immediate_operand" "i")))]
14975
			    (match_operand:SI 2 "immediate_operand" "i")))]
14976
  "!TARGET_64BIT"
14976
  "!SIBLING_CALL_P (insn) && !TARGET_64BIT"
14977
{
14977
{
14978
  if (constant_call_address_operand (operands[0], Pmode))
14978
  if (constant_call_address_operand (operands[0], Pmode))
14979
    {
14979
    return "call\t%P0";
14980
      if (SIBLING_CALL_P (insn))
14980
  return "call\t%A0";
14981
	return "jmp\t%P0";
14982
      else
14983
	return "call\t%P0";
14984
    }
14985
  if (SIBLING_CALL_P (insn))
14986
    return "jmp\t%A0";
14987
  else
14988
    return "call\t%A0";
14989
}
14981
}
14990
  [(set_attr "type" "call")])
14982
  [(set_attr "type" "call")])
14991
14983
14984
(define_insn "*sibcall_pop_1"
14985
  [(call (mem:QI (match_operand:SI 0 "sibcall_insn_operand" "s,U"))
14986
	 (match_operand:SI 1 "" ""))
14987
   (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
14988
			    (match_operand:SI 2 "immediate_operand" "i,i")))]
14989
  "SIBLING_CALL_P (insn) && !TARGET_64BIT"
14990
  "@
14991
   jmp\t%P0
14992
   jmp\t%A0"
14993
  [(set_attr "type" "call")])
14994
14992
(define_expand "call"
14995
(define_expand "call"
14993
  [(call (match_operand:QI 0 "" "")
14996
  [(call (match_operand:QI 0 "" "")
14994
	 (match_operand 1 "" ""))
14997
	 (match_operand 1 "" ""))
Lines 21469-21490 Link Here
21469
	      (match_operand:SI 2 "" "")))
21472
	      (match_operand:SI 2 "" "")))
21470
   (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
21473
   (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
21471
			    (match_operand:SI 3 "immediate_operand" "i")))]
21474
			    (match_operand:SI 3 "immediate_operand" "i")))]
21472
  "!TARGET_64BIT"
21475
  "!SIBLING_CALL_P (insn) && !TARGET_64BIT"
21473
{
21476
{
21474
  if (constant_call_address_operand (operands[1], Pmode))
21477
  if (constant_call_address_operand (operands[1], Pmode))
21475
    {
21478
    return "call\t%P1";
21476
      if (SIBLING_CALL_P (insn))
21479
  return "call\t%A1";
21477
	return "jmp\t%P1";
21478
      else
21479
	return "call\t%P1";
21480
    }
21481
  if (SIBLING_CALL_P (insn))
21482
    return "jmp\t%A1";
21483
  else
21484
    return "call\t%A1";
21485
}
21480
}
21486
  [(set_attr "type" "callv")])
21481
  [(set_attr "type" "callv")])
21487
21482
21483
(define_insn "*sibcall_value_pop_1"
21484
  [(set (match_operand 0 "" "")
21485
	(call (mem:QI (match_operand:SI 1 "call_insn_operand" "s,U"))
21486
	      (match_operand:SI 2 "" "")))
21487
   (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
21488
			    (match_operand:SI 3 "immediate_operand" "i,i")))]
21489
  "SIBLING_CALL_P (insn) && !TARGET_64BIT"
21490
  "@
21491
   jmp\t%P1
21492
   jmp\t%A1"
21493
  [(set_attr "type" "callv")])
21494
21488
(define_insn "*call_value_0"
21495
(define_insn "*call_value_0"
21489
  [(set (match_operand 0 "" "")
21496
  [(set (match_operand 0 "" "")
21490
	(call (mem:QI (match_operand:SI 1 "constant_call_address_operand" ""))
21497
	(call (mem:QI (match_operand:SI 1 "constant_call_address_operand" ""))

Return to bug 282189