1 ; RUN: llc -filetype=asm -mtriple=mipsel-none-nacl -relocation-model=static \ 2 ; RUN: -O3 < %s | FileCheck %s 3 4 5 ; This test tests that NaCl functions are bundle-aligned. 6 7 define void @test0() { 8 ret void 9 10 ; CHECK: .align 4 11 ; CHECK-NOT: .align 12 ; CHECK-LABEL: test0: 13 14 } 15 16 17 ; This test tests that blocks that are jumped to through jump table are 18 ; bundle-aligned. 19 20 define i32 @test1(i32 %i) { 21 entry: 22 switch i32 %i, label %default [ 23 i32 0, label %bb1 24 i32 1, label %bb2 25 i32 2, label %bb3 26 i32 3, label %bb4 27 ] 28 29 bb1: 30 ret i32 111 31 bb2: 32 ret i32 222 33 bb3: 34 ret i32 333 35 bb4: 36 ret i32 444 37 default: 38 ret i32 555 39 40 41 ; CHECK-LABEL: test1: 42 43 ; CHECK: .align 4 44 ; CHECK-NEXT: ${{BB[0-9]+_[0-9]+}}: 45 ; CHECK-NEXT: jr $ra 46 ; CHECK-NEXT: addiu $2, $zero, 111 47 ; CHECK-NEXT: .align 4 48 ; CHECK-NEXT: ${{BB[0-9]+_[0-9]+}}: 49 ; CHECK-NEXT: jr $ra 50 ; CHECK-NEXT: addiu $2, $zero, 222 51 ; CHECK-NEXT: .align 4 52 ; CHECK-NEXT: ${{BB[0-9]+_[0-9]+}}: 53 ; CHECK-NEXT: jr $ra 54 ; CHECK-NEXT: addiu $2, $zero, 333 55 ; CHECK-NEXT: .align 4 56 ; CHECK-NEXT: ${{BB[0-9]+_[0-9]+}}: 57 ; CHECK-NEXT: jr $ra 58 ; CHECK-NEXT: addiu $2, $zero, 444 59 60 } 61 62 63 ; This test tests that a block whose address is taken is bundle-aligned in NaCl. 64 65 @bb_array = constant [2 x i8*] [i8* blockaddress(@test2, %bb1), 66 i8* blockaddress(@test2, %bb2)], align 4 67 68 define i32 @test2(i32 %i) { 69 entry: 70 %elementptr = getelementptr inbounds [2 x i8*]* @bb_array, i32 0, i32 %i 71 %0 = load i8** %elementptr, align 4 72 indirectbr i8* %0, [label %bb1, label %bb2] 73 74 bb1: 75 ret i32 111 76 bb2: 77 ret i32 222 78 79 80 ; CHECK-LABEL: test2: 81 82 ; Note that there are two consecutive labels - one temporary and one for 83 ; basic block. 84 85 ; CHECK: .align 4 86 ; CHECK-NEXT: ${{[a-zA-Z0-9]+}}: 87 ; CHECK-NEXT: ${{BB[0-9]+_[0-9]+}}: 88 ; CHECK-NEXT: jr $ra 89 ; CHECK-NEXT: addiu $2, $zero, 111 90 ; CHECK-NEXT: .align 4 91 ; CHECK-NEXT: ${{[a-zA-Z0-9]+}}: 92 ; CHECK-NEXT: ${{BB[0-9]+_[0-9]+}}: 93 ; CHECK-NEXT: jr $ra 94 ; CHECK-NEXT: addiu $2, $zero, 222 95 96 } 97