mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-22 10:33:23 +00:00
[X86] AVX512: Enable it in the Loop Vectorizer
This lets us experiment with 512-bit vectorization without passing force-vector-width manually. The code generated for a simple integer memset loop is properly vectorized. Disassembly is still broken for it though :(. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212634 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
479af7ce0c
commit
074b752cc9
@ -144,13 +144,17 @@ unsigned X86TTI::getNumberOfRegisters(bool Vector) const {
|
||||
if (Vector && !ST->hasSSE1())
|
||||
return 0;
|
||||
|
||||
if (ST->is64Bit())
|
||||
if (ST->is64Bit()) {
|
||||
if (Vector && ST->hasAVX512())
|
||||
return 32;
|
||||
return 16;
|
||||
}
|
||||
return 8;
|
||||
}
|
||||
|
||||
unsigned X86TTI::getRegisterBitWidth(bool Vector) const {
|
||||
if (Vector) {
|
||||
if (ST->hasAVX512()) return 512;
|
||||
if (ST->hasAVX()) return 256;
|
||||
if (ST->hasSSE1()) return 128;
|
||||
return 0;
|
||||
|
35
test/Transforms/LoopVectorize/X86/avx512.ll
Normal file
35
test/Transforms/LoopVectorize/X86/avx512.ll
Normal file
@ -0,0 +1,35 @@
|
||||
; RUN: opt -mattr=+avx512f --loop-vectorize -S < %s | llc -mattr=+avx512f | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-apple-macosx10.9.0"
|
||||
|
||||
; Verify that we generate 512-bit wide vectors for a basic integer memset
|
||||
; loop.
|
||||
|
||||
; CHECK-LABEL: f:
|
||||
; CHECK: vmovdqu32 %zmm{{.}}, (
|
||||
; CHECK-NOT: %ymm
|
||||
|
||||
define void @f(i32* %a, i32 %n) {
|
||||
entry:
|
||||
%cmp4 = icmp sgt i32 %n, 0
|
||||
br i1 %cmp4, label %for.body.preheader, label %for.end
|
||||
|
||||
for.body.preheader: ; preds = %entry
|
||||
br label %for.body
|
||||
|
||||
for.body: ; preds = %for.body.preheader, %for.body
|
||||
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]
|
||||
%arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv
|
||||
store i32 %n, i32* %arrayidx, align 4
|
||||
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
|
||||
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
|
||||
%exitcond = icmp eq i32 %lftr.wideiv, %n
|
||||
br i1 %exitcond, label %for.end.loopexit, label %for.body
|
||||
|
||||
for.end.loopexit: ; preds = %for.body
|
||||
br label %for.end
|
||||
|
||||
for.end: ; preds = %for.end.loopexit, %entry
|
||||
ret void
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user