Skip to content

Commit

Permalink
[X86] Remove isel patterns that matched vXi16 X86VBroadcast with i8->…
Browse files Browse the repository at this point in the history
…i16 aextload input.

This was selecting VBROADCASTW which turned the 8-bit load into
a 16-bit load if it happened to be 2 byte aligned.

I have a plan to fix the regression with a follow up patch
which I'll post shortly.
  • Loading branch information
topperc committed Mar 9, 2020
1 parent fc3c80c commit 07d68c2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
10 changes: 0 additions & 10 deletions llvm/lib/Target/X86/X86InstrAVX512.td
Expand Up @@ -1442,12 +1442,6 @@ let Predicates = [HasVLX, HasBWI] in {
def : Pat<(v16i16 (X86VBroadcast
(i16 (trunc (i32 (zextloadi16 addr:$src)))))),
(VPBROADCASTWZ256rm addr:$src)>;

// FIXME this is to handle aligned extloads from i8.
def : Pat<(v8i16 (X86VBroadcast (loadi16 addr:$src))),
(VPBROADCASTWZ128rm addr:$src)>;
def : Pat<(v16i16 (X86VBroadcast (loadi16 addr:$src))),
(VPBROADCASTWZ256rm addr:$src)>;
}
let Predicates = [HasBWI] in {
// loadi16 is tricky to fold, because !isTypeDesirableForOp, justifiably.
Expand All @@ -1460,10 +1454,6 @@ let Predicates = [HasBWI] in {
def : Pat<(v32i16 (X86VBroadcast
(i16 (trunc (i32 (zextloadi16 addr:$src)))))),
(VPBROADCASTWZrm addr:$src)>;

// FIXME this is to handle aligned extloads from i8.
def : Pat<(v32i16 (X86VBroadcast (loadi16 addr:$src))),
(VPBROADCASTWZrm addr:$src)>;
}

//===----------------------------------------------------------------------===//
Expand Down
6 changes: 0 additions & 6 deletions llvm/lib/Target/X86/X86InstrSSE.td
Expand Up @@ -7533,12 +7533,6 @@ let Predicates = [HasAVX2, NoVLX_Or_NoBWI] in {
def : Pat<(v16i16 (X86VBroadcast
(i16 (trunc (i32 (zextloadi16 addr:$src)))))),
(VPBROADCASTWYrm addr:$src)>;

// FIXME this is to handle aligned extloads from i8.
def : Pat<(v8i16 (X86VBroadcast (loadi16 addr:$src))),
(VPBROADCASTWrm addr:$src)>;
def : Pat<(v16i16 (X86VBroadcast (loadi16 addr:$src))),
(VPBROADCASTWYrm addr:$src)>;
}

let Predicates = [HasAVX2, NoVLX] in {
Expand Down
4 changes: 3 additions & 1 deletion llvm/test/CodeGen/X86/vector-sext.ll
Expand Up @@ -2039,7 +2039,9 @@ define <8 x i16> @load_sext_8i1_to_8i16(<8 x i1> *%ptr) {
;
; AVX2-LABEL: load_sext_8i1_to_8i16:
; AVX2: # %bb.0: # %entry
; AVX2-NEXT: vpbroadcastw (%rdi), %xmm0
; AVX2-NEXT: movzwl (%rdi), %eax
; AVX2-NEXT: vmovd %eax, %xmm0
; AVX2-NEXT: vpbroadcastw %xmm0, %xmm0
; AVX2-NEXT: vmovdqa {{.*#+}} xmm1 = [1,2,4,8,16,32,64,128]
; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
; AVX2-NEXT: vpcmpeqw %xmm1, %xmm0, %xmm0
Expand Down

0 comments on commit 07d68c2

Please sign in to comment.