[llvm] 1dd85e9 - [NFC] Add SimplifyCFG for ARM
Sam Parker via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 21 03:58:00 PDT 2020
Author: Sam Parker
Date: 2020-08-21T11:52:31+01:00
New Revision: 1dd85e9d0e0d655f42f6c3072bae9b8195906e36
URL: https://github.com/llvm/llvm-project/commit/1dd85e9d0e0d655f42f6c3072bae9b8195906e36
DIFF: https://github.com/llvm/llvm-project/commit/1dd85e9d0e0d655f42f6c3072bae9b8195906e36.diff
LOG: [NFC] Add SimplifyCFG for ARM
Add some phi elimination threshold testing.
Added:
llvm/test/Transforms/SimplifyCFG/ARM/phi-eliminate.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SimplifyCFG/ARM/phi-eliminate.ll b/llvm/test/Transforms/SimplifyCFG/ARM/phi-eliminate.ll
new file mode 100644
index 0000000000000..abf01d3a441e0
--- /dev/null
+++ b/llvm/test/Transforms/SimplifyCFG/ARM/phi-eliminate.ll
@@ -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 }
More information about the llvm-commits
mailing list