1; RUN: llc -mtriple=x86_64-unknown-linux < %s | FileCheck %s 2 3@g = external global i8 4 5declare void @f0() 6declare void @f1() 7declare void @f2() 8declare void @f3() 9declare void @f4() 10declare void @f5() 11declare void @f6() 12declare void @f7() 13declare void @f8() 14declare void @f9() 15 16declare void @llvm.icall.branch.funnel(...) 17 18define void @jt2(i8* nest, ...) { 19 ; CHECK: jt2: 20 ; CHECK: leaq g+1(%rip), %r11 21 ; CHECK-NEXT: cmpq %r11, %r10 22 ; CHECK-NEXT: jae .LBB0_1 23 ; CHECK-NEXT: # 24 ; CHECK-NEXT: jmp f0 25 ; CHECK-NEXT: .LBB0_1: 26 ; CHECK-NEXT: jmp f1 27 musttail call void (...) @llvm.icall.branch.funnel( 28 i8* %0, 29 i8* getelementptr (i8, i8* @g, i64 0), void ()* @f0, 30 i8* getelementptr (i8, i8* @g, i64 1), void ()* @f1, 31 ... 32 ) 33 ret void 34} 35 36define void @jt3(i8* nest, ...) { 37 ; CHECK: jt3: 38 ; CHECK: leaq g+1(%rip), %r11 39 ; CHECK-NEXT: cmpq %r11, %r10 40 ; CHECK-NEXT: jae .LBB1_1 41 ; CHECK-NEXT: # 42 ; CHECK-NEXT: jmp f0 43 ; CHECK-NEXT: .LBB1_1: 44 ; CHECK-NEXT: jne .LBB1_2 45 ; CHECK-NEXT: # 46 ; CHECK-NEXT: jmp f1 47 ; CHECK-NEXT: .LBB1_2: 48 ; CHECK-NEXT: jmp f2 49 musttail call void (...) @llvm.icall.branch.funnel( 50 i8* %0, 51 i8* getelementptr (i8, i8* @g, i64 0), void ()* @f0, 52 i8* getelementptr (i8, i8* @g, i64 2), void ()* @f2, 53 i8* getelementptr (i8, i8* @g, i64 1), void ()* @f1, 54 ... 55 ) 56 ret void 57} 58 59define void @jt7(i8* nest, ...) { 60 ; CHECK: jt7: 61 ; CHECK: leaq g+3(%rip), %r11 62 ; CHECK-NEXT: cmpq %r11, %r10 63 ; CHECK-NEXT: jae .LBB2_1 64 ; CHECK-NEXT: # 65 ; CHECK-NEXT: leaq g+1(%rip), %r11 66 ; CHECK-NEXT: cmpq %r11, %r10 67 ; CHECK-NEXT: jae .LBB2_6 68 ; CHECK-NEXT: # 69 ; CHECK-NEXT: jmp f0 70 ; CHECK-NEXT: .LBB2_1: 71 ; CHECK-NEXT: jne .LBB2_2 72 ; CHECK-NEXT: # 73 ; CHECK-NEXT: jmp f3 74 ; CHECK-NEXT: .LBB2_6: 75 ; CHECK-NEXT: jne .LBB2_7 76 ; CHECK-NEXT: # 77 ; CHECK-NEXT: jmp f1 78 ; CHECK-NEXT: .LBB2_2: 79 ; CHECK-NEXT: leaq g+5(%rip), %r11 80 ; CHECK-NEXT: cmpq %r11, %r10 81 ; CHECK-NEXT: jae .LBB2_3 82 ; CHECK-NEXT: # 83 ; CHECK-NEXT: jmp f4 84 ; CHECK-NEXT: .LBB2_7: 85 ; CHECK-NEXT: jmp f2 86 ; CHECK-NEXT: .LBB2_3: 87 ; CHECK-NEXT: jne .LBB2_4 88 ; CHECK-NEXT: # 89 ; CHECK-NEXT: jmp f5 90 ; CHECK-NEXT: .LBB2_4: 91 ; CHECK-NEXT: jmp f6 92 musttail call void (...) @llvm.icall.branch.funnel( 93 i8* %0, 94 i8* getelementptr (i8, i8* @g, i64 0), void ()* @f0, 95 i8* getelementptr (i8, i8* @g, i64 1), void ()* @f1, 96 i8* getelementptr (i8, i8* @g, i64 2), void ()* @f2, 97 i8* getelementptr (i8, i8* @g, i64 3), void ()* @f3, 98 i8* getelementptr (i8, i8* @g, i64 4), void ()* @f4, 99 i8* getelementptr (i8, i8* @g, i64 5), void ()* @f5, 100 i8* getelementptr (i8, i8* @g, i64 6), void ()* @f6, 101 ... 102 ) 103 ret void 104} 105 106define void @jt10(i8* nest, ...) { 107 ; CHECK: jt10: 108 ; CHECK: leaq g+5(%rip), %r11 109 ; CHECK-NEXT: cmpq %r11, %r10 110 ; CHECK-NEXT: jae .LBB3_1 111 ; CHECK-NEXT: # 112 ; CHECK-NEXT: leaq g+1(%rip), %r11 113 ; CHECK-NEXT: cmpq %r11, %r10 114 ; CHECK-NEXT: jae .LBB3_7 115 ; CHECK-NEXT: # 116 ; CHECK-NEXT: jmp f0 117 ; CHECK-NEXT: .LBB3_1: 118 ; CHECK-NEXT: jne .LBB3_2 119 ; CHECK-NEXT: # 120 ; CHECK-NEXT: jmp f5 121 ; CHECK-NEXT: .LBB3_7: 122 ; CHECK-NEXT: jne .LBB3_8 123 ; CHECK-NEXT: # 124 ; CHECK-NEXT: jmp f1 125 ; CHECK-NEXT: .LBB3_2: 126 ; CHECK-NEXT: leaq g+7(%rip), %r11 127 ; CHECK-NEXT: cmpq %r11, %r10 128 ; CHECK-NEXT: jae .LBB3_3 129 ; CHECK-NEXT: # 130 ; CHECK-NEXT: jmp f6 131 ; CHECK-NEXT: .LBB3_8: 132 ; CHECK-NEXT: leaq g+3(%rip), %r11 133 ; CHECK-NEXT: cmpq %r11, %r10 134 ; CHECK-NEXT: jae .LBB3_9 135 ; CHECK-NEXT: # 136 ; CHECK-NEXT: jmp f2 137 ; CHECK-NEXT: .LBB3_3: 138 ; CHECK-NEXT: jne .LBB3_4 139 ; CHECK-NEXT: # 140 ; CHECK-NEXT: jmp f7 141 ; CHECK-NEXT: .LBB3_9: 142 ; CHECK-NEXT: jne .LBB3_10 143 ; CHECK-NEXT: # 144 ; CHECK-NEXT: jmp f3 145 ; CHECK-NEXT: .LBB3_4: 146 ; CHECK-NEXT: leaq g+9(%rip), %r11 147 ; CHECK-NEXT: cmpq %r11, %r10 148 ; CHECK-NEXT: jae .LBB3_5 149 ; CHECK-NEXT: # 150 ; CHECK-NEXT: jmp f8 151 ; CHECK-NEXT: .LBB3_10: 152 ; CHECK-NEXT: jmp f4 153 ; CHECK-NEXT: .LBB3_5: 154 ; CHECK-NEXT: jmp f9 155 musttail call void (...) @llvm.icall.branch.funnel( 156 i8* %0, 157 i8* getelementptr (i8, i8* @g, i64 0), void ()* @f0, 158 i8* getelementptr (i8, i8* @g, i64 1), void ()* @f1, 159 i8* getelementptr (i8, i8* @g, i64 2), void ()* @f2, 160 i8* getelementptr (i8, i8* @g, i64 3), void ()* @f3, 161 i8* getelementptr (i8, i8* @g, i64 4), void ()* @f4, 162 i8* getelementptr (i8, i8* @g, i64 5), void ()* @f5, 163 i8* getelementptr (i8, i8* @g, i64 6), void ()* @f6, 164 i8* getelementptr (i8, i8* @g, i64 7), void ()* @f7, 165 i8* getelementptr (i8, i8* @g, i64 8), void ()* @f8, 166 i8* getelementptr (i8, i8* @g, i64 9), void ()* @f9, 167 ... 168 ) 169 ret void 170} 171