add test to show multi-use output

llvm-svn: 274887
This commit is contained in:
Sanjay Patel 2016-07-08 17:12:27 +00:00
parent b63f18c9c3
commit 910ce0d511
1 changed files with 15 additions and 0 deletions

View File

@ -445,6 +445,21 @@ define i32 @orsext_to_sel_swap(i32 %x, i1 %y) {
ret i32 %or ret i32 %or
} }
; FIXME: Don't replace an 'or' with a select unless it allows further simplification.
define i32 @orsext_to_sel_multi_use(i32 %x, i1 %y) {
; CHECK-LABEL: @orsext_to_sel_multi_use(
; CHECK-NEXT: [[SEXT:%.*]] = sext i1 %y to i32
; CHECK-NEXT: [[OR:%.*]] = select i1 %y, i32 -1, i32 %x
; CHECK-NEXT: [[ADD:%.*]] = add i32 [[SEXT]], [[OR]]
; CHECK-NEXT: ret i32 [[ADD]]
;
%sext = sext i1 %y to i32
%or = or i32 %sext, %x
%add = add i32 %sext, %or
ret i32 %add
}
define <2 x i32> @orsext_to_sel_vec(<2 x i32> %x, <2 x i1> %y) { define <2 x i32> @orsext_to_sel_vec(<2 x i32> %x, <2 x i1> %y) {
; CHECK-LABEL: @orsext_to_sel_vec( ; CHECK-LABEL: @orsext_to_sel_vec(
; CHECK-NEXT: [[OR:%.*]] = select <2 x i1> %y, <2 x i32> <i32 -1, i32 -1>, <2 x i32> %x ; CHECK-NEXT: [[OR:%.*]] = select <2 x i1> %y, <2 x i32> <i32 -1, i32 -1>, <2 x i32> %x