Hello!
We have to prevent memory attribute calculation to access non-existent
operand[2] for rotate1 type insns in the same way as for ishift1 type
insns.
2018-04-05 Uros Bizjak <[email protected]>
PR target/85193
* config/i386/i386.md (define_attr "memory"): Handle rotate1 type.
testsuite/ChangeLog:
2018-04-05 Uros Bizjak <[email protected]>
PR target/85193
* gcc.target/i386/pr85193.c: New test.
Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
Committed to mainline, will be backported to release branches.
Uros.
Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md (revision 259082)
+++ config/i386/i386.md (working copy)
@@ -752,7 +752,7 @@
(if_then_else (match_operand 1 "constant_call_address_operand")
(const_string "none")
(const_string "load"))
- (and (eq_attr "type" "alu1,negnot,ishift1,sselog1,sseshuf1")
+ (and (eq_attr "type" "alu1,negnot,ishift1,rotate1,sselog1,sseshuf1")
(match_operand 1 "memory_operand"))
(const_string "both")
(and (match_operand 0 "memory_operand")
@@ -763,7 +763,7 @@
(match_operand 1 "memory_operand")
(const_string "load")
(and (eq_attr "type"
- "!alu1,negnot,ishift1,
+ "!alu1,negnot,ishift1,rotate1,
imov,imovx,icmp,test,bitmanip,
fmov,fcmp,fsgn,
sse,ssemov,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,
Index: testsuite/gcc.target/i386/pr85193.c
===================================================================
--- testsuite/gcc.target/i386/pr85193.c (nonexistent)
+++ testsuite/gcc.target/i386/pr85193.c (working copy)
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-Wno-psabi -O2 -fno-tree-ccp -fno-tree-fre -mno-sse" } */
+
+typedef unsigned char U __attribute__((vector_size(16)));
+typedef unsigned int V __attribute__((vector_size(16)));
+typedef unsigned long long W __attribute__((vector_size(16)));
+
+extern void bar(U, U);
+
+V v;
+
+void
+foo(U f)
+{
+ f[0] = f[0] << (unsigned char)~v[0] | f[~((W)(U){0, 0, 0, 0, 0, 0, 0, 0,
5})[1] & 5] >> (-(unsigned char)~v[0] & 7);
+ bar(f, (U){});
+}