Skip to content

Commit 1d6044c

Browse files
committed
i386: Fix VPMOV splitter [PR105993]
REGNO should not be used with register_operand before reload because subregs of registers or even subregs of memory match the predicate. The build with RTL checking enabled does not tolerate REGNO with non-reg operand. The patch splits the splitter into two related splitters and uses (match_dup ...) RTXes instead of REGNO comparisons. 2022-06-17 Uroš Bizjak <[email protected]> gcc/ChangeLog: PR target/105993 * config/i386/sse.md (vpmov splitter): Use (match_dup ...) instead of REGNO comparisons in combine splitter. gcc/testsuite/ChangeLog: PR target/105993 * gcc.target/i386/pr105993.c: New test.
1 parent 06a1b04 commit 1d6044c

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed

gcc/config/i386/sse.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23875,21 +23875,23 @@
2387523875
(xor:V_128_256 (match_operand:V_128_256 1 "register_operand")
2387623876
(match_operand:V_128_256 2 "register_operand"))
2387723877
(match_operand:V_128_256 3 "nonimmediate_operand"))
23878-
(match_operand:V_128_256 4 "register_operand")))]
23879-
"TARGET_XOP
23880-
&& (REGNO (operands[4]) == REGNO (operands[1])
23881-
|| REGNO (operands[4]) == REGNO (operands[2]))"
23878+
(match_dup 1)))]
23879+
"TARGET_XOP"
2388223880
[(set (match_dup 0) (if_then_else:V_128_256 (match_dup 3)
23883-
(match_dup 5)
23884-
(match_dup 4)))]
23885-
{
23886-
/* To handle the commutivity of XOR, operands[4] is either operands[1]
23887-
or operands[2], we need operands[5] to be the other one. */
23888-
if (REGNO (operands[4]) == REGNO (operands[1]))
23889-
operands[5] = operands[2];
23890-
else
23891-
operands[5] = operands[1];
23892-
})
23881+
(match_dup 2)
23882+
(match_dup 1)))])
23883+
(define_split
23884+
[(set (match_operand:V_128_256 0 "register_operand")
23885+
(xor:V_128_256
23886+
(and:V_128_256
23887+
(xor:V_128_256 (match_operand:V_128_256 1 "register_operand")
23888+
(match_operand:V_128_256 2 "register_operand"))
23889+
(match_operand:V_128_256 3 "nonimmediate_operand"))
23890+
(match_dup 2)))]
23891+
"TARGET_XOP"
23892+
[(set (match_dup 0) (if_then_else:V_128_256 (match_dup 3)
23893+
(match_dup 1)
23894+
(match_dup 2)))])
2389323895

2389423896
;; XOP horizontal add/subtract instructions
2389523897
(define_insn "xop_phadd<u>bw"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* PR target/105993 */
2+
/* { dg-do compile } */
3+
/* { dg-options "-O -mxop" } */
4+
5+
typedef unsigned short __attribute__((__vector_size__ (16))) V;
6+
V x, y, z;
7+
8+
char c;
9+
short s;
10+
11+
V
12+
foo (void)
13+
{
14+
V u = __builtin_shufflevector (z, y, 2, 1, 0, 8, 4, 1, 7, 2);
15+
V v = ~(__builtin_bswap16 (s) & (u ^ c));
16+
17+
return v;
18+
}

0 commit comments

Comments
 (0)