1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 3; Test that blez/ bgez are selected. 4; RUN: llc -mtriple=mipsel-mti-linux-gnu < %s | FileCheck %s --check-prefix=MIPS32 5; RUN: llc -mtriple=mips64el-mti-linux-gnu < %s | FileCheck %s --check-prefix=MIPS64 6; RUN: llc -mtriple=mipsel-mti-linux-gnu -mattr=+micromips < %s | FileCheck %s --check-prefix=MM 7 8define void @test_blez(i32 %a) { 9; MIPS32-LABEL: test_blez: 10; MIPS32: # %bb.0: # %entry 11; MIPS32-NEXT: blez $4, $BB0_2 12; MIPS32-NEXT: nop 13; MIPS32-NEXT: # %bb.1: # %if.then 14; MIPS32-NEXT: addiu $sp, $sp, -24 15; MIPS32-NEXT: .cfi_def_cfa_offset 24 16; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 17; MIPS32-NEXT: .cfi_offset 31, -4 18; MIPS32-NEXT: jal foo1 19; MIPS32-NEXT: nop 20; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 21; MIPS32-NEXT: addiu $sp, $sp, 24 22; MIPS32-NEXT: $BB0_2: # %if.end 23; MIPS32-NEXT: jr $ra 24; MIPS32-NEXT: nop 25; 26; MIPS64-LABEL: test_blez: 27; MIPS64: # %bb.0: # %entry 28; MIPS64-NEXT: sll $1, $4, 0 29; MIPS64-NEXT: blez $1, .LBB0_2 30; MIPS64-NEXT: nop 31; MIPS64-NEXT: # %bb.1: # %if.then 32; MIPS64-NEXT: daddiu $sp, $sp, -16 33; MIPS64-NEXT: .cfi_def_cfa_offset 16 34; MIPS64-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill 35; MIPS64-NEXT: .cfi_offset 31, -8 36; MIPS64-NEXT: jal foo1 37; MIPS64-NEXT: nop 38; MIPS64-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload 39; MIPS64-NEXT: daddiu $sp, $sp, 16 40; MIPS64-NEXT: .LBB0_2: # %if.end 41; MIPS64-NEXT: jr $ra 42; MIPS64-NEXT: nop 43; 44; MM-LABEL: test_blez: 45; MM: # %bb.0: # %entry 46; MM-NEXT: blez $4, $BB0_3 47; MM-NEXT: nop 48; MM-NEXT: # %bb.1: # %entry 49; MM-NEXT: j $BB0_2 50; MM-NEXT: nop 51; MM-NEXT: $BB0_2: # %if.then 52; MM-NEXT: addiu $sp, $sp, -24 53; MM-NEXT: .cfi_def_cfa_offset 24 54; MM-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 55; MM-NEXT: .cfi_offset 31, -4 56; MM-NEXT: jal foo1 57; MM-NEXT: nop 58; MM-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 59; MM-NEXT: addiu $sp, $sp, 24 60; MM-NEXT: $BB0_3: # %if.end 61; MM-NEXT: jrc $ra 62entry: 63 %cmp = icmp sgt i32 %a, 0 64 br i1 %cmp, label %if.then, label %if.end 65 66if.then: 67 tail call void @foo1() 68 br label %if.end 69 70if.end: 71 ret void 72} 73 74declare void @foo1() 75 76define void @test_bgez(i32 %a) { 77; MIPS32-LABEL: test_bgez: 78; MIPS32: # %bb.0: # %entry 79; MIPS32-NEXT: bltz $4, $BB1_2 80; MIPS32-NEXT: nop 81; MIPS32-NEXT: # %bb.1: # %if.end 82; MIPS32-NEXT: jr $ra 83; MIPS32-NEXT: nop 84; MIPS32-NEXT: $BB1_2: # %if.then 85; MIPS32-NEXT: addiu $sp, $sp, -24 86; MIPS32-NEXT: .cfi_def_cfa_offset 24 87; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 88; MIPS32-NEXT: .cfi_offset 31, -4 89; MIPS32-NEXT: jal foo1 90; MIPS32-NEXT: nop 91; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 92; MIPS32-NEXT: jr $ra 93; MIPS32-NEXT: addiu $sp, $sp, 24 94; 95; MIPS64-LABEL: test_bgez: 96; MIPS64: # %bb.0: # %entry 97; MIPS64-NEXT: sll $1, $4, 0 98; MIPS64-NEXT: bltz $1, .LBB1_2 99; MIPS64-NEXT: nop 100; MIPS64-NEXT: # %bb.1: # %if.end 101; MIPS64-NEXT: jr $ra 102; MIPS64-NEXT: nop 103; MIPS64-NEXT: .LBB1_2: # %if.then 104; MIPS64-NEXT: daddiu $sp, $sp, -16 105; MIPS64-NEXT: .cfi_def_cfa_offset 16 106; MIPS64-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill 107; MIPS64-NEXT: .cfi_offset 31, -8 108; MIPS64-NEXT: jal foo1 109; MIPS64-NEXT: nop 110; MIPS64-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload 111; MIPS64-NEXT: jr $ra 112; MIPS64-NEXT: daddiu $sp, $sp, 16 113; 114; MM-LABEL: test_bgez: 115; MM: # %bb.0: # %entry 116; MM-NEXT: bgez $4, $BB1_2 117; MM-NEXT: nop 118; MM-NEXT: # %bb.1: # %entry 119; MM-NEXT: j $BB1_3 120; MM-NEXT: nop 121; MM-NEXT: $BB1_2: # %if.end 122; MM-NEXT: jrc $ra 123; MM-NEXT: $BB1_3: # %if.then 124; MM-NEXT: addiu $sp, $sp, -24 125; MM-NEXT: .cfi_def_cfa_offset 24 126; MM-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 127; MM-NEXT: .cfi_offset 31, -4 128; MM-NEXT: jal foo1 129; MM-NEXT: nop 130; MM-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 131; MM-NEXT: jr $ra 132; MM-NEXT: addiu $sp, $sp, 24 133entry: 134 %cmp = icmp slt i32 %a, 0 135 br i1 %cmp, label %if.then, label %if.end 136 137if.then: 138 tail call void @foo1() 139 br label %if.end 140 141if.end: 142 ret void 143} 144