2 # RUN: llc --march=hexagon %s -run-pass=pipeliner -debug-only=pipeliner \
3 # RUN: -window-sched=force -filetype=null -verify-machineinstrs 2>&1 \
6 # CHECK: Best window offset is {{[0-9]+}} and Best II is {{[0-9]+}}.
7 # CHECK-LABEL: name: exp_approx_top_six
8 # CHECK: bb.5.loop_body:
9 # CHECK: dead %{{[0-9]*}}:hvxvr = V6_vaddw %{{[0-9]*}}, %{{[0-9]*}}
14 define void @exp_approx_top_six(i32 %N, ptr noalias %x, ptr noalias %y) #0 {
16 %is_zero = icmp eq i32 %N, 0
17 br i1 %is_zero, label %exit, label %loop_header
20 %vec_one = tail call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 1065353216)
21 %vec_half = tail call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 1056964608)
22 %vec_sixth = tail call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 1042983595)
23 %vec_24th = tail call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 1026206379)
24 %vec_120th = tail call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 1007192201)
25 %vec_720th = tail call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 985008993)
32 %lsr.iv1 = phi ptr [ %cgep3, %loop_body ], [ %x, %loop_header ]
33 %lsr.iv = phi ptr [ %cgep, %loop_body ], [ %y, %loop_header ]
34 %index = phi i32 [ 0, %loop_header ], [ %index_next, %loop_body ]
35 %vec_input = load <32 x i32>, ptr %lsr.iv1, align 128
36 %vec_input_pow_2 = tail call <32 x i32> @llvm.hexagon.V6.vmpyowh.rnd.128B(<32 x i32> %vec_input, <32 x i32> %vec_input)
37 %vec_input_pow_3 = tail call <32 x i32> @llvm.hexagon.V6.vmpyowh.rnd.128B(<32 x i32> %vec_input_pow_2, <32 x i32> %vec_input)
38 %vec_input_pow_4 = tail call <32 x i32> @llvm.hexagon.V6.vmpyowh.rnd.128B(<32 x i32> %vec_input_pow_3, <32 x i32> %vec_input)
39 %vec_input_pow_5 = tail call <32 x i32> @llvm.hexagon.V6.vmpyowh.rnd.128B(<32 x i32> %vec_input_pow_4, <32 x i32> %vec_input)
40 %vec_input_pow_6 = tail call <32 x i32> @llvm.hexagon.V6.vmpyowh.rnd.128B(<32 x i32> %vec_input_pow_5, <32 x i32> %vec_input)
41 %vec_exp_approx_1 = tail call <32 x i32> @llvm.hexagon.V6.vmpyowh.rnd.128B(<32 x i32> %vec_half, <32 x i32> %vec_input_pow_2)
42 %vec_exp_approx_2 = tail call <32 x i32> @llvm.hexagon.V6.vmpyowh.rnd.128B(<32 x i32> %vec_sixth, <32 x i32> %vec_input_pow_3)
43 %vec_exp_approx_3 = tail call <32 x i32> @llvm.hexagon.V6.vmpyowh.rnd.128B(<32 x i32> %vec_24th, <32 x i32> %vec_input_pow_4)
44 %vec_exp_approx_4 = tail call <32 x i32> @llvm.hexagon.V6.vmpyowh.rnd.128B(<32 x i32> %vec_120th, <32 x i32> %vec_input_pow_5)
45 %vec_exp_approx_5 = tail call <32 x i32> @llvm.hexagon.V6.vmpyowh.rnd.128B(<32 x i32> %vec_720th, <32 x i32> %vec_input_pow_6)
46 %vec_exp_sum_1 = tail call <32 x i32> @llvm.hexagon.V6.vaddw.128B(<32 x i32> %vec_one, <32 x i32> %vec_input)
47 %vec_exp_sum_2 = tail call <32 x i32> @llvm.hexagon.V6.vaddw.128B(<32 x i32> %vec_exp_sum_1, <32 x i32> %vec_exp_approx_1)
48 %vec_exp_sum_3 = tail call <32 x i32> @llvm.hexagon.V6.vaddw.128B(<32 x i32> %vec_exp_sum_2, <32 x i32> %vec_exp_approx_2)
49 %vec_exp_sum_4 = tail call <32 x i32> @llvm.hexagon.V6.vaddw.128B(<32 x i32> %vec_exp_sum_3, <32 x i32> %vec_exp_approx_3)
50 %vec_exp_sum_5 = tail call <32 x i32> @llvm.hexagon.V6.vaddw.128B(<32 x i32> %vec_exp_sum_4, <32 x i32> %vec_exp_approx_4)
51 %vec_exp_result = tail call <32 x i32> @llvm.hexagon.V6.vaddw.128B(<32 x i32> %vec_exp_sum_5, <32 x i32> %vec_exp_approx_5)
52 store <32 x i32> %vec_exp_result, ptr %lsr.iv, align 128
53 %index_next = add nuw i32 %index, 32
54 %loop_cond = icmp ult i32 %index_next, %N
55 %cgep = getelementptr i8, ptr %lsr.iv, i32 128
56 %cgep3 = getelementptr i8, ptr %lsr.iv1, i32 128
57 br i1 %loop_cond, label %loop_body, label %exit
60 declare <32 x i32> @llvm.hexagon.V6.vmpyowh.rnd.128B(<32 x i32>, <32 x i32>)
61 declare <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32)
62 declare <32 x i32> @llvm.hexagon.V6.vaddw.128B(<32 x i32>, <32 x i32>)
64 attributes #0 = { "target-features"="+hvx-length128b,+hvxv69,+v66,-long-calls" }
67 name: exp_approx_top_six
68 tracksRegLiveness: true
71 successors: %bb.2(0x30000000), %bb.1(0x50000000)
72 liveins: $r0, $r1, $r2
77 %3:predregs = C2_cmpeqi %2, 0
78 J2_jumpt killed %3, %bb.2, implicit-def dead $pc
79 J2_jump %bb.1, implicit-def dead $pc
82 successors: %bb.3(0x80000000)
84 %4:intregs = A2_tfrsi 1065353216
85 %5:hvxvr = V6_lvsplatw killed %4
86 %6:intregs = A2_tfrsi 1056964608
87 %7:hvxvr = V6_lvsplatw killed %6
88 %8:intregs = A2_tfrsi 1042983595
89 %9:hvxvr = V6_lvsplatw killed %8
90 %10:intregs = A2_tfrsi 1026206379
91 %11:hvxvr = V6_lvsplatw killed %10
92 %12:intregs = A2_tfrsi 1007192201
93 %13:hvxvr = V6_lvsplatw killed %12
94 %14:intregs = A2_tfrsi 985008993
95 %15:hvxvr = V6_lvsplatw killed %14
96 %16:intregs = A2_addi %2, 31
97 %17:intregs = S2_lsr_i_r %16, 5
98 %18:intregs = COPY %17
99 J2_loop0r %bb.3, %18, implicit-def $lc0, implicit-def $sa0, implicit-def $usr
100 J2_jump %bb.3, implicit-def dead $pc
103 PS_jmpret $r31, implicit-def dead $pc
105 bb.3.loop_body (machine-block-address-taken):
106 successors: %bb.3(0x7c000000), %bb.2(0x04000000)
108 %19:intregs = PHI %1, %bb.1, %20, %bb.3
109 %21:intregs = PHI %0, %bb.1, %22, %bb.3
110 %23:hvxvr, %20:intregs = V6_vL32b_pi %19, 128 :: (load (s1024) from %ir.lsr.iv1)
111 %24:hvxvr = V6_vmpyowh_rnd %23, %23
112 %25:hvxvr = V6_vmpyowh_rnd %24, %23
113 %26:hvxvr = V6_vmpyowh_rnd %25, %23
114 %27:hvxvr = V6_vmpyowh_rnd %26, %23
115 %28:hvxvr = V6_vmpyowh_rnd %27, %23
116 %29:hvxvr = V6_vmpyowh_rnd %7, %24
117 %30:hvxvr = V6_vmpyowh_rnd %9, %25
118 %31:hvxvr = V6_vmpyowh_rnd %11, %26
119 %32:hvxvr = V6_vmpyowh_rnd %13, %27
120 %33:hvxvr = V6_vmpyowh_rnd %15, killed %28
121 %34:hvxvr = V6_vaddw %5, %23
122 %35:hvxvr = V6_vaddw killed %34, killed %29
123 %36:hvxvr = V6_vaddw killed %35, killed %30
124 %37:hvxvr = V6_vaddw killed %36, killed %31
125 %38:hvxvr = V6_vaddw killed %37, killed %32
126 %39:hvxvr = V6_vaddw %38, %33
127 ; To check the dead virtual register within loop kernel.
128 dead %40:hvxvr = V6_vaddw killed %38, killed %33
129 %22:intregs = V6_vS32b_pi %21, 128, killed %39 :: (store (s1024) into %ir.lsr.iv)
130 ENDLOOP0 %bb.3, implicit-def $pc, implicit-def $lc0, implicit $sa0, implicit $lc0
131 J2_jump %bb.2, implicit-def dead $pc