mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
[NFC][SimplifyCFG] Add some more tests for Arm.
This commit is contained in:
parent
3667bf202b
commit
2ad592033d
@ -1,6 +1,7 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -mtriple=thumbv8m.main %s -simplifycfg -S | FileCheck %s
|
||||
; RUN: opt -mtriple=thumbv8a %s -simplifycfg -S | FileCheck %s
|
||||
; RUN: opt -mtriple=thumbv8m.main %s -simplifycfg -S | FileCheck %s --check-prefix=CHECK --check-prefix=THUMB
|
||||
; RUN: opt -mtriple=thumbv8a %s -simplifycfg -S | FileCheck %s --check-prefix=CHECK --check-prefix=THUMB
|
||||
; RUN: opt -mtriple=armv8a %s -simplifycfg -S | FileCheck %s --check-prefix=CHECK --check-prefix=ARM
|
||||
|
||||
define i32 @foo(i32 %a, i32 %b, i32 %c, i32 %d, i32* %input) {
|
||||
; CHECK-LABEL: @foo(
|
||||
@ -101,4 +102,136 @@ cond.end:
|
||||
ret i32 %cond
|
||||
}
|
||||
|
||||
define i32 @or_predicate(i32 %a, i32 %b, i32 %c, i32 %d, i32* %input) {
|
||||
; CHECK-LABEL: @or_predicate(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[D:%.*]], 3
|
||||
; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[C:%.*]], [[A:%.*]]
|
||||
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[ADD]], [[B:%.*]]
|
||||
; CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[CMP]], [[CMP1]]
|
||||
; CHECK-NEXT: br i1 [[OR_COND]], label [[COND_END:%.*]], label [[COND_FALSE:%.*]]
|
||||
; CHECK: cond.false:
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[INPUT:%.*]], align 4
|
||||
; CHECK-NEXT: br label [[COND_END]]
|
||||
; CHECK: cond.end:
|
||||
; CHECK-NEXT: [[COND:%.*]] = phi i32 [ [[TMP0]], [[COND_FALSE]] ], [ 0, [[ENTRY:%.*]] ]
|
||||
; CHECK-NEXT: ret i32 [[COND]]
|
||||
;
|
||||
entry:
|
||||
%cmp = icmp sgt i32 %d, 3
|
||||
br i1 %cmp, label %cond.end, label %lor.lhs.false
|
||||
|
||||
lor.lhs.false:
|
||||
%add = add nsw i32 %c, %a
|
||||
%cmp1 = icmp slt i32 %add, %b
|
||||
br i1 %cmp1, label %cond.end, label %cond.false
|
||||
|
||||
cond.false:
|
||||
%0 = load i32, i32* %input, align 4
|
||||
br label %cond.end
|
||||
|
||||
cond.end:
|
||||
%cond = phi i32 [ %0, %cond.false ], [ 0, %lor.lhs.false ], [ 0, %entry ]
|
||||
ret i32 %cond
|
||||
}
|
||||
|
||||
define i32 @or_invert_predicate(i32 %a, i32 %b, i32 %c, i32 %d, i32* %input) {
|
||||
; CHECK-LABEL: @or_invert_predicate(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp sle i32 [[D:%.*]], 3
|
||||
; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[C:%.*]], [[A:%.*]]
|
||||
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[ADD]], [[B:%.*]]
|
||||
; CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[CMP]], [[CMP1]]
|
||||
; CHECK-NEXT: br i1 [[OR_COND]], label [[COND_END:%.*]], label [[COND_FALSE:%.*]]
|
||||
; CHECK: cond.false:
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[INPUT:%.*]], align 4
|
||||
; CHECK-NEXT: br label [[COND_END]]
|
||||
; CHECK: cond.end:
|
||||
; CHECK-NEXT: [[COND:%.*]] = phi i32 [ [[TMP0]], [[COND_FALSE]] ], [ 0, [[ENTRY:%.*]] ]
|
||||
; CHECK-NEXT: ret i32 [[COND]]
|
||||
;
|
||||
entry:
|
||||
%cmp = icmp sgt i32 %d, 3
|
||||
br i1 %cmp, label %lor.lhs.false, label %cond.end
|
||||
|
||||
lor.lhs.false:
|
||||
%add = add nsw i32 %c, %a
|
||||
%cmp1 = icmp slt i32 %add, %b
|
||||
br i1 %cmp1, label %cond.end, label %cond.false
|
||||
|
||||
cond.false:
|
||||
%0 = load i32, i32* %input, align 4
|
||||
br label %cond.end
|
||||
|
||||
cond.end:
|
||||
%cond = phi i32 [ %0, %cond.false ], [ 0, %lor.lhs.false ], [ 0, %entry ]
|
||||
ret i32 %cond
|
||||
}
|
||||
|
||||
define i32 @or_predicate_minsize(i32 %a, i32 %b, i32 %c, i32 %d, i32* %input) #0 {
|
||||
; CHECK-LABEL: @or_predicate_minsize(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[D:%.*]], 3
|
||||
; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[C:%.*]], [[A:%.*]]
|
||||
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[ADD]], [[B:%.*]]
|
||||
; CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[CMP]], [[CMP1]]
|
||||
; CHECK-NEXT: br i1 [[OR_COND]], label [[COND_END:%.*]], label [[COND_FALSE:%.*]]
|
||||
; CHECK: cond.false:
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[INPUT:%.*]], align 4
|
||||
; CHECK-NEXT: br label [[COND_END]]
|
||||
; CHECK: cond.end:
|
||||
; CHECK-NEXT: [[COND:%.*]] = phi i32 [ [[TMP0]], [[COND_FALSE]] ], [ 0, [[ENTRY:%.*]] ]
|
||||
; CHECK-NEXT: ret i32 [[COND]]
|
||||
;
|
||||
entry:
|
||||
%cmp = icmp sgt i32 %d, 3
|
||||
br i1 %cmp, label %cond.end, label %lor.lhs.false
|
||||
|
||||
lor.lhs.false:
|
||||
%add = add nsw i32 %c, %a
|
||||
%cmp1 = icmp slt i32 %add, %b
|
||||
br i1 %cmp1, label %cond.end, label %cond.false
|
||||
|
||||
cond.false:
|
||||
%0 = load i32, i32* %input, align 4
|
||||
br label %cond.end
|
||||
|
||||
cond.end:
|
||||
%cond = phi i32 [ %0, %cond.false ], [ 0, %lor.lhs.false ], [ 0, %entry ]
|
||||
ret i32 %cond
|
||||
}
|
||||
|
||||
define i32 @or_invert_predicate_minsize(i32 %a, i32 %b, i32 %c, i32 %d, i32* %input) #0 {
|
||||
; CHECK-LABEL: @or_invert_predicate_minsize(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp sle i32 [[D:%.*]], 3
|
||||
; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[C:%.*]], [[A:%.*]]
|
||||
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[ADD]], [[B:%.*]]
|
||||
; CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[CMP]], [[CMP1]]
|
||||
; CHECK-NEXT: br i1 [[OR_COND]], label [[COND_END:%.*]], label [[COND_FALSE:%.*]]
|
||||
; CHECK: cond.false:
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[INPUT:%.*]], align 4
|
||||
; CHECK-NEXT: br label [[COND_END]]
|
||||
; CHECK: cond.end:
|
||||
; CHECK-NEXT: [[COND:%.*]] = phi i32 [ [[TMP0]], [[COND_FALSE]] ], [ 0, [[ENTRY:%.*]] ]
|
||||
; CHECK-NEXT: ret i32 [[COND]]
|
||||
;
|
||||
entry:
|
||||
%cmp = icmp sgt i32 %d, 3
|
||||
br i1 %cmp, label %lor.lhs.false, label %cond.end
|
||||
|
||||
lor.lhs.false:
|
||||
%add = add nsw i32 %c, %a
|
||||
%cmp1 = icmp slt i32 %add, %b
|
||||
br i1 %cmp1, label %cond.end, label %cond.false
|
||||
|
||||
cond.false:
|
||||
%0 = load i32, i32* %input, align 4
|
||||
br label %cond.end
|
||||
|
||||
cond.end:
|
||||
%cond = phi i32 [ %0, %cond.false ], [ 0, %lor.lhs.false ], [ 0, %entry ]
|
||||
ret i32 %cond
|
||||
}
|
||||
|
||||
attributes #0 = { minsize optsize }
|
||||
|
Loading…
Reference in New Issue
Block a user