summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/zext-bool-add-sub.ll
blob: 78bcedbbc2e1a43a32f63c9cfcd339d379a0d6c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
; RUN: opt < %s -instcombine -S | FileCheck %s
; rdar://11748024

define i32 @a(i1 zeroext %x, i1 zeroext %y) {
entry:
; CHECK: @a
; CHECK: [[TMP1:%.*]] = zext i1 %y to i32
; CHECK: [[TMP2:%.*]] = select i1 %x, i32 2, i32 1
; CHECK-NEXT: sub i32 [[TMP2]], [[TMP1]]
  %conv = zext i1 %x to i32
  %conv3 = zext i1 %y to i32
  %conv3.neg = sub i32 0, %conv3
  %sub = add i32 %conv, 1
  %add = add i32 %sub, %conv3.neg
  ret i32 %add
}