Home | History | Annotate | Download | only in X86
      1 ; REQUIRES: asserts
      2 ; RUN: opt -loop-vectorize -S -mcpu=skx --debug-only=loop-vectorize < %s 2>&1| FileCheck %s
      3 
      4 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
      5 target triple = "x86_64-unknown-linux-gnu"
      6 
      7 @A = global [10240 x i16] zeroinitializer, align 16
      8 @B = global [10240 x i16] zeroinitializer, align 16
      9 
     10 ; Function Attrs: nounwind uwtable
     11 define void @load_i16_stride2() {
     12 ;CHECK-LABEL: load_i16_stride2
     13 ;CHECK: Found an estimated cost of 1 for VF 1 For instruction:   %1 = load
     14 ;CHECK: Found an estimated cost of 1 for VF 2 For instruction:   %1 = load
     15 ;CHECK: Found an estimated cost of 1 for VF 4 For instruction:   %1 = load
     16 ;CHECK: Found an estimated cost of 1 for VF 8 For instruction:   %1 = load
     17 ;CHECK: Found an estimated cost of 1 for VF 16 For instruction:   %1 = load
     18 ;CHECK: Found an estimated cost of 2 for VF 32 For instruction:   %1 = load
     19 entry:
     20   br label %for.body
     21 
     22 for.body:                                         ; preds = %for.body, %entry
     23   %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
     24   %0 = shl nsw i64 %indvars.iv, 1
     25   %arrayidx = getelementptr inbounds [10240 x i16], [10240 x i16]* @A, i64 0, i64 %0
     26   %1 = load i16, i16* %arrayidx, align 4
     27   %arrayidx2 = getelementptr inbounds [10240 x i16], [10240 x i16]* @B, i64 0, i64 %indvars.iv
     28   store i16 %1, i16* %arrayidx2, align 2
     29   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
     30   %exitcond = icmp eq i64 %indvars.iv.next, 1024
     31   br i1 %exitcond, label %for.end, label %for.body
     32 
     33 for.end:                                          ; preds = %for.body
     34   ret void
     35 }
     36 
     37 define void @load_i16_stride3() {
     38 ;CHECK-LABEL: load_i16_stride3
     39 ;CHECK: Found an estimated cost of 1 for VF 1 For instruction:   %1 = load
     40 ;CHECK: Found an estimated cost of 1 for VF 2 For instruction:   %1 = load
     41 ;CHECK: Found an estimated cost of 1 for VF 4 For instruction:   %1 = load
     42 ;CHECK: Found an estimated cost of 1 for VF 8 For instruction:   %1 = load
     43 ;CHECK: Found an estimated cost of 2 for VF 16 For instruction:   %1 = load
     44 ;CHECK: Found an estimated cost of 3 for VF 32 For instruction:   %1 = load
     45 entry:
     46   br label %for.body
     47 
     48 for.body:                                         ; preds = %for.body, %entry
     49   %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
     50   %0 = mul nsw i64 %indvars.iv, 3
     51   %arrayidx = getelementptr inbounds [10240 x i16], [10240 x i16]* @A, i64 0, i64 %0
     52   %1 = load i16, i16* %arrayidx, align 4
     53   %arrayidx2 = getelementptr inbounds [10240 x i16], [10240 x i16]* @B, i64 0, i64 %indvars.iv
     54   store i16 %1, i16* %arrayidx2, align 2
     55   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
     56   %exitcond = icmp eq i64 %indvars.iv.next, 1024
     57   br i1 %exitcond, label %for.end, label %for.body
     58 
     59 for.end:                                          ; preds = %for.body
     60   ret void
     61 }
     62 
     63 define void @load_i16_stride4() {
     64 ;CHECK-LABEL: load_i16_stride4
     65 ;CHECK: Found an estimated cost of 1 for VF 1 For instruction:   %1 = load
     66 ;CHECK: Found an estimated cost of 1 for VF 2 For instruction:   %1 = load
     67 ;CHECK: Found an estimated cost of 1 for VF 4 For instruction:   %1 = load
     68 ;CHECK: Found an estimated cost of 1 for VF 8 For instruction:   %1 = load
     69 ;CHECK: Found an estimated cost of 2 for VF 16 For instruction:   %1 = load
     70 ;CHECK: Found an estimated cost of 5 for VF 32 For instruction:   %1 = load
     71 entry:
     72   br label %for.body
     73 
     74 for.body:                                         ; preds = %for.body, %entry
     75   %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
     76   %0 = shl nsw i64 %indvars.iv, 2
     77   %arrayidx = getelementptr inbounds [10240 x i16], [10240 x i16]* @A, i64 0, i64 %0
     78   %1 = load i16, i16* %arrayidx, align 4
     79   %arrayidx2 = getelementptr inbounds [10240 x i16], [10240 x i16]* @B, i64 0, i64 %indvars.iv
     80   store i16 %1, i16* %arrayidx2, align 2
     81   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
     82   %exitcond = icmp eq i64 %indvars.iv.next, 1024
     83   br i1 %exitcond, label %for.end, label %for.body
     84 
     85 for.end:                                          ; preds = %for.body
     86   ret void
     87 }
     88 
     89 define void @load_i16_stride5() {
     90 ;CHECK-LABEL: load_i16_stride5
     91 ;CHECK: Found an estimated cost of 1 for VF 1 For instruction:   %1 = load
     92 ;CHECK: Found an estimated cost of 1 for VF 2 For instruction:   %1 = load
     93 ;CHECK: Found an estimated cost of 1 for VF 4 For instruction:   %1 = load
     94 ;CHECK: Found an estimated cost of 2 for VF 8 For instruction:   %1 = load
     95 ;CHECK: Found an estimated cost of 3 for VF 16 For instruction:   %1 = load
     96 ;CHECK: Found an estimated cost of 6 for VF 32 For instruction:   %1 = load
     97 entry:
     98   br label %for.body
     99 
    100 for.body:                                         ; preds = %for.body, %entry
    101   %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
    102   %0 = mul nsw i64 %indvars.iv, 5
    103   %arrayidx = getelementptr inbounds [10240 x i16], [10240 x i16]* @A, i64 0, i64 %0
    104   %1 = load i16, i16* %arrayidx, align 4
    105   %arrayidx2 = getelementptr inbounds [10240 x i16], [10240 x i16]* @B, i64 0, i64 %indvars.iv
    106   store i16 %1, i16* %arrayidx2, align 2
    107   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
    108   %exitcond = icmp eq i64 %indvars.iv.next, 1024
    109   br i1 %exitcond, label %for.end, label %for.body
    110 
    111 for.end:                                          ; preds = %for.body
    112   ret void
    113 }
    114