1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

[NFC] Add SimplifyCFG for ARM

Add some phi elimination threshold testing.
This commit is contained in:
Sam Parker 2020-08-21 11:51:40 +01:00
parent fd94b72c2e
commit 25faf23408

View File

@ -0,0 +1,453 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -mtriple=thumbv8m.main < %s -simplifycfg -S -two-entry-phi-node-folding-threshold=4 | FileCheck %s --check-prefix=ALL --check-prefix=CHECK-V8M-TWO-FOLD-4
; RUN: opt -mtriple=armv8a < %s -simplifycfg -S -two-entry-phi-node-folding-threshold=4 | FileCheck %s --check-prefix=ALL --check-prefix=CHECK-V8A-TWO-FOLD-4
; RUN: opt -mtriple=thumbv8m.main < %s -simplifycfg -S -two-entry-phi-node-folding-threshold=5 | FileCheck %s --check-prefix=ALL --check-prefix=CHECK-V8M-TWO-FOLD-5
; RUN: opt -mtriple=armv8a < %s -simplifycfg -S -two-entry-phi-node-folding-threshold=5 | FileCheck %s --check-prefix=ALL --check-prefix=CHECK-V8A-TWO-FOLD-5
; RUN: opt -mtriple=thumbv8m.main < %s -simplifycfg -S -two-entry-phi-node-folding-threshold=6 | FileCheck %s --check-prefix=ALL --check-prefix=CHECK-V8M-TWO-FOLD-6
; RUN: opt -mtriple=armv8a < %s -simplifycfg -S -two-entry-phi-node-folding-threshold=6 | FileCheck %s --check-prefix=ALL --check-prefix=CHECK-V8A-TWO-FOLD-6
define i32 @test_i32(i1 %a, i1 %b, i32 %i, i32 %j, i32 %k) {
; CHECK-V8M-TWO-FOLD-4-LABEL: @test_i32(
; CHECK-V8M-TWO-FOLD-4-NEXT: entry:
; CHECK-V8M-TWO-FOLD-4-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8M-TWO-FOLD-4: O:
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-4-NEXT: br label [[M]]
; CHECK-V8M-TWO-FOLD-4: M:
; CHECK-V8M-TWO-FOLD-4-NEXT: [[W:%.*]] = phi i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8M-TWO-FOLD-4-NEXT: ret i32 [[R]]
;
; CHECK-V8A-TWO-FOLD-4-LABEL: @test_i32(
; CHECK-V8A-TWO-FOLD-4-NEXT: entry:
; CHECK-V8A-TWO-FOLD-4-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8A-TWO-FOLD-4: O:
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-4-NEXT: br label [[M]]
; CHECK-V8A-TWO-FOLD-4: M:
; CHECK-V8A-TWO-FOLD-4-NEXT: [[W:%.*]] = phi i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8A-TWO-FOLD-4-NEXT: ret i32 [[R]]
;
; CHECK-V8M-TWO-FOLD-5-LABEL: @test_i32(
; CHECK-V8M-TWO-FOLD-5-NEXT: entry:
; CHECK-V8M-TWO-FOLD-5-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8M-TWO-FOLD-5: O:
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-5-NEXT: br label [[M]]
; CHECK-V8M-TWO-FOLD-5: M:
; CHECK-V8M-TWO-FOLD-5-NEXT: [[W:%.*]] = phi i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8M-TWO-FOLD-5-NEXT: ret i32 [[R]]
;
; CHECK-V8A-TWO-FOLD-5-LABEL: @test_i32(
; CHECK-V8A-TWO-FOLD-5-NEXT: entry:
; CHECK-V8A-TWO-FOLD-5-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8A-TWO-FOLD-5: O:
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-5-NEXT: br label [[M]]
; CHECK-V8A-TWO-FOLD-5: M:
; CHECK-V8A-TWO-FOLD-5-NEXT: [[W:%.*]] = phi i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8A-TWO-FOLD-5-NEXT: ret i32 [[R]]
;
; CHECK-V8M-TWO-FOLD-6-LABEL: @test_i32(
; CHECK-V8M-TWO-FOLD-6-NEXT: entry:
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[W:%.*]] = select i1 [[A:%.*]], i32 2, i32 [[WP2]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8M-TWO-FOLD-6-NEXT: ret i32 [[R]]
;
; CHECK-V8A-TWO-FOLD-6-LABEL: @test_i32(
; CHECK-V8A-TWO-FOLD-6-NEXT: entry:
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[W:%.*]] = select i1 [[A:%.*]], i32 2, i32 [[WP2]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8A-TWO-FOLD-6-NEXT: ret i32 [[R]]
;
entry:
br i1 %a, label %M, label %O
O:
br i1 %b, label %P, label %Q
P:
%iaj = add i32 %i, %j
%iajak = add i32 %iaj, %k
br label %N
Q:
%ixj = xor i32 %i, %j
%ixjxk = xor i32 %ixj, %k
br label %N
N:
%Wp = phi i32 [ %iajak, %P ], [ %ixjxk, %Q ]
%Wp2 = add i32 %Wp, %Wp
br label %M
M:
%W = phi i32 [ %Wp2, %N ], [ 2, %entry ]
%R = add i32 %W, 1
ret i32 %R
}
define i32 @test_i32_minsize(i1 %a, i1 %b, i32 %i, i32 %j, i32 %k) #0 {
; CHECK-V8M-TWO-FOLD-4-LABEL: @test_i32_minsize(
; CHECK-V8M-TWO-FOLD-4-NEXT: entry:
; CHECK-V8M-TWO-FOLD-4-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8M-TWO-FOLD-4: O:
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-4-NEXT: br label [[M]]
; CHECK-V8M-TWO-FOLD-4: M:
; CHECK-V8M-TWO-FOLD-4-NEXT: [[W:%.*]] = phi i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8M-TWO-FOLD-4-NEXT: ret i32 [[R]]
;
; CHECK-V8A-TWO-FOLD-4-LABEL: @test_i32_minsize(
; CHECK-V8A-TWO-FOLD-4-NEXT: entry:
; CHECK-V8A-TWO-FOLD-4-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8A-TWO-FOLD-4: O:
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-4-NEXT: br label [[M]]
; CHECK-V8A-TWO-FOLD-4: M:
; CHECK-V8A-TWO-FOLD-4-NEXT: [[W:%.*]] = phi i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8A-TWO-FOLD-4-NEXT: ret i32 [[R]]
;
; CHECK-V8M-TWO-FOLD-5-LABEL: @test_i32_minsize(
; CHECK-V8M-TWO-FOLD-5-NEXT: entry:
; CHECK-V8M-TWO-FOLD-5-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8M-TWO-FOLD-5: O:
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-5-NEXT: br label [[M]]
; CHECK-V8M-TWO-FOLD-5: M:
; CHECK-V8M-TWO-FOLD-5-NEXT: [[W:%.*]] = phi i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8M-TWO-FOLD-5-NEXT: ret i32 [[R]]
;
; CHECK-V8A-TWO-FOLD-5-LABEL: @test_i32_minsize(
; CHECK-V8A-TWO-FOLD-5-NEXT: entry:
; CHECK-V8A-TWO-FOLD-5-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8A-TWO-FOLD-5: O:
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-5-NEXT: br label [[M]]
; CHECK-V8A-TWO-FOLD-5: M:
; CHECK-V8A-TWO-FOLD-5-NEXT: [[W:%.*]] = phi i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8A-TWO-FOLD-5-NEXT: ret i32 [[R]]
;
; CHECK-V8M-TWO-FOLD-6-LABEL: @test_i32_minsize(
; CHECK-V8M-TWO-FOLD-6-NEXT: entry:
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[W:%.*]] = select i1 [[A:%.*]], i32 2, i32 [[WP2]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8M-TWO-FOLD-6-NEXT: ret i32 [[R]]
;
; CHECK-V8A-TWO-FOLD-6-LABEL: @test_i32_minsize(
; CHECK-V8A-TWO-FOLD-6-NEXT: entry:
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[W:%.*]] = select i1 [[A:%.*]], i32 2, i32 [[WP2]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8A-TWO-FOLD-6-NEXT: ret i32 [[R]]
;
entry:
br i1 %a, label %M, label %O
O:
br i1 %b, label %P, label %Q
P:
%iaj = add i32 %i, %j
%iajak = add i32 %iaj, %k
br label %N
Q:
%ixj = xor i32 %i, %j
%ixjxk = xor i32 %ixj, %k
br label %N
N:
%Wp = phi i32 [ %iajak, %P ], [ %ixjxk, %Q ]
%Wp2 = add i32 %Wp, %Wp
br label %M
M:
%W = phi i32 [ %Wp2, %N ], [ 2, %entry ]
%R = add i32 %W, 1
ret i32 %R
}
define i64 @test_i64(i1 %a, i1 %b, i64 %i, i64 %j, i64 %k) {
; CHECK-V8M-TWO-FOLD-4-LABEL: @test_i64(
; CHECK-V8M-TWO-FOLD-4-NEXT: entry:
; CHECK-V8M-TWO-FOLD-4-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8M-TWO-FOLD-4: O:
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-4-NEXT: br label [[M]]
; CHECK-V8M-TWO-FOLD-4: M:
; CHECK-V8M-TWO-FOLD-4-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8M-TWO-FOLD-4-NEXT: ret i64 [[R]]
;
; CHECK-V8A-TWO-FOLD-4-LABEL: @test_i64(
; CHECK-V8A-TWO-FOLD-4-NEXT: entry:
; CHECK-V8A-TWO-FOLD-4-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8A-TWO-FOLD-4: O:
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-4-NEXT: br label [[M]]
; CHECK-V8A-TWO-FOLD-4: M:
; CHECK-V8A-TWO-FOLD-4-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8A-TWO-FOLD-4-NEXT: ret i64 [[R]]
;
; CHECK-V8M-TWO-FOLD-5-LABEL: @test_i64(
; CHECK-V8M-TWO-FOLD-5-NEXT: entry:
; CHECK-V8M-TWO-FOLD-5-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8M-TWO-FOLD-5: O:
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-5-NEXT: br label [[M]]
; CHECK-V8M-TWO-FOLD-5: M:
; CHECK-V8M-TWO-FOLD-5-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8M-TWO-FOLD-5-NEXT: ret i64 [[R]]
;
; CHECK-V8A-TWO-FOLD-5-LABEL: @test_i64(
; CHECK-V8A-TWO-FOLD-5-NEXT: entry:
; CHECK-V8A-TWO-FOLD-5-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8A-TWO-FOLD-5: O:
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-5-NEXT: br label [[M]]
; CHECK-V8A-TWO-FOLD-5: M:
; CHECK-V8A-TWO-FOLD-5-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8A-TWO-FOLD-5-NEXT: ret i64 [[R]]
;
; CHECK-V8M-TWO-FOLD-6-LABEL: @test_i64(
; CHECK-V8M-TWO-FOLD-6-NEXT: entry:
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[W:%.*]] = select i1 [[A:%.*]], i64 2, i64 [[WP2]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8M-TWO-FOLD-6-NEXT: ret i64 [[R]]
;
; CHECK-V8A-TWO-FOLD-6-LABEL: @test_i64(
; CHECK-V8A-TWO-FOLD-6-NEXT: entry:
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[W:%.*]] = select i1 [[A:%.*]], i64 2, i64 [[WP2]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8A-TWO-FOLD-6-NEXT: ret i64 [[R]]
;
entry:
br i1 %a, label %M, label %O
O:
br i1 %b, label %P, label %Q
P:
%iaj = add i64 %i, %j
%iajak = add i64 %iaj, %k
br label %N
Q:
%ixj = xor i64 %i, %j
%ixjxk = xor i64 %ixj, %k
br label %N
N:
%Wp = phi i64 [ %iajak, %P ], [ %ixjxk, %Q ]
%Wp2 = add i64 %Wp, %Wp
br label %M
M:
%W = phi i64 [ %Wp2, %N ], [ 2, %entry ]
%R = add i64 %W, 1
ret i64 %R
}
define i64 @test_i64_minsize(i1 %a, i1 %b, i64 %i, i64 %j, i64 %k) #0 {
; CHECK-V8M-TWO-FOLD-4-LABEL: @test_i64_minsize(
; CHECK-V8M-TWO-FOLD-4-NEXT: entry:
; CHECK-V8M-TWO-FOLD-4-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8M-TWO-FOLD-4: O:
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-4-NEXT: br label [[M]]
; CHECK-V8M-TWO-FOLD-4: M:
; CHECK-V8M-TWO-FOLD-4-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8M-TWO-FOLD-4-NEXT: ret i64 [[R]]
;
; CHECK-V8A-TWO-FOLD-4-LABEL: @test_i64_minsize(
; CHECK-V8A-TWO-FOLD-4-NEXT: entry:
; CHECK-V8A-TWO-FOLD-4-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8A-TWO-FOLD-4: O:
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-4-NEXT: br label [[M]]
; CHECK-V8A-TWO-FOLD-4: M:
; CHECK-V8A-TWO-FOLD-4-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8A-TWO-FOLD-4-NEXT: ret i64 [[R]]
;
; CHECK-V8M-TWO-FOLD-5-LABEL: @test_i64_minsize(
; CHECK-V8M-TWO-FOLD-5-NEXT: entry:
; CHECK-V8M-TWO-FOLD-5-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8M-TWO-FOLD-5: O:
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-5-NEXT: br label [[M]]
; CHECK-V8M-TWO-FOLD-5: M:
; CHECK-V8M-TWO-FOLD-5-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8M-TWO-FOLD-5-NEXT: ret i64 [[R]]
;
; CHECK-V8A-TWO-FOLD-5-LABEL: @test_i64_minsize(
; CHECK-V8A-TWO-FOLD-5-NEXT: entry:
; CHECK-V8A-TWO-FOLD-5-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8A-TWO-FOLD-5: O:
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-5-NEXT: br label [[M]]
; CHECK-V8A-TWO-FOLD-5: M:
; CHECK-V8A-TWO-FOLD-5-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8A-TWO-FOLD-5-NEXT: ret i64 [[R]]
;
; CHECK-V8M-TWO-FOLD-6-LABEL: @test_i64_minsize(
; CHECK-V8M-TWO-FOLD-6-NEXT: entry:
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[W:%.*]] = select i1 [[A:%.*]], i64 2, i64 [[WP2]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8M-TWO-FOLD-6-NEXT: ret i64 [[R]]
;
; CHECK-V8A-TWO-FOLD-6-LABEL: @test_i64_minsize(
; CHECK-V8A-TWO-FOLD-6-NEXT: entry:
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[W:%.*]] = select i1 [[A:%.*]], i64 2, i64 [[WP2]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8A-TWO-FOLD-6-NEXT: ret i64 [[R]]
;
entry:
br i1 %a, label %M, label %O
O:
br i1 %b, label %P, label %Q
P:
%iaj = add i64 %i, %j
%iajak = add i64 %iaj, %k
br label %N
Q:
%ixj = xor i64 %i, %j
%ixjxk = xor i64 %ixj, %k
br label %N
N:
%Wp = phi i64 [ %iajak, %P ], [ %ixjxk, %Q ]
%Wp2 = add i64 %Wp, %Wp
br label %M
M:
%W = phi i64 [ %Wp2, %N ], [ 2, %entry ]
%R = add i64 %W, 1
ret i64 %R
}
attributes #0 = { minsize optsize }