Index: lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp =================================================================== --- lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp +++ lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp @@ -3835,7 +3835,7 @@ } LdOps.push_back(L); - + LdOp = L; LdWidth -= NewVTWidth; } Index: test/CodeGen/X86/pr34653-pr34657.ll =================================================================== --- /dev/null +++ test/CodeGen/X86/pr34653-pr34657.ll @@ -0,0 +1,258 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc %s -O0 -mtriple=x86_64-unknown-unknown -mattr=+avx512f | FileCheck %s -check-prefix=CHECKO0 +; RUN: llc %s -O2 -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512bw | FileCheck %s -check-prefix=CHECKO2 + +declare fastcc <38 x double> @test() + +define void @pr34653() { +; CHECKO0-LABEL: pr34653: +; CHECKO0: # BB#0: # %entry +; CHECKO0-NEXT: pushq %rbp +; CHECKO0-NEXT: .cfi_def_cfa_offset 16 +; CHECKO0-NEXT: .cfi_offset %rbp, -16 +; CHECKO0-NEXT: movq %rsp, %rbp +; CHECKO0-NEXT: .cfi_def_cfa_register %rbp +; CHECKO0-NEXT: andq $-512, %rsp # imm = 0xFE00 +; CHECKO0-NEXT: subq $2048, %rsp # imm = 0x800 +; CHECKO0-NEXT: leaq {{[0-9]+}}(%rsp), %rdi +; CHECKO0-NEXT: callq test +; CHECKO0-NEXT: vmovupd {{[0-9]+}}(%rsp), %xmm0 +; CHECKO0-NEXT: vmovaps %xmm0, %xmm1 +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm0 = xmm0[1,0] +; CHECKO0-NEXT: vmovupd {{[0-9]+}}(%rsp), %ymm2 +; CHECKO0-NEXT: vextractf128 $1, %ymm2, %xmm3 +; CHECKO0-NEXT: vmovaps %xmm3, %xmm4 +; CHECKO0-NEXT: vmovaps %xmm2, %xmm5 +; CHECKO0-NEXT: vmovaps %xmm5, %xmm6 +; CHECKO0-NEXT: vmovupd {{[0-9]+}}(%rsp), %zmm7 +; CHECKO0-NEXT: vmovupd {{[0-9]+}}(%rsp), %zmm8 +; CHECKO0-NEXT: vmovupd {{[0-9]+}}(%rsp), %zmm9 +; CHECKO0-NEXT: vmovupd {{[0-9]+}}(%rsp), %zmm10 +; CHECKO0-NEXT: vextractf32x4 $3, %zmm10, %xmm11 +; CHECKO0-NEXT: vmovaps %xmm11, %xmm12 +; CHECKO0-NEXT: vextractf32x4 $2, %zmm10, %xmm13 +; CHECKO0-NEXT: vmovaps %xmm13, %xmm14 +; CHECKO0-NEXT: vmovaps %xmm10, %xmm15 +; CHECKO0-NEXT: vmovaps %xmm15, %xmm2 +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vextractf32x4 $3, %zmm9, %xmm0 +; CHECKO0-NEXT: vmovaps %xmm0, {{[0-9]+}}(%rsp) # 16-byte Spill +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vextractf32x4 $2, %zmm9, %xmm0 +; CHECKO0-NEXT: vmovaps %xmm0, {{[0-9]+}}(%rsp) # 16-byte Spill +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovaps %xmm9, %xmm0 +; CHECKO0-NEXT: vmovaps %xmm0, {{[0-9]+}}(%rsp) # 16-byte Spill +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vextractf32x4 $3, %zmm8, %xmm0 +; CHECKO0-NEXT: vmovaps %xmm0, {{[0-9]+}}(%rsp) # 16-byte Spill +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vextractf32x4 $2, %zmm8, %xmm0 +; CHECKO0-NEXT: vmovaps %xmm0, {{[0-9]+}}(%rsp) # 16-byte Spill +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovaps %xmm8, %xmm0 +; CHECKO0-NEXT: vmovaps %xmm0, {{[0-9]+}}(%rsp) # 16-byte Spill +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vextractf32x4 $3, %zmm7, %xmm0 +; CHECKO0-NEXT: vmovaps %xmm0, {{[0-9]+}}(%rsp) # 16-byte Spill +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vextractf32x4 $2, %zmm7, %xmm0 +; CHECKO0-NEXT: vmovaps %xmm0, {{[0-9]+}}(%rsp) # 16-byte Spill +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovaps %xmm7, %xmm0 +; CHECKO0-NEXT: vmovaps %xmm0, {{[0-9]+}}(%rsp) # 16-byte Spill +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm3 = xmm3[1,0] +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm5 = xmm5[1,0] +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm11 = xmm11[1,0] +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm13 = xmm13[1,0] +; CHECKO0-NEXT: # kill: %YMM10 %YMM10 %ZMM10 +; CHECKO0-NEXT: vextractf128 $1, %ymm10, %xmm10 +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovaps %xmm10, %xmm0 +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm15 = xmm15[1,0] +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovaps {{[0-9]+}}(%rsp), %xmm0 # 16-byte Reload +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm0 = xmm0[1,0] +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovaps {{[0-9]+}}(%rsp), %xmm0 # 16-byte Reload +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm0 = xmm0[1,0] +; CHECKO0-NEXT: # kill: %YMM9 %YMM9 %ZMM9 +; CHECKO0-NEXT: vextractf128 $1, %ymm9, %xmm9 +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovaps %xmm9, %xmm0 +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovaps {{[0-9]+}}(%rsp), %xmm0 # 16-byte Reload +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm0 = xmm0[1,0] +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovaps {{[0-9]+}}(%rsp), %xmm0 # 16-byte Reload +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm0 = xmm0[1,0] +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovaps {{[0-9]+}}(%rsp), %xmm0 # 16-byte Reload +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm0 = xmm0[1,0] +; CHECKO0-NEXT: # kill: %YMM8 %YMM8 %ZMM8 +; CHECKO0-NEXT: vextractf128 $1, %ymm8, %xmm8 +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovaps %xmm8, %xmm0 +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovaps {{[0-9]+}}(%rsp), %xmm0 # 16-byte Reload +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm0 = xmm0[1,0] +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovaps {{[0-9]+}}(%rsp), %xmm0 # 16-byte Reload +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm0 = xmm0[1,0] +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovaps {{[0-9]+}}(%rsp), %xmm0 # 16-byte Reload +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm0 = xmm0[1,0] +; CHECKO0-NEXT: # kill: %YMM7 %YMM7 %ZMM7 +; CHECKO0-NEXT: vextractf128 $1, %ymm7, %xmm7 +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovaps %xmm7, %xmm0 +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovaps {{[0-9]+}}(%rsp), %xmm0 # 16-byte Reload +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm0 = xmm0[1,0] +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm10 = xmm10[1,0] +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm9 = xmm9[1,0] +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm8 = xmm8[1,0] +; CHECKO0-NEXT: vpermilpd {{.*#+}} xmm7 = xmm7[1,0] +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd {{[0-9]+}}(%rsp), %xmm0 # 8-byte Reload +; CHECKO0-NEXT: # xmm0 = mem[0],zero +; CHECKO0-NEXT: vmovsd %xmm8, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd %xmm13, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd %xmm1, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd %xmm14, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd %xmm2, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd %xmm4, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd %xmm9, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd %xmm10, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd %xmm15, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd %xmm11, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd %xmm3, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd %xmm6, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd %xmm5, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd %xmm12, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd %xmm0, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: vmovsd %xmm7, {{[0-9]+}}(%rsp) # 8-byte Spill +; CHECKO0-NEXT: movq %rbp, %rsp +; CHECKO0-NEXT: popq %rbp +; CHECKO0-NEXT: vzeroupper +; CHECKO0-NEXT: ret{{[l|q]}} +; +; CHECKO2-LABEL: pr34653: +; CHECKO2: # BB#0: # %entry +; CHECKO2-NEXT: pushq %rbp +; CHECKO2-NEXT: .cfi_def_cfa_offset 16 +; CHECKO2-NEXT: .cfi_offset %rbp, -16 +; CHECKO2-NEXT: movq %rsp, %rbp +; CHECKO2-NEXT: .cfi_def_cfa_register %rbp +; CHECKO2-NEXT: andq $-512, %rsp # imm = 0xFE00 +; CHECKO2-NEXT: subq $1024, %rsp # imm = 0x400 +; CHECKO2-NEXT: movq %rsp, %rdi +; CHECKO2-NEXT: callq test +; CHECKO2-NEXT: movq %rbp, %rsp +; CHECKO2-NEXT: popq %rbp +; CHECKO2-NEXT: ret{{[l|q]}} +entry: + %v = call fastcc <38 x double> @test() + %v.0 = extractelement <38 x double> %v, i32 0 + ret void +} + + +define <112 x i8> @pr34657() local_unnamed_addr { +; CHECKO0-LABEL: pr34657: +; CHECKO0: # BB#0: # %entry +; CHECKO0-NEXT: movq %rdi, %rax +; CHECKO0-NEXT: # implicit-def: %RCX +; CHECKO0-NEXT: vmovups (%rcx), %ymm0 +; CHECKO0-NEXT: # implicit-def: %RCX +; CHECKO0-NEXT: vmovdqu (%rcx), %xmm1 +; CHECKO0-NEXT: vmovdqa %xmm1, 96(%rdi) +; CHECKO0-NEXT: vmovaps %ymm0, 64(%rdi) +; CHECKO0-NEXT: vmovaps %ymm0, 32(%rdi) +; CHECKO0-NEXT: vmovaps %ymm0, (%rdi) +; CHECKO0-NEXT: vzeroupper +; CHECKO0-NEXT: ret{{[l|q]}} +; +; CHECKO2-LABEL: pr34657: +; CHECKO2: # BB#0: # %entry +; CHECKO2-NEXT: vmovups (%rax), %xmm0 +; CHECKO2-NEXT: vmovups (%rax), %ymm1 +; CHECKO2-NEXT: vinsertf64x4 $1, %ymm0, %zmm1, %zmm0 +; CHECKO2-NEXT: vmovups (%rax), %zmm2 +; CHECKO2-NEXT: vmovaps %ymm1, 64(%rdi) +; CHECKO2-NEXT: vmovaps %zmm2, (%rdi) +; CHECKO2-NEXT: vextractf32x4 $2, %zmm0, 96(%rdi) +; CHECKO2-NEXT: movq %rdi, %rax +; CHECKO2-NEXT: vzeroupper +; CHECKO2-NEXT: ret{{[l|q]}} +entry: + %wide.vec51 = load <112 x i8>, <112 x i8>* undef, align 2 + ret <112 x i8> %wide.vec51 +} +