1; RUN: llc -filetype=asm -mtriple=mipsel-none-linux -relocation-model=static \ 2; RUN: -O3 < %s | FileCheck %s 3 4; RUN: llc -filetype=asm -mtriple=mipsel-none-nacl -relocation-model=static \ 5; RUN: -O3 < %s | FileCheck %s -check-prefix=CHECK-NACL 6 7@x = global i32 0, align 4 8declare void @f1(i32) 9declare void @f2() 10 11 12define void @test1() { 13 %1 = load i32, i32* @x, align 4 14 call void @f1(i32 %1) 15 ret void 16 17 18; CHECK-LABEL: test1 19 20; We first make sure that for non-NaCl targets branch-delay slot contains 21; dangerous instructions. 22 23; Check that branch-delay slot is used to load argument from x before function 24; call. 25 26; CHECK: jal 27; CHECK-NEXT: lw $4, %lo(x)(${{[0-9]+}}) 28 29; Check that branch-delay slot is used for adjusting sp before return. 30 31; CHECK: jr $ra 32; CHECK-NEXT: addiu $sp, $sp, {{[0-9]+}} 33 34 35; For NaCl, check that branch-delay slot doesn't contain dangerous instructions. 36 37; CHECK-NACL: jal 38; CHECK-NACL-NEXT: nop 39 40; CHECK-NACL: jr $ra 41; CHECK-NACL-NEXT: nop 42} 43 44 45define void @test2() { 46 store i32 1, i32* @x, align 4 47 call void @f2() 48 ret void 49 50 51; CHECK-LABEL: test2 52 53; Check that branch-delay slot is used for storing to x before function call. 54 55; CHECK: jal 56; CHECK-NEXT: sw ${{[0-9]+}}, %lo(x)(${{[0-9]+}}) 57 58; Check that branch-delay slot is used for adjusting sp before return. 59 60; CHECK: jr $ra 61; CHECK-NEXT: addiu $sp, $sp, {{[0-9]+}} 62 63 64; For NaCl, check that branch-delay slot doesn't contain dangerous instructions. 65 66; CHECK-NACL: jal 67; CHECK-NACL-NEXT: nop 68 69; CHECK-NACL: jr $ra 70; CHECK-NACL-NEXT: nop 71} 72