Skip to content

Commit 07dcb39

Browse files
committed
i386: Fix missed APX_NDD check for shift/rotate expanders [PR 112943]
The ashl/lshr/ashr expanders calls ix86_expand_binary_operator, while they will be called for some post-reload split, and TARGET_APX_NDD is required for these calls to avoid force-load to memory at postreload stage. gcc/ChangeLog: PR target/112943 * config/i386/i386.md (ashl<mode>3): Add TARGET_APX_NDD to ix86_expand_binary_operator call. (<insn><mode>3): Likewise for rshift. (<insn>di3): Likewise for DImode rotate. (<insn><mode>3): Likewise for SWI124 rotate. gcc/testsuite/ChangeLog: PR target/112943 * gcc.target/i386/pr112943.c: New test.
1 parent 2900a77 commit 07dcb39

File tree

2 files changed

+71
-4
lines changed

2 files changed

+71
-4
lines changed

gcc/config/i386/i386.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14308,7 +14308,8 @@
1430814308
(ashift:SDWIM (match_operand:SDWIM 1 "<ashl_input_operand>")
1430914309
(match_operand:QI 2 "nonmemory_operand")))]
1431014310
""
14311-
"ix86_expand_binary_operator (ASHIFT, <MODE>mode, operands); DONE;")
14311+
"ix86_expand_binary_operator (ASHIFT, <MODE>mode, operands,
14312+
TARGET_APX_NDD); DONE;")
1431214313

1431314314
(define_insn_and_split "*ashl<dwi>3_doubleword_mask"
1431414315
[(set (match_operand:<DWI> 0 "register_operand")
@@ -15564,7 +15565,8 @@
1556415565
(any_shiftrt:SDWIM (match_operand:SDWIM 1 "<shift_operand>")
1556515566
(match_operand:QI 2 "nonmemory_operand")))]
1556615567
""
15567-
"ix86_expand_binary_operator (<CODE>, <MODE>mode, operands); DONE;")
15568+
"ix86_expand_binary_operator (<CODE>, <MODE>mode, operands,
15569+
TARGET_APX_NDD); DONE;")
1556815570

1556915571
;; Avoid useless masking of count operand.
1557015572
(define_insn_and_split "*<insn><mode>3_mask"
@@ -16791,7 +16793,8 @@
1679116793
""
1679216794
{
1679316795
if (TARGET_64BIT)
16794-
ix86_expand_binary_operator (<CODE>, DImode, operands);
16796+
ix86_expand_binary_operator (<CODE>, DImode, operands,
16797+
TARGET_APX_NDD);
1679516798
else if (const_1_to_31_operand (operands[2], VOIDmode))
1679616799
emit_insn (gen_ix86_<insn>di3_doubleword
1679716800
(operands[0], operands[1], operands[2]));
@@ -16811,7 +16814,8 @@
1681116814
(any_rotate:SWIM124 (match_operand:SWIM124 1 "nonimmediate_operand")
1681216815
(match_operand:QI 2 "nonmemory_operand")))]
1681316816
""
16814-
"ix86_expand_binary_operator (<CODE>, <MODE>mode, operands); DONE;")
16817+
"ix86_expand_binary_operator (<CODE>, <MODE>mode, operands,
16818+
TARGET_APX_NDD); DONE;")
1681516819

1681616820
;; Avoid useless masking of count operand.
1681716821
(define_insn_and_split "*<insn><mode>3_mask"
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/* PR target/112943 */
2+
/* { dg-do compile { target { ! ia32 } } } */
3+
/* { dg-options "-O2 -march=westmere -mapxf" } */
4+
5+
typedef unsigned char __attribute__((__vector_size__(1))) v8u8;
6+
typedef char __attribute__((__vector_size__(2))) v16u8;
7+
typedef char __attribute__((__vector_size__(4))) v32u8;
8+
typedef char __attribute__((__vector_size__(8))) v64u8;
9+
typedef char __attribute__((__vector_size__(16))) v128u8;
10+
typedef _Float16 __attribute__((__vector_size__(2))) v16f16;
11+
typedef _Float16 __attribute__((__vector_size__(16))) v128f16;
12+
typedef _Float64x __attribute__((__vector_size__(16))) v128f128;
13+
typedef _Decimal64 d64;
14+
char foo0_u8_0;
15+
v8u8 foo0_v8u8_0;
16+
__attribute__((__vector_size__(sizeof(char)))) char foo0_v8s8_0;
17+
__attribute__((__vector_size__(sizeof(long)))) unsigned long v64u64_0;
18+
_Float16 foo0_f16_0;
19+
v128f16 foo0_v128f16_0;
20+
double foo0_f64_0;
21+
int foo0_f128_0, foo0_v32d32_0, foo0__0;
22+
d64 foo0_d64_0;
23+
v8u8 *foo0_ret;
24+
unsigned __int128 foo0_u128_3;
25+
v8u8 d;
26+
void foo0() {
27+
v64u64_0 -= foo0_u8_0;
28+
v8u8 v8u8_1 = foo0_v8u8_0 % d;
29+
v128f128 v128f128_1 = __builtin_convertvector(v64u64_0, v128f128);
30+
__int128 u128_2 = ((9223372036854775807 + (__int128) 1) << 4) * foo0_u8_0,
31+
u128_r = u128_2 + foo0_u128_3 + foo0_f128_0 + (__int128)foo0_d64_0;
32+
v16f16 v16f16_1 = __builtin_convertvector(foo0_v8s8_0, v16f16);
33+
v128f16 v128f16_1 = 0 > foo0_v128f16_0;
34+
v128u8 v128u8_r = (v128u8)v128f16_1 + (v128u8)v128f128_1;
35+
v64u8 v64u8_r = ((union {
36+
v128u8 a;
37+
v64u8 b;
38+
})v128u8_r)
39+
.b +
40+
(v64u8)v64u64_0;
41+
v32u8 v32u8_r = ((union {
42+
v64u8 a;
43+
v32u8 b;
44+
})v64u8_r)
45+
.b +
46+
(v32u8)foo0_v32d32_0;
47+
v16u8 v16u8_r = ((union {
48+
v32u8 a;
49+
v16u8 b;
50+
})v32u8_r)
51+
.b +
52+
(v16u8)v16f16_1;
53+
v8u8 v8u8_r = ((union {
54+
v16u8 a;
55+
v8u8 b;
56+
})v16u8_r)
57+
.b +
58+
foo0_v8u8_0 + v8u8_1 + foo0_v8s8_0;
59+
long u64_r = u128_r + foo0_f64_0 + (unsigned long)foo0__0;
60+
short u16_r = u64_r + foo0_f16_0;
61+
char u8_r = u16_r + foo0_u8_0;
62+
*foo0_ret = v8u8_r + u8_r;
63+
}

0 commit comments

Comments
 (0)