-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[InstCombine][NFC] Precommit tests for https://reviews.llvm.org/D149918
- Loading branch information
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
llvm/test/Transforms/PhaseOrdering/icmp-ashr-breaking-select-idiom.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3 | ||
; RUN: opt -O1 -S < %s | FileCheck %s | ||
|
||
define i32 @testa(i32 %mul) { | ||
; CHECK-LABEL: define i32 @testa( | ||
; CHECK-SAME: i32 [[MUL:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { | ||
; CHECK-NEXT: [[SHR:%.*]] = ashr i32 [[MUL]], 15 | ||
; CHECK-NEXT: [[CMP4_I:%.*]] = icmp slt i32 [[MUL]], 1073741824 | ||
; CHECK-NEXT: [[SPEC_SELECT_I:%.*]] = select i1 [[CMP4_I]], i32 [[SHR]], i32 32767 | ||
; CHECK-NEXT: ret i32 [[SPEC_SELECT_I]] | ||
; | ||
%shr = ashr i32 %mul, 15 | ||
%cmp4.i = icmp sgt i32 %shr, 32767 | ||
%switch.i = icmp ult i1 %cmp4.i, true | ||
%spec.select.i = select i1 %switch.i, i32 %shr, i32 32767 | ||
ret i32 %spec.select.i | ||
} | ||
|
||
define i32 @testb(i32 %mul) { | ||
; CHECK-LABEL: define i32 @testb( | ||
; CHECK-SAME: i32 [[MUL:%.*]]) local_unnamed_addr #[[ATTR0]] { | ||
; CHECK-NEXT: [[SHR102:%.*]] = ashr i32 [[MUL]], 7 | ||
; CHECK-NEXT: [[CMP4_I:%.*]] = icmp sgt i32 [[MUL]], 16383 | ||
; CHECK-NEXT: [[RETVAL_0_I:%.*]] = select i1 [[CMP4_I]], i32 127, i32 -128 | ||
; CHECK-NEXT: [[TMP1:%.*]] = add i32 [[MUL]], 16384 | ||
; CHECK-NEXT: [[CLEANUP_DEST_SLOT_0_I:%.*]] = icmp ult i32 [[TMP1]], 32768 | ||
; CHECK-NEXT: [[SPEC_SELECT_I:%.*]] = select i1 [[CLEANUP_DEST_SLOT_0_I]], i32 [[SHR102]], i32 [[RETVAL_0_I]] | ||
; CHECK-NEXT: ret i32 [[SPEC_SELECT_I]] | ||
; | ||
%shr102 = ashr i32 %mul, 7 | ||
%cmp4.i = icmp sgt i32 %shr102, 127 | ||
%cmp6.i = icmp slt i32 %shr102, -128 | ||
%retval.0.i = select i1 %cmp4.i, i32 127, i32 -128 | ||
%cleanup.dest.slot.0.i = select i1 %cmp4.i, i1 true, i1 %cmp6.i | ||
%switch.i = icmp ult i1 %cleanup.dest.slot.0.i, true | ||
%spec.select.i = select i1 %switch.i, i32 %shr102, i32 %retval.0.i | ||
ret i32 %spec.select.i | ||
} |