diff options
author | Richard Sandiford <rsandifo@redhat.com> | 2002-11-20 09:59:28 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2002-11-20 09:59:28 +0000 |
commit | 4392ebd361621bdc3f5a2426df102c2da3e25a53 (patch) | |
tree | 7be5e549048a9e9ba6831c5dc806ac37a8c5567a | |
parent | 3748bd9e22eafbd213c7d268d0a00b8b35faf743 (diff) | |
download | gcc-4392ebd361621bdc3f5a2426df102c2da3e25a53.zip gcc-4392ebd361621bdc3f5a2426df102c2da3e25a53.tar.gz gcc-4392ebd361621bdc3f5a2426df102c2da3e25a53.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/sh/sh.md | 26 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/20021120-2.c | 21 |
4 files changed, 41 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e3ddb43..414a947 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2002-11-20 Richard Sandiford <rsandifo@redhat.com> + * 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 <rsandifo@redhat.com> + * global.c (find_reg): Check HARD_REGNO_NREGS before kicking out another register. diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index ed14fbd..956c225 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 1ba905f..01d9f41 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2002-11-20 Richard Sandiford <rsandifo@redhat.com> + * gcc.c-torture/execute/20021120-2.c: New test. + +2002-11-20 Richard Sandiford <rsandifo@redhat.com> + * gcc.c-torture/execute/20021120-1.c: New test. 2002-11-20 Jakub Jelinek <jakub@redhat.com> 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 0000000..d8876c0eb --- /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); +} |