1 ; RUN: opt < %s -basicaa -slp-vectorizer -S -slp-schedule-budget=16 -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s 2 3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 4 target triple = "x86_64-apple-macosx10.9.0" 5 6 ; Test if the budget for the scheduling region size works. 7 ; We test with a reduced budget of 16 which should prevent vectorizing the loads. 8 9 declare void @unknown() 10 11 ; CHECK-LABEL: @test 12 ; CHECK: load float 13 ; CHECK: load float 14 ; CHECK: load float 15 ; CHECK: load float 16 ; CHECK: call void @unknown 17 ; CHECK: store float 18 ; CHECK: store float 19 ; CHECK: store float 20 ; CHECK: store float 21 ; CHECK: load <4 x float> 22 ; CHECK: store <4 x float> 23 define void @test(float * %a, float * %b, float * %c, float * %d) { 24 entry: 25 ; Don't vectorize these loads. 26 %l0 = load float, float* %a 27 %a1 = getelementptr inbounds float, float* %a, i64 1 28 %l1 = load float, float* %a1 29 %a2 = getelementptr inbounds float, float* %a, i64 2 30 %l2 = load float, float* %a2 31 %a3 = getelementptr inbounds float, float* %a, i64 3 32 %l3 = load float, float* %a3 33 34 ; some unrelated instructions inbetween to enlarge the scheduling region 35 call void @unknown() 36 call void @unknown() 37 call void @unknown() 38 call void @unknown() 39 call void @unknown() 40 call void @unknown() 41 call void @unknown() 42 call void @unknown() 43 call void @unknown() 44 call void @unknown() 45 call void @unknown() 46 call void @unknown() 47 call void @unknown() 48 call void @unknown() 49 call void @unknown() 50 call void @unknown() 51 call void @unknown() 52 call void @unknown() 53 call void @unknown() 54 call void @unknown() 55 call void @unknown() 56 call void @unknown() 57 call void @unknown() 58 call void @unknown() 59 call void @unknown() 60 call void @unknown() 61 call void @unknown() 62 call void @unknown() 63 64 ; Don't vectorize these stores because their operands are too far away. 65 store float %l0, float* %b 66 %b1 = getelementptr inbounds float, float* %b, i64 1 67 store float %l1, float* %b1 68 %b2 = getelementptr inbounds float, float* %b, i64 2 69 store float %l2, float* %b2 70 %b3 = getelementptr inbounds float, float* %b, i64 3 71 store float %l3, float* %b3 72 73 ; But still vectorize the following instructions, because even if the budget 74 ; is exceeded there is a minimum region size. 75 %l4 = load float, float* %c 76 %c1 = getelementptr inbounds float, float* %c, i64 1 77 %l5 = load float, float* %c1 78 %c2 = getelementptr inbounds float, float* %c, i64 2 79 %l6 = load float, float* %c2 80 %c3 = getelementptr inbounds float, float* %c, i64 3 81 %l7 = load float, float* %c3 82 83 store float %l4, float* %d 84 %d1 = getelementptr inbounds float, float* %d, i64 1 85 store float %l5, float* %d1 86 %d2 = getelementptr inbounds float, float* %d, i64 2 87 store float %l6, float* %d2 88 %d3 = getelementptr inbounds float, float* %d, i64 3 89 store float %l7, float* %d3 90 91 ret void 92 } 93 94