1*b7c2400fSDan Gohman; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-block-placement -verify-machineinstrs | FileCheck %s 2950a13cfSDan Gohman 3f0b165a7SDan Gohman; Test switch instructions. Block placement is disabled because it reorders 4f0b165a7SDan Gohman; the blocks in a way that isn't interesting here. 5950a13cfSDan Gohman 60c6f5ac5SDan Gohmantarget datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" 7950a13cfSDan Gohmantarget triple = "wasm32-unknown-unknown" 8950a13cfSDan Gohman 9950a13cfSDan Gohmandeclare void @foo0() 10950a13cfSDan Gohmandeclare void @foo1() 11950a13cfSDan Gohmandeclare void @foo2() 12950a13cfSDan Gohmandeclare void @foo3() 13950a13cfSDan Gohmandeclare void @foo4() 14950a13cfSDan Gohmandeclare void @foo5() 15950a13cfSDan Gohman 16e51c058eSDan Gohman; CHECK-LABEL: bar32: 171d68e80fSDan Gohman; CHECK: block{{$}} 181d68e80fSDan Gohman; CHECK: block{{$}} 191d68e80fSDan Gohman; CHECK: block{{$}} 201d68e80fSDan Gohman; CHECK: block{{$}} 211d68e80fSDan Gohman; CHECK: block{{$}} 221d68e80fSDan Gohman; CHECK: block{{$}} 231d68e80fSDan Gohman; CHECK: block{{$}} 2414026064SDan Gohman; CHECK: br_table {{[^,]+}}, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 4, 5, 0{{$}} 25a4730cf0SDan Gohman; CHECK: .LBB0_2: 2626c6765bSDan Gohman; CHECK: call foo0@FUNCTION{{$}} 27a4730cf0SDan Gohman; CHECK: .LBB0_3: 2826c6765bSDan Gohman; CHECK: call foo1@FUNCTION{{$}} 29a4730cf0SDan Gohman; CHECK: .LBB0_4: 3026c6765bSDan Gohman; CHECK: call foo2@FUNCTION{{$}} 31a4730cf0SDan Gohman; CHECK: .LBB0_5: 3226c6765bSDan Gohman; CHECK: call foo3@FUNCTION{{$}} 33a4730cf0SDan Gohman; CHECK: .LBB0_6: 3426c6765bSDan Gohman; CHECK: call foo4@FUNCTION{{$}} 35a4730cf0SDan Gohman; CHECK: .LBB0_7: 3626c6765bSDan Gohman; CHECK: call foo5@FUNCTION{{$}} 37a4730cf0SDan Gohman; CHECK: .LBB0_8: 38e51c058eSDan Gohman; CHECK: return{{$}} 39950a13cfSDan Gohmandefine void @bar32(i32 %n) { 40950a13cfSDan Gohmanentry: 41950a13cfSDan Gohman switch i32 %n, label %sw.epilog [ 42950a13cfSDan Gohman i32 0, label %sw.bb 43950a13cfSDan Gohman i32 1, label %sw.bb 44950a13cfSDan Gohman i32 2, label %sw.bb 45950a13cfSDan Gohman i32 3, label %sw.bb 46950a13cfSDan Gohman i32 4, label %sw.bb 47950a13cfSDan Gohman i32 5, label %sw.bb 48950a13cfSDan Gohman i32 6, label %sw.bb 49950a13cfSDan Gohman i32 7, label %sw.bb.1 50950a13cfSDan Gohman i32 8, label %sw.bb.1 51950a13cfSDan Gohman i32 9, label %sw.bb.1 52950a13cfSDan Gohman i32 10, label %sw.bb.1 53950a13cfSDan Gohman i32 11, label %sw.bb.1 54950a13cfSDan Gohman i32 12, label %sw.bb.1 55950a13cfSDan Gohman i32 13, label %sw.bb.1 56950a13cfSDan Gohman i32 14, label %sw.bb.1 57950a13cfSDan Gohman i32 15, label %sw.bb.2 58950a13cfSDan Gohman i32 16, label %sw.bb.2 59950a13cfSDan Gohman i32 17, label %sw.bb.2 60950a13cfSDan Gohman i32 18, label %sw.bb.2 61950a13cfSDan Gohman i32 19, label %sw.bb.2 62950a13cfSDan Gohman i32 20, label %sw.bb.2 63950a13cfSDan Gohman i32 21, label %sw.bb.3 64950a13cfSDan Gohman i32 22, label %sw.bb.4 65950a13cfSDan Gohman i32 23, label %sw.bb.5 66950a13cfSDan Gohman ] 67950a13cfSDan Gohman 68950a13cfSDan Gohmansw.bb: ; preds = %entry, %entry, %entry, %entry, %entry, %entry, %entry 69950a13cfSDan Gohman tail call void @foo0() 70950a13cfSDan Gohman br label %sw.epilog 71950a13cfSDan Gohman 72950a13cfSDan Gohmansw.bb.1: ; preds = %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry 73950a13cfSDan Gohman tail call void @foo1() 74950a13cfSDan Gohman br label %sw.epilog 75950a13cfSDan Gohman 76950a13cfSDan Gohmansw.bb.2: ; preds = %entry, %entry, %entry, %entry, %entry, %entry 77950a13cfSDan Gohman tail call void @foo2() 78950a13cfSDan Gohman br label %sw.epilog 79950a13cfSDan Gohman 80950a13cfSDan Gohmansw.bb.3: ; preds = %entry 81950a13cfSDan Gohman tail call void @foo3() 82950a13cfSDan Gohman br label %sw.epilog 83950a13cfSDan Gohman 84950a13cfSDan Gohmansw.bb.4: ; preds = %entry 85950a13cfSDan Gohman tail call void @foo4() 86950a13cfSDan Gohman br label %sw.epilog 87950a13cfSDan Gohman 88950a13cfSDan Gohmansw.bb.5: ; preds = %entry 89950a13cfSDan Gohman tail call void @foo5() 90950a13cfSDan Gohman br label %sw.epilog 91950a13cfSDan Gohman 92950a13cfSDan Gohmansw.epilog: ; preds = %entry, %sw.bb.5, %sw.bb.4, %sw.bb.3, %sw.bb.2, %sw.bb.1, %sw.bb 93950a13cfSDan Gohman ret void 94950a13cfSDan Gohman} 95950a13cfSDan Gohman 96e51c058eSDan Gohman; CHECK-LABEL: bar64: 971d68e80fSDan Gohman; CHECK: block{{$}} 981d68e80fSDan Gohman; CHECK: block{{$}} 991d68e80fSDan Gohman; CHECK: block{{$}} 1001d68e80fSDan Gohman; CHECK: block{{$}} 1011d68e80fSDan Gohman; CHECK: block{{$}} 1021d68e80fSDan Gohman; CHECK: block{{$}} 1031d68e80fSDan Gohman; CHECK: block{{$}} 10414026064SDan Gohman; CHECK: br_table {{[^,]+}}, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 4, 5, 0{{$}} 105a4730cf0SDan Gohman; CHECK: .LBB1_2: 10626c6765bSDan Gohman; CHECK: call foo0@FUNCTION{{$}} 107a4730cf0SDan Gohman; CHECK: .LBB1_3: 10826c6765bSDan Gohman; CHECK: call foo1@FUNCTION{{$}} 109a4730cf0SDan Gohman; CHECK: .LBB1_4: 11026c6765bSDan Gohman; CHECK: call foo2@FUNCTION{{$}} 111a4730cf0SDan Gohman; CHECK: .LBB1_5: 11226c6765bSDan Gohman; CHECK: call foo3@FUNCTION{{$}} 113a4730cf0SDan Gohman; CHECK: .LBB1_6: 11426c6765bSDan Gohman; CHECK: call foo4@FUNCTION{{$}} 115a4730cf0SDan Gohman; CHECK: .LBB1_7: 11626c6765bSDan Gohman; CHECK: call foo5@FUNCTION{{$}} 117a4730cf0SDan Gohman; CHECK: .LBB1_8: 118e51c058eSDan Gohman; CHECK: return{{$}} 119950a13cfSDan Gohmandefine void @bar64(i64 %n) { 120950a13cfSDan Gohmanentry: 121950a13cfSDan Gohman switch i64 %n, label %sw.epilog [ 122950a13cfSDan Gohman i64 0, label %sw.bb 123950a13cfSDan Gohman i64 1, label %sw.bb 124950a13cfSDan Gohman i64 2, label %sw.bb 125950a13cfSDan Gohman i64 3, label %sw.bb 126950a13cfSDan Gohman i64 4, label %sw.bb 127950a13cfSDan Gohman i64 5, label %sw.bb 128950a13cfSDan Gohman i64 6, label %sw.bb 129950a13cfSDan Gohman i64 7, label %sw.bb.1 130950a13cfSDan Gohman i64 8, label %sw.bb.1 131950a13cfSDan Gohman i64 9, label %sw.bb.1 132950a13cfSDan Gohman i64 10, label %sw.bb.1 133950a13cfSDan Gohman i64 11, label %sw.bb.1 134950a13cfSDan Gohman i64 12, label %sw.bb.1 135950a13cfSDan Gohman i64 13, label %sw.bb.1 136950a13cfSDan Gohman i64 14, label %sw.bb.1 137950a13cfSDan Gohman i64 15, label %sw.bb.2 138950a13cfSDan Gohman i64 16, label %sw.bb.2 139950a13cfSDan Gohman i64 17, label %sw.bb.2 140950a13cfSDan Gohman i64 18, label %sw.bb.2 141950a13cfSDan Gohman i64 19, label %sw.bb.2 142950a13cfSDan Gohman i64 20, label %sw.bb.2 143950a13cfSDan Gohman i64 21, label %sw.bb.3 144950a13cfSDan Gohman i64 22, label %sw.bb.4 145950a13cfSDan Gohman i64 23, label %sw.bb.5 146950a13cfSDan Gohman ] 147950a13cfSDan Gohman 148950a13cfSDan Gohmansw.bb: ; preds = %entry, %entry, %entry, %entry, %entry, %entry, %entry 149950a13cfSDan Gohman tail call void @foo0() 150950a13cfSDan Gohman br label %sw.epilog 151950a13cfSDan Gohman 152950a13cfSDan Gohmansw.bb.1: ; preds = %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry 153950a13cfSDan Gohman tail call void @foo1() 154950a13cfSDan Gohman br label %sw.epilog 155950a13cfSDan Gohman 156950a13cfSDan Gohmansw.bb.2: ; preds = %entry, %entry, %entry, %entry, %entry, %entry 157950a13cfSDan Gohman tail call void @foo2() 158950a13cfSDan Gohman br label %sw.epilog 159950a13cfSDan Gohman 160950a13cfSDan Gohmansw.bb.3: ; preds = %entry 161950a13cfSDan Gohman tail call void @foo3() 162950a13cfSDan Gohman br label %sw.epilog 163950a13cfSDan Gohman 164950a13cfSDan Gohmansw.bb.4: ; preds = %entry 165950a13cfSDan Gohman tail call void @foo4() 166950a13cfSDan Gohman br label %sw.epilog 167950a13cfSDan Gohman 168950a13cfSDan Gohmansw.bb.5: ; preds = %entry 169950a13cfSDan Gohman tail call void @foo5() 170950a13cfSDan Gohman br label %sw.epilog 171950a13cfSDan Gohman 172950a13cfSDan Gohmansw.epilog: ; preds = %entry, %sw.bb.5, %sw.bb.4, %sw.bb.3, %sw.bb.2, %sw.bb.1, %sw.bb 173950a13cfSDan Gohman ret void 174950a13cfSDan Gohman} 175