1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -mtriple=aarch64-none-elf -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes=CHECK,SDISEL 3; RUN: llc -mtriple=aarch64-none-elf -global-isel -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes=CHECK,GISEL 4 5declare void @dummy() 6 7define i32 @and_eq_ne_ult(i32 %s0, i32 %s1, i32 %s2, i32 %s3, i32 %s4, i32 %s5, ptr %p) { 8; SDISEL-LABEL: and_eq_ne_ult: 9; SDISEL: // %bb.0: // %entry 10; SDISEL-NEXT: cmp w2, w3 11; SDISEL-NEXT: ccmp w0, w1, #0, ne 12; SDISEL-NEXT: b.eq .LBB0_3 13; SDISEL-NEXT: // %bb.1: // %entry 14; SDISEL-NEXT: cmp w4, w5 15; SDISEL-NEXT: b.lo .LBB0_3 16; SDISEL-NEXT: // %bb.2: 17; SDISEL-NEXT: mov w0, wzr 18; SDISEL-NEXT: ret 19; SDISEL-NEXT: .LBB0_3: // %if 20; SDISEL-NEXT: mov w0, #1 // =0x1 21; SDISEL-NEXT: str w0, [x6] 22; SDISEL-NEXT: ret 23; 24; GISEL-LABEL: and_eq_ne_ult: 25; GISEL: // %bb.0: // %entry 26; GISEL-NEXT: cmp w0, w1 27; GISEL-NEXT: cset w8, eq 28; GISEL-NEXT: cmp w2, w3 29; GISEL-NEXT: cset w9, ne 30; GISEL-NEXT: and w8, w8, w9 31; GISEL-NEXT: tbnz w8, #0, .LBB0_3 32; GISEL-NEXT: // %bb.1: // %entry 33; GISEL-NEXT: cmp w4, w5 34; GISEL-NEXT: mov w0, wzr 35; GISEL-NEXT: b.lo .LBB0_3 36; GISEL-NEXT: // %bb.2: // %common.ret 37; GISEL-NEXT: ret 38; GISEL-NEXT: .LBB0_3: // %if 39; GISEL-NEXT: mov w0, #1 // =0x1 40; GISEL-NEXT: str w0, [x6] 41; GISEL-NEXT: ret 42entry: 43 %c0 = icmp eq i32 %s0, %s1 44 %c1 = icmp ne i32 %s2, %s3 45 %a = and i1 %c0, %c1 46 %c2 = icmp ult i32 %s4, %s5 47 %o = or i1 %a, %c2 48 br i1 %o, label %if, label %else 49 50if: 51 store i32 1, ptr %p 52 ret i32 1 53 54else: 55 ret i32 0 56} 57 58define i32 @and_ne_ult_ule(i32 %s0, i32 %s1, i32 %s2, i32 %s3, i32 %s4, i32 %s5, ptr %p) { 59; SDISEL-LABEL: and_ne_ult_ule: 60; SDISEL: // %bb.0: // %entry 61; SDISEL-NEXT: cmp w2, w3 62; SDISEL-NEXT: ccmp w0, w1, #4, lo 63; SDISEL-NEXT: b.ne .LBB1_3 64; SDISEL-NEXT: // %bb.1: // %entry 65; SDISEL-NEXT: cmp w4, w5 66; SDISEL-NEXT: b.ls .LBB1_3 67; SDISEL-NEXT: // %bb.2: 68; SDISEL-NEXT: mov w0, wzr 69; SDISEL-NEXT: ret 70; SDISEL-NEXT: .LBB1_3: // %if 71; SDISEL-NEXT: mov w0, #1 // =0x1 72; SDISEL-NEXT: str w0, [x6] 73; SDISEL-NEXT: ret 74; 75; GISEL-LABEL: and_ne_ult_ule: 76; GISEL: // %bb.0: // %entry 77; GISEL-NEXT: cmp w0, w1 78; GISEL-NEXT: cset w8, ne 79; GISEL-NEXT: cmp w2, w3 80; GISEL-NEXT: cset w9, lo 81; GISEL-NEXT: and w8, w8, w9 82; GISEL-NEXT: tbnz w8, #0, .LBB1_3 83; GISEL-NEXT: // %bb.1: // %entry 84; GISEL-NEXT: cmp w4, w5 85; GISEL-NEXT: mov w0, wzr 86; GISEL-NEXT: b.ls .LBB1_3 87; GISEL-NEXT: // %bb.2: // %common.ret 88; GISEL-NEXT: ret 89; GISEL-NEXT: .LBB1_3: // %if 90; GISEL-NEXT: mov w0, #1 // =0x1 91; GISEL-NEXT: str w0, [x6] 92; GISEL-NEXT: ret 93entry: 94 %c0 = icmp ne i32 %s0, %s1 95 %c1 = icmp ult i32 %s2, %s3 96 %a = and i1 %c0, %c1 97 %c2 = icmp ule i32 %s4, %s5 98 %o = or i1 %a, %c2 99 br i1 %o, label %if, label %else 100 101if: 102 store i32 1, ptr %p 103 ret i32 1 104 105else: 106 ret i32 0 107} 108 109define i32 @and_ult_ule_ugt(i32 %s0, i32 %s1, i32 %s2, i32 %s3, i32 %s4, i32 %s5, ptr %p) { 110; SDISEL-LABEL: and_ult_ule_ugt: 111; SDISEL: // %bb.0: // %entry 112; SDISEL-NEXT: cmp w2, w3 113; SDISEL-NEXT: ccmp w0, w1, #2, ls 114; SDISEL-NEXT: b.lo .LBB2_3 115; SDISEL-NEXT: // %bb.1: // %entry 116; SDISEL-NEXT: cmp w4, w5 117; SDISEL-NEXT: b.hi .LBB2_3 118; SDISEL-NEXT: // %bb.2: 119; SDISEL-NEXT: mov w0, wzr 120; SDISEL-NEXT: ret 121; SDISEL-NEXT: .LBB2_3: // %if 122; SDISEL-NEXT: mov w0, #1 // =0x1 123; SDISEL-NEXT: str w0, [x6] 124; SDISEL-NEXT: ret 125; 126; GISEL-LABEL: and_ult_ule_ugt: 127; GISEL: // %bb.0: // %entry 128; GISEL-NEXT: cmp w0, w1 129; GISEL-NEXT: cset w8, lo 130; GISEL-NEXT: cmp w2, w3 131; GISEL-NEXT: cset w9, ls 132; GISEL-NEXT: and w8, w8, w9 133; GISEL-NEXT: tbnz w8, #0, .LBB2_3 134; GISEL-NEXT: // %bb.1: // %entry 135; GISEL-NEXT: cmp w4, w5 136; GISEL-NEXT: mov w0, wzr 137; GISEL-NEXT: b.hi .LBB2_3 138; GISEL-NEXT: // %bb.2: // %common.ret 139; GISEL-NEXT: ret 140; GISEL-NEXT: .LBB2_3: // %if 141; GISEL-NEXT: mov w0, #1 // =0x1 142; GISEL-NEXT: str w0, [x6] 143; GISEL-NEXT: ret 144entry: 145 %c0 = icmp ult i32 %s0, %s1 146 %c1 = icmp ule i32 %s2, %s3 147 %a = and i1 %c0, %c1 148 %c2 = icmp ugt i32 %s4, %s5 149 %o = or i1 %a, %c2 150 br i1 %o, label %if, label %else 151 152if: 153 store i32 1, ptr %p 154 ret i32 1 155 156else: 157 ret i32 0 158} 159 160define i32 @and_ule_ugt_uge(i32 %s0, i32 %s1, i32 %s2, i32 %s3, i32 %s4, i32 %s5, ptr %p) { 161; SDISEL-LABEL: and_ule_ugt_uge: 162; SDISEL: // %bb.0: // %entry 163; SDISEL-NEXT: cmp w2, w3 164; SDISEL-NEXT: ccmp w0, w1, #2, hi 165; SDISEL-NEXT: b.ls .LBB3_3 166; SDISEL-NEXT: // %bb.1: // %entry 167; SDISEL-NEXT: cmp w4, w5 168; SDISEL-NEXT: b.hs .LBB3_3 169; SDISEL-NEXT: // %bb.2: 170; SDISEL-NEXT: mov w0, wzr 171; SDISEL-NEXT: ret 172; SDISEL-NEXT: .LBB3_3: // %if 173; SDISEL-NEXT: mov w0, #1 // =0x1 174; SDISEL-NEXT: str w0, [x6] 175; SDISEL-NEXT: ret 176; 177; GISEL-LABEL: and_ule_ugt_uge: 178; GISEL: // %bb.0: // %entry 179; GISEL-NEXT: cmp w0, w1 180; GISEL-NEXT: cset w8, ls 181; GISEL-NEXT: cmp w2, w3 182; GISEL-NEXT: cset w9, hi 183; GISEL-NEXT: and w8, w8, w9 184; GISEL-NEXT: tbnz w8, #0, .LBB3_3 185; GISEL-NEXT: // %bb.1: // %entry 186; GISEL-NEXT: cmp w4, w5 187; GISEL-NEXT: mov w0, wzr 188; GISEL-NEXT: b.hs .LBB3_3 189; GISEL-NEXT: // %bb.2: // %common.ret 190; GISEL-NEXT: ret 191; GISEL-NEXT: .LBB3_3: // %if 192; GISEL-NEXT: mov w0, #1 // =0x1 193; GISEL-NEXT: str w0, [x6] 194; GISEL-NEXT: ret 195entry: 196 %c0 = icmp ule i32 %s0, %s1 197 %c1 = icmp ugt i32 %s2, %s3 198 %a = and i1 %c0, %c1 199 %c2 = icmp uge i32 %s4, %s5 200 %o = or i1 %a, %c2 201 br i1 %o, label %if, label %else 202 203if: 204 store i32 1, ptr %p 205 ret i32 1 206 207else: 208 ret i32 0 209} 210 211define i32 @and_ugt_uge_slt(i32 %s0, i32 %s1, i32 %s2, i32 %s3, i32 %s4, i32 %s5, ptr %p) { 212; SDISEL-LABEL: and_ugt_uge_slt: 213; SDISEL: // %bb.0: // %entry 214; SDISEL-NEXT: cmp w2, w3 215; SDISEL-NEXT: ccmp w0, w1, #0, hs 216; SDISEL-NEXT: b.hi .LBB4_3 217; SDISEL-NEXT: // %bb.1: // %entry 218; SDISEL-NEXT: cmp w4, w5 219; SDISEL-NEXT: b.lt .LBB4_3 220; SDISEL-NEXT: // %bb.2: 221; SDISEL-NEXT: mov w0, wzr 222; SDISEL-NEXT: ret 223; SDISEL-NEXT: .LBB4_3: // %if 224; SDISEL-NEXT: mov w0, #1 // =0x1 225; SDISEL-NEXT: str w0, [x6] 226; SDISEL-NEXT: ret 227; 228; GISEL-LABEL: and_ugt_uge_slt: 229; GISEL: // %bb.0: // %entry 230; GISEL-NEXT: cmp w0, w1 231; GISEL-NEXT: cset w8, hi 232; GISEL-NEXT: cmp w2, w3 233; GISEL-NEXT: cset w9, hs 234; GISEL-NEXT: and w8, w8, w9 235; GISEL-NEXT: tbnz w8, #0, .LBB4_3 236; GISEL-NEXT: // %bb.1: // %entry 237; GISEL-NEXT: cmp w4, w5 238; GISEL-NEXT: mov w0, wzr 239; GISEL-NEXT: b.lt .LBB4_3 240; GISEL-NEXT: // %bb.2: // %common.ret 241; GISEL-NEXT: ret 242; GISEL-NEXT: .LBB4_3: // %if 243; GISEL-NEXT: mov w0, #1 // =0x1 244; GISEL-NEXT: str w0, [x6] 245; GISEL-NEXT: ret 246entry: 247 %c0 = icmp ugt i32 %s0, %s1 248 %c1 = icmp uge i32 %s2, %s3 249 %a = and i1 %c0, %c1 250 %c2 = icmp slt i32 %s4, %s5 251 %o = or i1 %a, %c2 252 br i1 %o, label %if, label %else 253 254if: 255 store i32 1, ptr %p 256 ret i32 1 257 258else: 259 ret i32 0 260} 261 262define i32 @and_uge_slt_sle(i32 %s0, i32 %s1, i32 %s2, i32 %s3, i32 %s4, i32 %s5, ptr %p) { 263; SDISEL-LABEL: and_uge_slt_sle: 264; SDISEL: // %bb.0: // %entry 265; SDISEL-NEXT: cmp w2, w3 266; SDISEL-NEXT: ccmp w0, w1, #0, lt 267; SDISEL-NEXT: b.hs .LBB5_3 268; SDISEL-NEXT: // %bb.1: // %entry 269; SDISEL-NEXT: cmp w4, w5 270; SDISEL-NEXT: b.le .LBB5_3 271; SDISEL-NEXT: // %bb.2: 272; SDISEL-NEXT: mov w0, wzr 273; SDISEL-NEXT: ret 274; SDISEL-NEXT: .LBB5_3: // %if 275; SDISEL-NEXT: mov w0, #1 // =0x1 276; SDISEL-NEXT: str w0, [x6] 277; SDISEL-NEXT: ret 278; 279; GISEL-LABEL: and_uge_slt_sle: 280; GISEL: // %bb.0: // %entry 281; GISEL-NEXT: cmp w0, w1 282; GISEL-NEXT: cset w8, hs 283; GISEL-NEXT: cmp w2, w3 284; GISEL-NEXT: cset w9, lt 285; GISEL-NEXT: and w8, w8, w9 286; GISEL-NEXT: tbnz w8, #0, .LBB5_3 287; GISEL-NEXT: // %bb.1: // %entry 288; GISEL-NEXT: cmp w4, w5 289; GISEL-NEXT: mov w0, wzr 290; GISEL-NEXT: b.le .LBB5_3 291; GISEL-NEXT: // %bb.2: // %common.ret 292; GISEL-NEXT: ret 293; GISEL-NEXT: .LBB5_3: // %if 294; GISEL-NEXT: mov w0, #1 // =0x1 295; GISEL-NEXT: str w0, [x6] 296; GISEL-NEXT: ret 297entry: 298 %c0 = icmp uge i32 %s0, %s1 299 %c1 = icmp slt i32 %s2, %s3 300 %a = and i1 %c0, %c1 301 %c2 = icmp sle i32 %s4, %s5 302 %o = or i1 %a, %c2 303 br i1 %o, label %if, label %else 304 305if: 306 store i32 1, ptr %p 307 ret i32 1 308 309else: 310 ret i32 0 311} 312 313define i32 @and_slt_sle_sgt(i32 %s0, i32 %s1, i32 %s2, i32 %s3, i32 %s4, i32 %s5, ptr %p) { 314; SDISEL-LABEL: and_slt_sle_sgt: 315; SDISEL: // %bb.0: // %entry 316; SDISEL-NEXT: cmp w2, w3 317; SDISEL-NEXT: ccmp w0, w1, #0, le 318; SDISEL-NEXT: b.lt .LBB6_3 319; SDISEL-NEXT: // %bb.1: // %entry 320; SDISEL-NEXT: cmp w4, w5 321; SDISEL-NEXT: b.gt .LBB6_3 322; SDISEL-NEXT: // %bb.2: 323; SDISEL-NEXT: mov w0, wzr 324; SDISEL-NEXT: ret 325; SDISEL-NEXT: .LBB6_3: // %if 326; SDISEL-NEXT: mov w0, #1 // =0x1 327; SDISEL-NEXT: str w0, [x6] 328; SDISEL-NEXT: ret 329; 330; GISEL-LABEL: and_slt_sle_sgt: 331; GISEL: // %bb.0: // %entry 332; GISEL-NEXT: cmp w0, w1 333; GISEL-NEXT: cset w8, lt 334; GISEL-NEXT: cmp w2, w3 335; GISEL-NEXT: cset w9, le 336; GISEL-NEXT: and w8, w8, w9 337; GISEL-NEXT: tbnz w8, #0, .LBB6_3 338; GISEL-NEXT: // %bb.1: // %entry 339; GISEL-NEXT: cmp w4, w5 340; GISEL-NEXT: mov w0, wzr 341; GISEL-NEXT: b.gt .LBB6_3 342; GISEL-NEXT: // %bb.2: // %common.ret 343; GISEL-NEXT: ret 344; GISEL-NEXT: .LBB6_3: // %if 345; GISEL-NEXT: mov w0, #1 // =0x1 346; GISEL-NEXT: str w0, [x6] 347; GISEL-NEXT: ret 348entry: 349 %c0 = icmp slt i32 %s0, %s1 350 %c1 = icmp sle i32 %s2, %s3 351 %a = and i1 %c0, %c1 352 %c2 = icmp sgt i32 %s4, %s5 353 %o = or i1 %a, %c2 354 br i1 %o, label %if, label %else 355 356if: 357 store i32 1, ptr %p 358 ret i32 1 359 360else: 361 ret i32 0 362} 363 364define i32 @and_sle_sgt_sge(i32 %s0, i32 %s1, i32 %s2, i32 %s3, i32 %s4, i32 %s5, ptr %p) { 365; SDISEL-LABEL: and_sle_sgt_sge: 366; SDISEL: // %bb.0: // %entry 367; SDISEL-NEXT: cmp w2, w3 368; SDISEL-NEXT: ccmp w0, w1, #0, gt 369; SDISEL-NEXT: b.le .LBB7_3 370; SDISEL-NEXT: // %bb.1: // %entry 371; SDISEL-NEXT: cmp w4, w5 372; SDISEL-NEXT: b.ge .LBB7_3 373; SDISEL-NEXT: // %bb.2: 374; SDISEL-NEXT: mov w0, wzr 375; SDISEL-NEXT: ret 376; SDISEL-NEXT: .LBB7_3: // %if 377; SDISEL-NEXT: mov w0, #1 // =0x1 378; SDISEL-NEXT: str w0, [x6] 379; SDISEL-NEXT: ret 380; 381; GISEL-LABEL: and_sle_sgt_sge: 382; GISEL: // %bb.0: // %entry 383; GISEL-NEXT: cmp w0, w1 384; GISEL-NEXT: cset w8, le 385; GISEL-NEXT: cmp w2, w3 386; GISEL-NEXT: cset w9, gt 387; GISEL-NEXT: and w8, w8, w9 388; GISEL-NEXT: tbnz w8, #0, .LBB7_3 389; GISEL-NEXT: // %bb.1: // %entry 390; GISEL-NEXT: cmp w4, w5 391; GISEL-NEXT: mov w0, wzr 392; GISEL-NEXT: b.ge .LBB7_3 393; GISEL-NEXT: // %bb.2: // %common.ret 394; GISEL-NEXT: ret 395; GISEL-NEXT: .LBB7_3: // %if 396; GISEL-NEXT: mov w0, #1 // =0x1 397; GISEL-NEXT: str w0, [x6] 398; GISEL-NEXT: ret 399entry: 400 %c0 = icmp sle i32 %s0, %s1 401 %c1 = icmp sgt i32 %s2, %s3 402 %a = and i1 %c0, %c1 403 %c2 = icmp sge i32 %s4, %s5 404 %o = or i1 %a, %c2 405 br i1 %o, label %if, label %else 406 407if: 408 store i32 1, ptr %p 409 ret i32 1 410 411else: 412 ret i32 0 413} 414;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: 415; CHECK: {{.*}} 416