llvm/test/Transforms/InstCombine/and-or.ll
Sanjay Patel 503ff5bcee [InstCombine] regenerate checks
utils/update_test_checks.py was improved with:
http://reviews.llvm.org/rL265414
to CHECK-NEXT the first line of the IR function. This ensures that nothing bad
has happened before that.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265417 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 17:24:54 +00:00

56 lines
1.3 KiB
LLVM

; NOTE: Assertions have been autogenerated by update_test_checks.py
; RUN: opt < %s -instcombine -S | FileCheck %s
define i32 @func1(i32 %a, i32 %b) {
; CHECK-LABEL: @func1(
; CHECK-NEXT: [[TMP1:%.*]] = and i32 %a, 1
; CHECK-NEXT: [[TMP3:%.*]] = or i32 [[TMP1]], %b
; CHECK-NEXT: ret i32 [[TMP3]]
;
%tmp = or i32 %b, %a
%tmp1 = and i32 %tmp, 1
%tmp2 = and i32 %b, -2
%tmp3 = or i32 %tmp1, %tmp2
ret i32 %tmp3
}
define i32 @func2(i32 %a, i32 %b) {
; CHECK-LABEL: @func2(
; CHECK-NEXT: [[TMP1:%.*]] = and i32 %a, 1
; CHECK-NEXT: [[TMP3:%.*]] = or i32 [[TMP1]], %b
; CHECK-NEXT: ret i32 [[TMP3]]
;
%tmp = or i32 %a, %b
%tmp1 = and i32 1, %tmp
%tmp2 = and i32 -2, %b
%tmp3 = or i32 %tmp1, %tmp2
ret i32 %tmp3
}
define i32 @func3(i32 %a, i32 %b) {
; CHECK-LABEL: @func3(
; CHECK-NEXT: [[TMP1:%.*]] = and i32 %a, 1
; CHECK-NEXT: [[TMP3:%.*]] = or i32 [[TMP1]], %b
; CHECK-NEXT: ret i32 [[TMP3]]
;
%tmp = or i32 %b, %a
%tmp1 = and i32 %tmp, 1
%tmp2 = and i32 %b, -2
%tmp3 = or i32 %tmp2, %tmp1
ret i32 %tmp3
}
define i32 @func4(i32 %a, i32 %b) {
; CHECK-LABEL: @func4(
; CHECK-NEXT: [[TMP1:%.*]] = and i32 %a, 1
; CHECK-NEXT: [[TMP3:%.*]] = or i32 [[TMP1]], %b
; CHECK-NEXT: ret i32 [[TMP3]]
;
%tmp = or i32 %a, %b
%tmp1 = and i32 1, %tmp
%tmp2 = and i32 -2, %b
%tmp3 = or i32 %tmp2, %tmp1
ret i32 %tmp3
}