aboutsummaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-08-31 09:49:12 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2018-08-31 09:49:12 +0200
commit8e7dfe7144a4bca1db98be1aa7e637edb3c3e42f (patch)
treefaa700061e1cd3148b49a828297a03a0624b9943 /gcc/expmed.c
parent4e227341f6e6c3ceef721d3839c8d9eb6292db70 (diff)
downloadgcc-8e7dfe7144a4bca1db98be1aa7e637edb3c3e42f.zip
gcc-8e7dfe7144a4bca1db98be1aa7e637edb3c3e42f.tar.gz
gcc-8e7dfe7144a4bca1db98be1aa7e637edb3c3e42f.tar.bz2
re PR middle-end/87138 (wrong code with TI multiplication with -O -march=k8 -fno-tree-fre -mavx512bw)
PR middle-end/87138 * expmed.c (expand_mult_const): Use immed_wide_int_const instead of gen_int_mode. Formatting fixes. * gcc.target/i386/avx512bw-pr87138.c: New test. From-SVN: r264009
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index caf29e8..29ce10b 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -3347,19 +3347,21 @@ expand_mult_const (machine_mode mode, rtx op0, HOST_WIDE_INT val,
/* Write a REG_EQUAL note on the last insn so that we can cse
multiplication sequences. Note that if ACCUM is a SUBREG,
we've set the inner register and must properly indicate that. */
- tem = op0, nmode = mode;
- accum_inner = accum;
- if (GET_CODE (accum) == SUBREG)
+ tem = op0, nmode = mode;
+ accum_inner = accum;
+ if (GET_CODE (accum) == SUBREG)
{
accum_inner = SUBREG_REG (accum);
nmode = GET_MODE (accum_inner);
tem = gen_lowpart (nmode, op0);
}
- insn = get_last_insn ();
- set_dst_reg_note (insn, REG_EQUAL,
- gen_rtx_MULT (nmode, tem,
- gen_int_mode (val_so_far, nmode)),
+ insn = get_last_insn ();
+ wide_int wval_so_far
+ = wi::uhwi (val_so_far,
+ GET_MODE_PRECISION (as_a <scalar_mode> (nmode)));
+ rtx c = immed_wide_int_const (wval_so_far, nmode);
+ set_dst_reg_note (insn, REG_EQUAL, gen_rtx_MULT (nmode, tem, c),
accum_inner);
}
}