1; RUN: llc -O3 -mtriple arm64-apple-ios5.0.0 < %s | FileCheck %s
2; <rdar://problem/15992732>
3; Zero truncation is not necessary when the values are extended properly
4; already.
5
6@block = common global i8* null, align 8
7
8define zeroext i8 @foo(i32 %i1, i32 %i2) {
9; CHECK-LABEL: foo:
10; CHECK: cset
11; CHECK-NOT: and
12entry:
13  %idxprom = sext i32 %i1 to i64
14  %0 = load i8*, i8** @block, align 8
15  %arrayidx = getelementptr inbounds i8, i8* %0, i64 %idxprom
16  %1 = load i8, i8* %arrayidx, align 1
17  %idxprom1 = sext i32 %i2 to i64
18  %arrayidx2 = getelementptr inbounds i8, i8* %0, i64 %idxprom1
19  %2 = load i8, i8* %arrayidx2, align 1
20  %cmp = icmp eq i8 %1, %2
21  br i1 %cmp, label %return, label %if.then
22
23if.then:                                          ; preds = %entry
24  %cmp7 = icmp ugt i8 %1, %2
25  %conv9 = zext i1 %cmp7 to i8
26  br label %return
27
28return:                                           ; preds = %entry, %if.then
29  %retval.0 = phi i8 [ %conv9, %if.then ], [ 1, %entry ]
30  ret i8 %retval.0
31}
32