aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2018-11-14 09:36:19 -0700
committerJeff Law <law@gcc.gnu.org>2018-11-14 09:36:19 -0700
commitc933b893537f9d73a73ea70c551bdfca363ff5d8 (patch)
tree8345e33d0bb50e0a0ea7a6855708b64db6725a22 /gcc
parentff361cc65f8e90aa77884c93d77e592cc470d6b7 (diff)
downloadgcc-c933b893537f9d73a73ea70c551bdfca363ff5d8.zip
gcc-c933b893537f9d73a73ea70c551bdfca363ff5d8.tar.gz
gcc-c933b893537f9d73a73ea70c551bdfca363ff5d8.tar.bz2
optabs.c (expand_binop): Pass INT_MODE to operand_subword_force iff the operand is a constant.
* optabs.c (expand_binop): Pass INT_MODE to operand_subword_force iff the operand is a constant. * gcc.c-torture/compile/20181114.c: New test. 2018-11-14 Ilya Leoshkevich <iii@linux.ibm.com> From-SVN: r266151
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/optabs.c6
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20181114-1.c6
4 files changed, 19 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3efd96b..be75c68 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-14 Jeff Law <law@redhat.com>
+
+ * optabs.c (expand_binop): Pass INT_MODE to operand_subword_force
+ iff the operand is a constant.
+
2018-11-14 Aldy Hernandez <aldyh@redhat.com>
* gimple-ssa-evrp-analyze.c
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 6052222..c7d1f22 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -1377,12 +1377,14 @@ expand_binop (machine_mode mode, optab binoptab, rtx op0, rtx op1,
start_sequence ();
/* Do the actual arithmetic. */
+ enum machine_mode op0_mode = CONSTANT_P (op0) ? int_mode : VOIDmode;
+ enum machine_mode op1_mode = CONSTANT_P (op1) ? int_mode : VOIDmode;
for (i = 0; i < GET_MODE_BITSIZE (int_mode) / BITS_PER_WORD; i++)
{
rtx target_piece = operand_subword (target, i, 1, int_mode);
rtx x = expand_binop (word_mode, binoptab,
- operand_subword_force (op0, i, int_mode),
- operand_subword_force (op1, i, int_mode),
+ operand_subword_force (op0, i, op0_mode),
+ operand_subword_force (op1, i, op1_mode),
target_piece, unsignedp, next_methods);
if (x == 0)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 50e53f0..cee3379 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2018-11-14 Jeff Law <law@redhat.com>
+
+ * gcc.c-torture/compile/20181114.c: New test.
+
2018-11-14 Richard Biener <rguenther@suse.de>
PR middle-end/87985
diff --git a/gcc/testsuite/gcc.c-torture/compile/20181114-1.c b/gcc/testsuite/gcc.c-torture/compile/20181114-1.c
new file mode 100644
index 0000000..9bcc399
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20181114-1.c
@@ -0,0 +1,6 @@
+int
+_vfprintf_r (double fp)
+{
+ if (__builtin_signbit (fp))
+ return '-';
+}