1; RUN: llc < %s -mtriple=aarch64-- | FileCheck %s 2 3%struct.anon = type { i32*, i32* } 4 5@ptr_wrapper = common dso_local local_unnamed_addr global %struct.anon* null, align 8 6 7define dso_local i32 @test_func_i32_two_uses(i32 %in, i32 %bit, i32 %mask) local_unnamed_addr { 8entry: 9 %0 = load %struct.anon*, %struct.anon** @ptr_wrapper, align 8 10 %result = getelementptr inbounds %struct.anon, %struct.anon* %0, i64 0, i32 1 11 %tobool2 = icmp ne i32 %mask, 0 12 br label %do.body 13 14do.body: ; preds = %4, %entry 15; CHECK-LABEL: test_func_i32_two_uses: 16; CHECK: ands [[DSTREG:w[0-9]+]] 17; Usage #1 18; CHECK: cmp [[DSTREG]] 19; Usage #2 20; CHECK: cbz [[DSTREG]] 21 %bit.addr.0 = phi i32 [ %bit, %entry ], [ %shl, %4 ] 22 %retval1.0 = phi i32 [ 0, %entry ], [ %retval1.1, %4 ] 23 %and = and i32 %bit.addr.0, %in 24 %tobool = icmp eq i32 %and, 0 25 %not.tobool = xor i1 %tobool, true 26 %inc = zext i1 %not.tobool to i32 27 %retval1.1 = add nuw nsw i32 %retval1.0, %inc 28 %1 = xor i1 %tobool, true 29 %2 = or i1 %tobool2, %1 30 %dummy = and i32 %mask, %in 31 %use_and = icmp eq i32 %and, %dummy 32 %dummy_or = or i1 %use_and, %2 33 br i1 %dummy_or, label %3, label %4 34 353: ; preds = %do.body 36 store i32* null, i32** %result, align 8 37 br label %4 38 394: ; preds = %do.body, %3 40 %shl = shl i32 %bit.addr.0, 1 41 %tobool6 = icmp eq i32 %shl, 0 42 br i1 %tobool6, label %do.end, label %do.body 43 44do.end: ; preds = %4 45 ret i32 %retval1.1 46} 47 48define dso_local i32 @test_func_i64_one_use(i64 %in, i64 %bit, i64 %mask) local_unnamed_addr #0 { 49entry: 50 %0 = load %struct.anon*, %struct.anon** @ptr_wrapper, align 8 51 %result = getelementptr inbounds %struct.anon, %struct.anon* %0, i64 0, i32 1 52 %tobool2 = icmp ne i64 %mask, 0 53 br label %do.body 54 55do.body: ; preds = %4, %entry 56; CHECK-LABEL: test_func_i64_one_use: 57; CHECK: ands [[DSTREG:x[0-9]+]], [[SRCREG1:x[0-9]+]], [[SRCREG2:x[0-9]+]] 58; CHECK-NEXT: orr [[DSTREG]], [[SRCREG_ORR:x[0-9]+]], [[DSTREG]] 59 %bit.addr.0 = phi i64 [ %bit, %entry ], [ %shl, %4 ] 60 %retval1.0 = phi i32 [ 0, %entry ], [ %retval1.1, %4 ] 61 %and = and i64 %bit.addr.0, %in 62 %tobool = icmp eq i64 %and, 0 63 %not.tobool = xor i1 %tobool, true 64 %inc = zext i1 %not.tobool to i32 65 %retval1.1 = add nuw nsw i32 %retval1.0, %inc 66 %1 = xor i1 %tobool, true 67 %2 = or i1 %tobool2, %1 68 br i1 %2, label %3, label %4 69 703: ; preds = %do.body 71 store i32* null, i32** %result, align 8 72 br label %4 73 744: ; preds = %do.body, %3 75 %shl = shl i64 %bit.addr.0, 1 76 %tobool6 = icmp eq i64 %shl, 0 77 br i1 %tobool6, label %do.end, label %do.body 78 79do.end: ; preds = %4 80 ret i32 %retval1.1 81} 82