aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2023-12-21 13:50:26 +0100
committerUros Bizjak <ubizjak@gmail.com>2023-12-21 15:58:03 +0100
commit2766b83759a02572b7b303aae3d4b54a351f8f96 (patch)
treeeaba45a560e84bb4cd964454598bb38187e59124 /gcc
parentbe977db17c91ad6627dee70a1904a95d229aa1be (diff)
downloadgcc-2766b83759a02572b7b303aae3d4b54a351f8f96.zip
gcc-2766b83759a02572b7b303aae3d4b54a351f8f96.tar.gz
gcc-2766b83759a02572b7b303aae3d4b54a351f8f96.tar.bz2
i386: Fix shifts with high register input operand [PR113044]
The move to the output operand should use high register input operand. PR target/113044 gcc/ChangeLog: * config/i386/i386.md (*ashlqi_ext<mode>_1): Move from the high register of the input operand. (*<insn>qi_ext<mode>_1): Ditto. gcc/testsuite/ChangeLog: * gcc.target/i386/pr113044.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/i386/i386.md6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr113044.c24
2 files changed, 28 insertions, 2 deletions
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 710068e..4c6368b 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -15527,7 +15527,8 @@
&& !(rtx_equal_p (operands[0], operands[1]))"
[(set (zero_extract:SWI248
(match_dup 0) (const_int 8) (const_int 8))
- (match_dup 1))
+ (zero_extract:SWI248
+ (match_dup 1) (const_int 8) (const_int 8)))
(parallel
[(set (zero_extract:SWI248
(match_dup 0) (const_int 8) (const_int 8))
@@ -16689,7 +16690,8 @@
&& !(rtx_equal_p (operands[0], operands[1]))"
[(set (zero_extract:SWI248
(match_dup 0) (const_int 8) (const_int 8))
- (match_dup 1))
+ (zero_extract:SWI248
+ (match_dup 1) (const_int 8) (const_int 8)))
(parallel
[(set (zero_extract:SWI248
(match_dup 0) (const_int 8) (const_int 8))
diff --git a/gcc/testsuite/gcc.target/i386/pr113044.c b/gcc/testsuite/gcc.target/i386/pr113044.c
new file mode 100644
index 0000000..923e7f4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr113044.c
@@ -0,0 +1,24 @@
+/* PR target/113044 */
+/* { dg-do run } */
+/* { dg-options "-O" } */
+
+typedef unsigned char __attribute__((__vector_size__ (2))) V;
+
+V
+foo (char c, V v)
+{
+ V x = v >> (v & 8);
+ volatile char d = c;
+ if (!d)
+ __builtin_abort();
+ return x;
+}
+
+int
+main (void)
+{
+ V x = foo (10, (V){3});
+ if (x[0] != 3 || x[1])
+ __builtin_abort();
+ return 0;
+}