1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -O0 -mtriple=mipsel-linux-gnu -global-isel -verify-machineinstrs %s -o -| FileCheck %s -check-prefixes=MIPS32 3 4define i1 @eq_i32(i32 %a, i32 %b){ 5; MIPS32-LABEL: eq_i32: 6; MIPS32: # %bb.0: # %entry 7; MIPS32-NEXT: xor $1, $4, $5 8; MIPS32-NEXT: sltiu $2, $1, 1 9; MIPS32-NEXT: jr $ra 10; MIPS32-NEXT: nop 11entry: 12 %cmp = icmp eq i32 %a, %b 13 ret i1 %cmp 14} 15 16define i1 @ne_i32(i32 %a, i32 %b) { 17; MIPS32-LABEL: ne_i32: 18; MIPS32: # %bb.0: # %entry 19; MIPS32-NEXT: xor $1, $4, $5 20; MIPS32-NEXT: sltu $2, $zero, $1 21; MIPS32-NEXT: jr $ra 22; MIPS32-NEXT: nop 23entry: 24 %cmp = icmp ne i32 %a, %b 25 ret i1 %cmp 26} 27 28define i1 @sgt_i32(i32 %a, i32 %b) { 29; MIPS32-LABEL: sgt_i32: 30; MIPS32: # %bb.0: # %entry 31; MIPS32-NEXT: slt $2, $5, $4 32; MIPS32-NEXT: jr $ra 33; MIPS32-NEXT: nop 34entry: 35 %cmp = icmp sgt i32 %a, %b 36 ret i1 %cmp 37} 38 39define i1 @sge_i32(i32 %a, i32 %b) { 40; MIPS32-LABEL: sge_i32: 41; MIPS32: # %bb.0: # %entry 42; MIPS32-NEXT: slt $1, $4, $5 43; MIPS32-NEXT: xori $2, $1, 1 44; MIPS32-NEXT: jr $ra 45; MIPS32-NEXT: nop 46entry: 47 %cmp = icmp sge i32 %a, %b 48 ret i1 %cmp 49} 50 51define i1 @slt_i32(i32 %a, i32 %b) { 52; MIPS32-LABEL: slt_i32: 53; MIPS32: # %bb.0: # %entry 54; MIPS32-NEXT: slt $2, $4, $5 55; MIPS32-NEXT: jr $ra 56; MIPS32-NEXT: nop 57entry: 58 %cmp = icmp slt i32 %a, %b 59 ret i1 %cmp 60} 61 62define i1 @sle_i32(i32 %a, i32 %b) { 63; MIPS32-LABEL: sle_i32: 64; MIPS32: # %bb.0: # %entry 65; MIPS32-NEXT: slt $1, $5, $4 66; MIPS32-NEXT: xori $2, $1, 1 67; MIPS32-NEXT: jr $ra 68; MIPS32-NEXT: nop 69entry: 70 %cmp = icmp sle i32 %a, %b 71 ret i1 %cmp 72} 73 74define i1 @ugt_i32(i32 %a, i32 %b) { 75; MIPS32-LABEL: ugt_i32: 76; MIPS32: # %bb.0: # %entry 77; MIPS32-NEXT: sltu $2, $5, $4 78; MIPS32-NEXT: jr $ra 79; MIPS32-NEXT: nop 80entry: 81 %cmp = icmp ugt i32 %a, %b 82 ret i1 %cmp 83} 84 85define i1 @uge_i32(i32 %a, i32 %b) { 86; MIPS32-LABEL: uge_i32: 87; MIPS32: # %bb.0: # %entry 88; MIPS32-NEXT: sltu $1, $4, $5 89; MIPS32-NEXT: xori $2, $1, 1 90; MIPS32-NEXT: jr $ra 91; MIPS32-NEXT: nop 92entry: 93 %cmp = icmp uge i32 %a, %b 94 ret i1 %cmp 95} 96 97define i1 @ult_i32(i32 %a, i32 %b) { 98; MIPS32-LABEL: ult_i32: 99; MIPS32: # %bb.0: # %entry 100; MIPS32-NEXT: sltu $2, $4, $5 101; MIPS32-NEXT: jr $ra 102; MIPS32-NEXT: nop 103entry: 104 %cmp = icmp ult i32 %a, %b 105 ret i1 %cmp 106} 107 108define i1 @ule_i32(i32 %a, i32 %b) { 109; MIPS32-LABEL: ule_i32: 110; MIPS32: # %bb.0: # %entry 111; MIPS32-NEXT: sltu $1, $5, $4 112; MIPS32-NEXT: xori $2, $1, 1 113; MIPS32-NEXT: jr $ra 114; MIPS32-NEXT: nop 115entry: 116 %cmp = icmp ule i32 %a, %b 117 ret i1 %cmp 118} 119 120define i1 @eq_ptr(i32* %a, i32* %b){ 121; MIPS32-LABEL: eq_ptr: 122; MIPS32: # %bb.0: # %entry 123; MIPS32-NEXT: xor $1, $4, $5 124; MIPS32-NEXT: sltiu $2, $1, 1 125; MIPS32-NEXT: jr $ra 126; MIPS32-NEXT: nop 127entry: 128 %cmp = icmp eq i32* %a, %b 129 ret i1 %cmp 130} 131 132define i1 @ult_i8(i8 %a, i8 %b) { 133; MIPS32-LABEL: ult_i8: 134; MIPS32: # %bb.0: # %entry 135; MIPS32-NEXT: andi $1, $4, 255 136; MIPS32-NEXT: andi $2, $5, 255 137; MIPS32-NEXT: sltu $2, $1, $2 138; MIPS32-NEXT: jr $ra 139; MIPS32-NEXT: nop 140entry: 141 %cmp = icmp ult i8 %a, %b 142 ret i1 %cmp 143} 144 145define i1 @slt_i16(i16 %a, i16 %b) { 146; MIPS32-LABEL: slt_i16: 147; MIPS32: # %bb.0: # %entry 148; MIPS32-NEXT: sll $1, $4, 16 149; MIPS32-NEXT: sra $1, $1, 16 150; MIPS32-NEXT: sll $2, $5, 16 151; MIPS32-NEXT: sra $2, $2, 16 152; MIPS32-NEXT: slt $2, $1, $2 153; MIPS32-NEXT: jr $ra 154; MIPS32-NEXT: nop 155entry: 156 %cmp = icmp slt i16 %a, %b 157 ret i1 %cmp 158} 159 160define i1 @eq_i64(i64 %a, i64 %b){ 161; MIPS32-LABEL: eq_i64: 162; MIPS32: # %bb.0: # %entry 163; MIPS32-NEXT: xor $1, $4, $6 164; MIPS32-NEXT: xor $2, $5, $7 165; MIPS32-NEXT: or $1, $1, $2 166; MIPS32-NEXT: sltiu $2, $1, 1 167; MIPS32-NEXT: jr $ra 168; MIPS32-NEXT: nop 169entry: 170 %cmp = icmp eq i64 %a, %b 171 ret i1 %cmp 172} 173 174define i1 @ne_i64(i64 %a, i64 %b) { 175; MIPS32-LABEL: ne_i64: 176; MIPS32: # %bb.0: # %entry 177; MIPS32-NEXT: xor $1, $4, $6 178; MIPS32-NEXT: xor $2, $5, $7 179; MIPS32-NEXT: or $1, $1, $2 180; MIPS32-NEXT: sltu $2, $zero, $1 181; MIPS32-NEXT: jr $ra 182; MIPS32-NEXT: nop 183entry: 184 %cmp = icmp ne i64 %a, %b 185 ret i1 %cmp 186} 187 188define i1 @sgt_i64(i64 %a, i64 %b) { 189; MIPS32-LABEL: sgt_i64: 190; MIPS32: # %bb.0: # %entry 191; MIPS32-NEXT: slt $2, $7, $5 192; MIPS32-NEXT: xor $1, $5, $7 193; MIPS32-NEXT: sltiu $3, $1, 1 194; MIPS32-NEXT: sltu $1, $6, $4 195; MIPS32-NEXT: andi $3, $3, 1 196; MIPS32-NEXT: movn $2, $1, $3 197; MIPS32-NEXT: jr $ra 198; MIPS32-NEXT: nop 199entry: 200 %cmp = icmp sgt i64 %a, %b 201 ret i1 %cmp 202} 203 204define i1 @sge_i64(i64 %a, i64 %b) { 205; MIPS32-LABEL: sge_i64: 206; MIPS32: # %bb.0: # %entry 207; MIPS32-NEXT: slt $1, $5, $7 208; MIPS32-NEXT: xori $2, $1, 1 209; MIPS32-NEXT: xor $1, $5, $7 210; MIPS32-NEXT: sltiu $3, $1, 1 211; MIPS32-NEXT: sltu $1, $4, $6 212; MIPS32-NEXT: xori $1, $1, 1 213; MIPS32-NEXT: andi $3, $3, 1 214; MIPS32-NEXT: movn $2, $1, $3 215; MIPS32-NEXT: jr $ra 216; MIPS32-NEXT: nop 217entry: 218 %cmp = icmp sge i64 %a, %b 219 ret i1 %cmp 220} 221 222define i1 @slt_i64(i64 %a, i64 %b) { 223; MIPS32-LABEL: slt_i64: 224; MIPS32: # %bb.0: # %entry 225; MIPS32-NEXT: slt $2, $5, $7 226; MIPS32-NEXT: xor $1, $5, $7 227; MIPS32-NEXT: sltiu $3, $1, 1 228; MIPS32-NEXT: sltu $1, $4, $6 229; MIPS32-NEXT: andi $3, $3, 1 230; MIPS32-NEXT: movn $2, $1, $3 231; MIPS32-NEXT: jr $ra 232; MIPS32-NEXT: nop 233entry: 234 %cmp = icmp slt i64 %a, %b 235 ret i1 %cmp 236} 237 238define i1 @sle_i64(i64 %a, i64 %b) { 239; MIPS32-LABEL: sle_i64: 240; MIPS32: # %bb.0: # %entry 241; MIPS32-NEXT: slt $1, $7, $5 242; MIPS32-NEXT: xori $2, $1, 1 243; MIPS32-NEXT: xor $1, $5, $7 244; MIPS32-NEXT: sltiu $3, $1, 1 245; MIPS32-NEXT: sltu $1, $6, $4 246; MIPS32-NEXT: xori $1, $1, 1 247; MIPS32-NEXT: andi $3, $3, 1 248; MIPS32-NEXT: movn $2, $1, $3 249; MIPS32-NEXT: jr $ra 250; MIPS32-NEXT: nop 251entry: 252 %cmp = icmp sle i64 %a, %b 253 ret i1 %cmp 254} 255 256define i1 @ugt_i64(i64 %a, i64 %b) { 257; MIPS32-LABEL: ugt_i64: 258; MIPS32: # %bb.0: # %entry 259; MIPS32-NEXT: sltu $2, $7, $5 260; MIPS32-NEXT: xor $1, $5, $7 261; MIPS32-NEXT: sltiu $3, $1, 1 262; MIPS32-NEXT: sltu $1, $6, $4 263; MIPS32-NEXT: andi $3, $3, 1 264; MIPS32-NEXT: movn $2, $1, $3 265; MIPS32-NEXT: jr $ra 266; MIPS32-NEXT: nop 267entry: 268 %cmp = icmp ugt i64 %a, %b 269 ret i1 %cmp 270} 271 272define i1 @uge_i64(i64 %a, i64 %b) { 273; MIPS32-LABEL: uge_i64: 274; MIPS32: # %bb.0: # %entry 275; MIPS32-NEXT: sltu $1, $5, $7 276; MIPS32-NEXT: xori $2, $1, 1 277; MIPS32-NEXT: xor $1, $5, $7 278; MIPS32-NEXT: sltiu $3, $1, 1 279; MIPS32-NEXT: sltu $1, $4, $6 280; MIPS32-NEXT: xori $1, $1, 1 281; MIPS32-NEXT: andi $3, $3, 1 282; MIPS32-NEXT: movn $2, $1, $3 283; MIPS32-NEXT: jr $ra 284; MIPS32-NEXT: nop 285entry: 286 %cmp = icmp uge i64 %a, %b 287 ret i1 %cmp 288} 289 290define i1 @ult_i64(i64 %a, i64 %b) { 291; MIPS32-LABEL: ult_i64: 292; MIPS32: # %bb.0: # %entry 293; MIPS32-NEXT: sltu $2, $5, $7 294; MIPS32-NEXT: xor $1, $5, $7 295; MIPS32-NEXT: sltiu $3, $1, 1 296; MIPS32-NEXT: sltu $1, $4, $6 297; MIPS32-NEXT: andi $3, $3, 1 298; MIPS32-NEXT: movn $2, $1, $3 299; MIPS32-NEXT: jr $ra 300; MIPS32-NEXT: nop 301entry: 302 %cmp = icmp ult i64 %a, %b 303 ret i1 %cmp 304} 305 306define i1 @ule_i64(i64 %a, i64 %b) { 307; MIPS32-LABEL: ule_i64: 308; MIPS32: # %bb.0: # %entry 309; MIPS32-NEXT: sltu $1, $7, $5 310; MIPS32-NEXT: xori $2, $1, 1 311; MIPS32-NEXT: xor $1, $5, $7 312; MIPS32-NEXT: sltiu $3, $1, 1 313; MIPS32-NEXT: sltu $1, $6, $4 314; MIPS32-NEXT: xori $1, $1, 1 315; MIPS32-NEXT: andi $3, $3, 1 316; MIPS32-NEXT: movn $2, $1, $3 317; MIPS32-NEXT: jr $ra 318; MIPS32-NEXT: nop 319entry: 320 %cmp = icmp ule i64 %a, %b 321 ret i1 %cmp 322} 323