[llvm] bb07eb9 - [PowerPC]add testcase for adding store (load float*) pattern, nfc
Chen Zheng via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 17 19:59:53 PDT 2020
Author: Chen Zheng
Date: 2020-07-17T22:57:08-04:00
New Revision: bb07eb944f9b9ca7b3d8ac786c92e1f5bf59e3e1
URL: https://github.com/llvm/llvm-project/commit/bb07eb944f9b9ca7b3d8ac786c92e1f5bf59e3e1
DIFF: https://github.com/llvm/llvm-project/commit/bb07eb944f9b9ca7b3d8ac786c92e1f5bf59e3e1.diff
LOG: [PowerPC]add testcase for adding store (load float*) pattern, nfc
Added:
llvm/test/Transforms/SimplifyCFG/PowerPC/prefer-load-i32.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SimplifyCFG/PowerPC/prefer-load-i32.ll b/llvm/test/Transforms/SimplifyCFG/PowerPC/prefer-load-i32.ll
new file mode 100644
index 000000000000..943fcba57c65
--- /dev/null
+++ b/llvm/test/Transforms/SimplifyCFG/PowerPC/prefer-load-i32.ll
@@ -0,0 +1,33 @@
+; RUN: opt < %s -mtriple=powerpc64le-unknown-linux-gnu -simplifycfg -S | \
+; RUN: FileCheck %s
+
+define float @foo(float* %src, float* %dest, i32 signext %count, i32 signext %cond) {
+; CHECK-LABEL: @foo(
+; CHECK-LABEL: entry:
+; CHECK: %0 = load float, float* %arrayidx, align 4
+entry:
+ %cmp = icmp sgt i32 %cond, 10
+ %idxprom = sext i32 %count to i64
+ %arrayidx = getelementptr inbounds float, float* %src, i64 %idxprom
+ br i1 %cmp, label %if.then, label %if.else
+
+; CHECK-LABEL: if.then:
+; CHECK-NOT: load float
+if.then: ; preds = %entry
+ %0 = load float, float* %arrayidx, align 4
+ %res = fmul float %0, 3.000000e+00
+ br label %if.end
+
+; CHECK-LABEL: if.else:
+; CHECK-NOT: load float
+if.else: ; preds = %entry
+ %1 = load float, float* %arrayidx, align 4
+ %idxprom3 = sext i32 %count to i64
+ %arrayidx4 = getelementptr inbounds float, float* %dest, i64 %idxprom3
+ store float %1, float* %arrayidx4, align 4
+ br label %if.end
+
+if.end: ; preds = %if.else, %if.then
+ %res2.0 = phi float [ %res, %if.then ], [ 0.000000e+00, %if.else ]
+ ret float %res2.0
+}
More information about the llvm-commits
mailing list