[PATCH] D19579: [AVX512] AVX512 braodcastsd/ss patterns interaction with spilling.

Igor Breger via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 00:36:41 PDT 2016


igorb created this revision.
igorb added reviewers: delena, greened, cameron.mcinally.
igorb added a subscriber: llvm-commits.
igorb set the repository for this revision to rL LLVM.

Change AVX512 braodcastsd/ss patterns interaction with spilling .  New implementation take a scalar register and generate a vector without COPY_TO_REGCLASS (turn it into a VR128 register  ) .The issue is that during register allocation we may spill a scalar value using 128-bit loads and stores, wasting cache bandwidth.
example
declare void @func_f32(float)
define <8 x float> @_256_broadcast_ss_spill(float %x) {
  %a  = fadd float %x, %x
  call void @func_f32(float %a)
  %b = insertelement <8 x float> undef, float %a, i32 0
  %c = shufflevector <8 x float> %b, <8 x float> undef, <8 x i32> zeroinitializer
  ret <8 x float> %c
}

old implementation
    vaddss  %xmm0, %xmm0, %xmm0
    vmovss  %xmm0, 4(%rsp)          # 4-byte Folded Spill
    callq   func_f32
    vbroadcastss    4(%rsp), %ymm0  # 4-byte Folded Reload
    popq    %rax
    retq
    
new implementation
    vaddss  %xmm0, %xmm0, %xmm0
    vmovaps %xmm0, (%rsp)           # 16-byte Spill
    callq   func_f32
    vbroadcastss    (%rsp), %ymm0   # 16-byte Folded Reload
    addq    $24, %rsp
    retq   


Repository:
  rL LLVM

http://reviews.llvm.org/D19579

Files:
  lib/Target/X86/X86InstrAVX512.td
  lib/Target/X86/X86InstrInfo.cpp
  lib/Target/X86/X86InstrSSE.td
  test/CodeGen/X86/avx-isa-check.ll
  test/CodeGen/X86/avx512-vbroadcast.ll
  test/CodeGen/X86/avx512vl-vbroadcast.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19579.55166.patch
Type: text/x-patch
Size: 25046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160427/995eaf99/attachment-0001.bin>


More information about the llvm-commits mailing list