From 4392ebd361621bdc3f5a2426df102c2da3e25a53 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 20 Nov 2002 09:59:28 +0000 Subject: [PATCH] sh.md (udivsi3): Don't put udivsi3_i4_media instructions into a libcall block. * config/sh/sh.md (udivsi3): Don't put udivsi3_i4_media instructions into a libcall block. (divsi3): Likewise divsi3_i4_media. From-SVN: r59299 --- gcc/ChangeLog | 6 +++++ gcc/config/sh/sh.md | 26 +++++++------------ gcc/testsuite/ChangeLog | 4 +++ .../gcc.c-torture/execute/20021120-2.c | 21 +++++++++++++++ 4 files changed, 41 insertions(+), 16 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021120-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e3ddb43bf83..414a9475858 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-11-20 Richard Sandiford + + * config/sh/sh.md (udivsi3): Don't put udivsi3_i4_media instructions + into a libcall block. + (divsi3): Likewise divsi3_i4_media. + 2002-11-20 Richard Sandiford * global.c (find_reg): Check HARD_REGNO_NREGS before kicking diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index ed14fbd4e33..956c2253b9b 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -1341,7 +1341,7 @@ "" " { - rtx first = 0, last; + rtx first, last; operands[3] = gen_reg_rtx (Pmode); /* Emit the move of the address to a pseudo outside of the libcall. */ @@ -1358,8 +1358,8 @@ { operands[1] = force_reg (SImode, operands[1]); operands[2] = force_reg (SImode, operands[2]); - last = gen_udivsi3_i4_media (operands[0], operands[1], operands[2]); - first = last; + emit_insn (gen_udivsi3_i4_media (operands[0], operands[1], operands[2])); + DONE; } else if (TARGET_SH5) { @@ -1386,11 +1386,8 @@ gen_rtx_SYMBOL_REF (SImode, \"__udivsi3\")); last = gen_udivsi3_i1 (operands[0], operands[3]); } - if (! first) - { - first = emit_move_insn (gen_rtx_REG (SImode, 4), operands[1]); - emit_move_insn (gen_rtx_REG (SImode, 5), operands[2]); - } + first = emit_move_insn (gen_rtx_REG (SImode, 4), operands[1]); + emit_move_insn (gen_rtx_REG (SImode, 5), operands[2]); last = emit_insn (last); /* Wrap the sequence in REG_LIBCALL / REG_RETVAL notes so that loop invariant code motion can move it. */ @@ -1494,7 +1491,7 @@ "" " { - rtx first = 0, last; + rtx first, last; operands[3] = gen_reg_rtx (Pmode); /* Emit the move of the address to a pseudo outside of the libcall. */ @@ -1511,8 +1508,8 @@ { operands[1] = force_reg (SImode, operands[1]); operands[2] = force_reg (SImode, operands[2]); - last = gen_divsi3_i4_media (operands[0], operands[1], operands[2]); - first = last; + emit_insn (gen_divsi3_i4_media (operands[0], operands[1], operands[2])); + DONE; } else if (TARGET_SH5) { @@ -1538,11 +1535,8 @@ emit_move_insn (operands[3], gen_rtx_SYMBOL_REF (SImode, \"__sdivsi3\")); last = gen_divsi3_i1 (operands[0], operands[3]); } - if (! first) - { - first = emit_move_insn (gen_rtx_REG (SImode, 4), operands[1]); - emit_move_insn (gen_rtx_REG (SImode, 5), operands[2]); - } + first = emit_move_insn (gen_rtx_REG (SImode, 4), operands[1]); + emit_move_insn (gen_rtx_REG (SImode, 5), operands[2]); last = emit_insn (last); /* Wrap the sequence in REG_LIBCALL / REG_RETVAL notes so that loop invariant code motion can move it. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1ba905f524a..01d9f4148ad 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-11-20 Richard Sandiford + + * gcc.c-torture/execute/20021120-2.c: New test. + 2002-11-20 Richard Sandiford * gcc.c-torture/execute/20021120-1.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/execute/20021120-2.c b/gcc/testsuite/gcc.c-torture/execute/20021120-2.c new file mode 100644 index 00000000000..d8876c0ebfa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021120-2.c @@ -0,0 +1,21 @@ +int g1, g2; + +void foo (int x) +{ + int y; + + if (x) + y = 793; + else + y = 793; + g1 = 7930 / y; + g2 = 7930 / x; +} + +int main () +{ + foo (793); + if (g1 != 10 || g2 != 10) + abort (); + exit (0); +} -- 2.30.2