95 lines · plain
1; RUN: llc -mtriple=aarch64 -verify-machineinstrs < %s | FileCheck --check-prefix=CHECK --check-prefix=OPT %s2; RUN: llc -mtriple=aarch64 -verify-machineinstrs -O0 -fast-isel=0 -global-isel=false < %s | FileCheck --check-prefix=CHECK --check-prefix=NOOPT %s3 4declare void @foo()5 6; Check that the inverted or doesn't inhibit the splitting of the7; complex conditional into three branch instructions.8; CHECK-LABEL: test_and_not:9; CHECK: cbz w0, [[L:\.LBB[0-9_]+]]10; OPT: cmp w1, #211; NOOPT: subs w{{[0-9]+}}, w{{[0-9]+}}, #212; CHECK: b.lo [[L]]13; OPT: cmp w2, #214; NOOPT: subs w{{[0-9]+}}, w{{[0-9]+}}, #215; CHECK: b.hi [[L]]16define void @test_and_not(i32 %a, i32 %b, i32 %c) {17bb1:18 %cmp1 = icmp ult i32 %a, 119 %cmp2 = icmp ult i32 %b, 220 %cmp3 = icmp ult i32 %c, 321 %or = or i1 %cmp1, %cmp222 %not.or = xor i1 %or, -123 %and = and i1 %not.or, %cmp324 br i1 %and, label %bb2, label %bb325 26bb2:27 ret void28 29bb3:30 call void @foo()31 ret void32}33 34; Check that non-canonicalized xor not is handled correctly by FindMergedConditions.35; CHECK-LABEL: test_and_not2:36; CHECK: cbz w0, [[L:\.LBB[0-9_]+]]37; OPT: cmp w1, #238; NOOPT: subs w{{[0-9]+}}, w{{[0-9]+}}, #239; CHECK: b.lo [[L]]40; OPT: cmp w2, #241; NOOPT: subs w{{[0-9]+}}, w{{[0-9]+}}, #242; CHECK: b.hi [[L]]43define void @test_and_not2(i32 %a, i32 %b, i32 %c) {44bb1:45 %cmp1 = icmp ult i32 %a, 146 %cmp2 = icmp ult i32 %b, 247 %cmp3 = icmp ult i32 %c, 348 %or = or i1 %cmp1, %cmp249 %not.or = xor i1 -1, %or50 %and = and i1 %not.or, %cmp351 br i1 %and, label %bb2, label %bb352 53bb2:54 ret void55 56bb3:57 call void @foo()58 ret void59}60 61; Check that cmps in different blocks are handled correctly by FindMergedConditions.62; CHECK-LABEL: test_cmp_other_block:63; OPT: cmp w{{[0-9]+}}, #064; OPT: b.gt [[L:\.LBB[0-9_]+]]65; OPT: tbz w1, #0, [[L]]66;67; NOOPT: str w1, [sp, #[[SLOT2:[0-9]+]]]68; NOOPT: subs w{{[0-9]+}}, w{{[0-9]+}}, #069; NOOPT: cset [[R1:w[0-9]+]], gt70; NOOPT: str [[R1]], [sp, #[[SLOT1:[0-9]+]]]71; NOOPT: b .LBB72; NOOPT: ldr [[R2:w[0-9]+]], [sp, #[[SLOT1]]]73; NOOPT: tbnz [[R2]], #0, [[L:\.LBB[0-9_]+]]74; NOOPT: ldr [[R3:w[0-9]+]], [sp, #[[SLOT2]]]75; NOOPT: tbz [[R3]], #0, [[L]]76define void @test_cmp_other_block(ptr %p, i1 %c) {77entry:78 %l = load i32, ptr %p79 %cmp = icmp sgt i32 %l, 080 br label %bb181 82bb1:83 %cmp.i = xor i1 %cmp, true84 %or.cond1.i = and i1 %cmp.i, %c85 br i1 %or.cond1.i, label %bb2, label %bb386 87bb2:88 ret void89 90bb3:91 call void @foo()92 ret void93}94 95