diff options
author | Jakub Jelinek <jakub@redhat.com> | 2020-01-03 11:11:17 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2020-01-03 11:11:17 +0100 |
commit | 5499c8628ac3ab7baa673013c7dacd4a03fbb0d6 (patch) | |
tree | 87201badb622546ec083b51e181d286014777b65 /gcc | |
parent | 5a6e28b5bae7a236b35994d0f64fd902a574872c (diff) | |
download | gcc-5499c8628ac3ab7baa673013c7dacd4a03fbb0d6.zip gcc-5499c8628ac3ab7baa673013c7dacd4a03fbb0d6.tar.gz gcc-5499c8628ac3ab7baa673013c7dacd4a03fbb0d6.tar.bz2 |
re PR target/93110 (grub-2.04/grub-core/lib/division.c:28:1: internal compiler error: in extract_insn, at recog.c:2294)
PR target/93110
* config/i386/i386.md (abs<mode>2): Use expand_simple_binop instead of
emitting ASHIFTRT, XOR and MINUS by hand. Use gen_int_mode with QImode
instead of gen_int_shift_amount + convert_modes.
* gcc.dg/torture/pr93110.c: New test.
From-SVN: r279855
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/i386/i386.md | 34 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr93110.c | 9 |
4 files changed, 27 insertions, 24 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce5cb00..9728bf6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2020-01-03 Jakub Jelinek <jakub@redhat.com> + PR target/93110 + * config/i386/i386.md (abs<mode>2): Use expand_simple_binop instead of + emitting ASHIFTRT, XOR and MINUS by hand. Use gen_int_mode with QImode + instead of gen_int_shift_amount + convert_modes. + PR rtl-optimization/93088 * loop-iv.c (find_single_def_src): Punt after looking through 128 reg copies for regs with single definitions. Move definitions diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 4d55643..01c7d65 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -9711,30 +9711,16 @@ /* Generate rtx abs using abs (x) = (((signed) x >> (W-1)) ^ x) - ((signed) x >> (W-1)) */ - rtx shift_amount = gen_int_shift_amount (mode, - GET_MODE_PRECISION (mode) - - 1); - shift_amount = convert_modes (E_QImode, GET_MODE (shift_amount), - shift_amount, 1); - rtx shift_dst = gen_reg_rtx (mode); - rtx shift_op = gen_rtx_SET (shift_dst, - gen_rtx_fmt_ee (ASHIFTRT, mode, - operands[1], shift_amount)); - rtx clobber = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, - FLAGS_REG)); - emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, shift_op, - clobber))); - - rtx xor_op = gen_rtx_SET (operands[0], - gen_rtx_fmt_ee (XOR, mode, shift_dst, - operands[1])); - emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, xor_op, clobber))); - - rtx minus_op = gen_rtx_SET (operands[0], - gen_rtx_fmt_ee (MINUS, mode, - operands[0], shift_dst)); - emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, minus_op, - clobber))); + rtx shift_amount = gen_int_mode (GET_MODE_PRECISION (mode) - 1, QImode); + rtx shift_dst = expand_simple_binop (mode, ASHIFTRT, operands[1], + shift_amount, NULL_RTX, + 0, OPTAB_DIRECT); + rtx xor_dst = expand_simple_binop (mode, XOR, shift_dst, operands[1], + operands[0], 0, OPTAB_DIRECT); + rtx minus_dst = expand_simple_binop (mode, MINUS, xor_dst, shift_dst, + operands[0], 0, OPTAB_DIRECT); + if (!rtx_equal_p (minus_dst, operands[0])) + emit_move_insn (operands[0], minus_dst); DONE; }) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7be1d90..2cad411 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2020-01-03 Jakub Jelinek <jakub@redhat.com> + PR target/93110 + * gcc.dg/torture/pr93110.c: New test. + PR rtl-optimization/93088 * gcc.target/i386/pr93088.c: New test. diff --git a/gcc/testsuite/gcc.dg/torture/pr93110.c b/gcc/testsuite/gcc.dg/torture/pr93110.c new file mode 100644 index 0000000..c123f5f --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr93110.c @@ -0,0 +1,9 @@ +/* PR target/93110 */ +/* { dg-do compile } */ +/* { dg-additional-options "-mtune=core2 -mno-stv" { target { i?86-*-* x86_64-*-* } } } */ + +long long +foo (long long a) +{ + return a > 0 ? a : -a; +} |