summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2017-11-03 09:24:28 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2017-11-03 09:24:28 +0000
commit90b79395dd0f97e314157f0092722bac1df1ec0c (patch)
tree709552d36c9010d5bdb45960cf0a95762cf90c40
parente68c23ab2632f524af2cd63f949c6514e510218b (diff)
downloadgcc-90b79395dd0f97e314157f0092722bac1df1ec0c.tar.gz
PR82809: register handling in ix86_vector_duplicate_value
When adding the call to gen_vec_duplicate, I failed to notice that code further down modified the VEC_DUPLICATE in place. That isn't safe if gen_vec_duplicate returned a const_vector. 2017-11-02 Richard Sandiford <richard.sandiford@linaro.org> gcc/ PR target/82809 * config/i386/i386.c (ix86_vector_duplicate_value): Use gen_vec_duplicate after forcing the scalar into a register. gcc/testsuite/ * gcc.dg/pr82809.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254366 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/i386/i386.c2
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/pr82809.c22
4 files changed, 33 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7502184f7db..d49923f37a3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-03 Richard Sandiford <richard.sandiford@linaro.org>
+
+ PR target/82809
+ * config/i386/i386.c (ix86_vector_duplicate_value): Use
+ gen_vec_duplicate after forcing the scalar into a register.
+
2017-11-02 Segher Boessenkool <segher@kernel.crashing.org>
* combine (try_combine): Print the insns input to try_combine to the
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 29678722226..1cf1e2b27a6 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -41232,7 +41232,7 @@ ix86_vector_duplicate_value (machine_mode mode, rtx target, rtx val)
reg = force_reg (innermode, val);
if (GET_MODE (reg) != innermode)
reg = gen_lowpart (innermode, reg);
- XEXP (dup, 0) = reg;
+ SET_SRC (PATTERN (insn)) = gen_vec_duplicate (mode, reg);
seq = get_insns ();
end_sequence ();
if (seq)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6e2abdd9e17..8159009a85a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2017-11-03 Richard Sandiford <richard.sandiford@linaro.org>
+
+ * gcc.dg/pr82809.c: New test.
+
2017-11-02 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/81957
diff --git a/gcc/testsuite/gcc.dg/pr82809.c b/gcc/testsuite/gcc.dg/pr82809.c
new file mode 100644
index 00000000000..9f74ee86534
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr82809.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast -fno-tree-dominator-opts" } */
+
+struct locale_time_t
+{
+ const char *abday[7];
+ const unsigned int *wabday[7];
+};
+
+static const unsigned int empty_wstr[1] = { 0 };
+
+void
+time_read (struct locale_time_t *time)
+{
+ int cnt;
+
+ for (cnt=0; cnt < 7; cnt++)
+ {
+ time->abday[cnt] = "";
+ time->wabday[cnt] = empty_wstr;
+ }
+}