reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
; REQUIRES: asserts
; RUN: opt -loop-vectorize -S -mattr=avx512bw --debug-only=loop-vectorize < %s 2>&1| FileCheck %s

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@A = global [10240 x i16] zeroinitializer, align 16
@B = global [10240 x i16] zeroinitializer, align 16

; Function Attrs: nounwind uwtable
define void @load_i16_stride2() {
;CHECK-LABEL: load_i16_stride2
;CHECK: Found an estimated cost of 1 for VF 1 For instruction:   %1 = load
;CHECK: Found an estimated cost of 1 for VF 2 For instruction:   %1 = load
;CHECK: Found an estimated cost of 1 for VF 4 For instruction:   %1 = load
;CHECK: Found an estimated cost of 1 for VF 8 For instruction:   %1 = load
;CHECK: Found an estimated cost of 1 for VF 16 For instruction:   %1 = load
;CHECK: Found an estimated cost of 2 for VF 32 For instruction:   %1 = load
entry:
  br label %for.body

for.body:                                         ; preds = %for.body, %entry
  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
  %0 = shl nsw i64 %indvars.iv, 1
  %arrayidx = getelementptr inbounds [10240 x i16], [10240 x i16]* @A, i64 0, i64 %0
  %1 = load i16, i16* %arrayidx, align 4
  %arrayidx2 = getelementptr inbounds [10240 x i16], [10240 x i16]* @B, i64 0, i64 %indvars.iv
  store i16 %1, i16* %arrayidx2, align 2
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond = icmp eq i64 %indvars.iv.next, 1024
  br i1 %exitcond, label %for.end, label %for.body

for.end:                                          ; preds = %for.body
  ret void
}

define void @load_i16_stride3() {
;CHECK-LABEL: load_i16_stride3
;CHECK: Found an estimated cost of 1 for VF 1 For instruction:   %1 = load
;CHECK: Found an estimated cost of 1 for VF 2 For instruction:   %1 = load
;CHECK: Found an estimated cost of 1 for VF 4 For instruction:   %1 = load
;CHECK: Found an estimated cost of 1 for VF 8 For instruction:   %1 = load
;CHECK: Found an estimated cost of 2 for VF 16 For instruction:   %1 = load
;CHECK: Found an estimated cost of 3 for VF 32 For instruction:   %1 = load
entry:
  br label %for.body

for.body:                                         ; preds = %for.body, %entry
  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
  %0 = mul nsw i64 %indvars.iv, 3
  %arrayidx = getelementptr inbounds [10240 x i16], [10240 x i16]* @A, i64 0, i64 %0
  %1 = load i16, i16* %arrayidx, align 4
  %arrayidx2 = getelementptr inbounds [10240 x i16], [10240 x i16]* @B, i64 0, i64 %indvars.iv
  store i16 %1, i16* %arrayidx2, align 2
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond = icmp eq i64 %indvars.iv.next, 1024
  br i1 %exitcond, label %for.end, label %for.body

for.end:                                          ; preds = %for.body
  ret void
}

define void @load_i16_stride4() {
;CHECK-LABEL: load_i16_stride4
;CHECK: Found an estimated cost of 1 for VF 1 For instruction:   %1 = load
;CHECK: Found an estimated cost of 1 for VF 2 For instruction:   %1 = load
;CHECK: Found an estimated cost of 1 for VF 4 For instruction:   %1 = load
;CHECK: Found an estimated cost of 1 for VF 8 For instruction:   %1 = load
;CHECK: Found an estimated cost of 2 for VF 16 For instruction:   %1 = load
;CHECK: Found an estimated cost of 5 for VF 32 For instruction:   %1 = load
entry:
  br label %for.body

for.body:                                         ; preds = %for.body, %entry
  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
  %0 = shl nsw i64 %indvars.iv, 2
  %arrayidx = getelementptr inbounds [10240 x i16], [10240 x i16]* @A, i64 0, i64 %0
  %1 = load i16, i16* %arrayidx, align 4
  %arrayidx2 = getelementptr inbounds [10240 x i16], [10240 x i16]* @B, i64 0, i64 %indvars.iv
  store i16 %1, i16* %arrayidx2, align 2
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond = icmp eq i64 %indvars.iv.next, 1024
  br i1 %exitcond, label %for.end, label %for.body

for.end:                                          ; preds = %for.body
  ret void
}

define void @load_i16_stride5() {
;CHECK-LABEL: load_i16_stride5
;CHECK: Found an estimated cost of 1 for VF 1 For instruction:   %1 = load
;CHECK: Found an estimated cost of 1 for VF 2 For instruction:   %1 = load
;CHECK: Found an estimated cost of 1 for VF 4 For instruction:   %1 = load
;CHECK: Found an estimated cost of 2 for VF 8 For instruction:   %1 = load
;CHECK: Found an estimated cost of 3 for VF 16 For instruction:   %1 = load
;CHECK: Found an estimated cost of 6 for VF 32 For instruction:   %1 = load
entry:
  br label %for.body

for.body:                                         ; preds = %for.body, %entry
  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
  %0 = mul nsw i64 %indvars.iv, 5
  %arrayidx = getelementptr inbounds [10240 x i16], [10240 x i16]* @A, i64 0, i64 %0
  %1 = load i16, i16* %arrayidx, align 4
  %arrayidx2 = getelementptr inbounds [10240 x i16], [10240 x i16]* @B, i64 0, i64 %indvars.iv
  store i16 %1, i16* %arrayidx2, align 2
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond = icmp eq i64 %indvars.iv.next, 1024
  br i1 %exitcond, label %for.end, label %for.body

for.end:                                          ; preds = %for.body
  ret void
}