[llvm] cc65da0 - [LV] Update fmax tests to include ogt/olt/ole/ugt predicates.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 13 04:17:38 PDT 2025
Author: Florian Hahn
Date: 2025-07-13T12:16:54+01:00
New Revision: cc65da0fb115b9029c94f278d5e8f1a3b64f41e1
URL: https://github.com/llvm/llvm-project/commit/cc65da0fb115b9029c94f278d5e8f1a3b64f41e1
DIFF: https://github.com/llvm/llvm-project/commit/cc65da0fb115b9029c94f278d5e8f1a3b64f41e1.diff
LOG: [LV] Update fmax tests to include ogt/olt/ole/ugt predicates.
Adjust and update tests as per feedback in
https://github.com/llvm/llvm-project/pull/146711.
Added:
Modified:
llvm/test/Transforms/LoopVectorize/AArch64/fmax-without-fast-math-flags.ll
llvm/test/Transforms/LoopVectorize/fmax-without-fast-math-flags-interleave.ll
llvm/test/Transforms/LoopVectorize/fmax-without-fast-math-flags.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/fmax-without-fast-math-flags.ll b/llvm/test/Transforms/LoopVectorize/AArch64/fmax-without-fast-math-flags.ll
index 77b40dabae1e1..451574a258c2b 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/fmax-without-fast-math-flags.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/fmax-without-fast-math-flags.ll
@@ -1,8 +1,8 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals none --version 5
; RUN: opt -p loop-vectorize -mtriple=arm64-apple-macosx -S %s | FileCheck %s
-define float @fmax_ugt_with_select(ptr %src, i64 %n) {
-; CHECK-LABEL: define float @fmax_ugt_with_select(
+define float @fmax_ogt_with_select(ptr %src, i64 %n) {
+; CHECK-LABEL: define float @fmax_ogt_with_select(
; CHECK-SAME: ptr [[SRC:%.*]], i64 [[N:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*]]:
; CHECK-NEXT: br label %[[LOOP:.*]]
@@ -11,7 +11,7 @@ define float @fmax_ugt_with_select(ptr %src, i64 %n) {
; CHECK-NEXT: [[MAX:%.*]] = phi float [ -1.000000e+07, %[[ENTRY]] ], [ [[MAX_NEXT:%.*]], %[[LOOP]] ]
; CHECK-NEXT: [[GEP_SRC:%.*]] = getelementptr inbounds nuw float, ptr [[SRC]], i64 [[IV]]
; CHECK-NEXT: [[L:%.*]] = load float, ptr [[GEP_SRC]], align 4
-; CHECK-NEXT: [[CMP:%.*]] = fcmp ugt float [[L]], [[MAX]]
+; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt float [[L]], [[MAX]]
; CHECK-NEXT: [[MAX_NEXT]] = select i1 [[CMP]], float [[L]], float [[MAX]]
; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
; CHECK-NEXT: [[EC:%.*]] = icmp eq i64 [[IV_NEXT]], [[N]]
@@ -28,7 +28,7 @@ loop:
%max = phi float [ -1.000000e+07, %entry ], [ %max.next, %loop ]
%gep.src = getelementptr inbounds nuw float, ptr %src, i64 %iv
%l = load float, ptr %gep.src, align 4
- %cmp = fcmp ugt float %l, %max
+ %cmp = fcmp ogt float %l, %max
%max.next = select i1 %cmp, float %l, float %max
%iv.next = add nuw nsw i64 %iv, 1
%ec = icmp eq i64 %iv.next, %n
diff --git a/llvm/test/Transforms/LoopVectorize/fmax-without-fast-math-flags-interleave.ll b/llvm/test/Transforms/LoopVectorize/fmax-without-fast-math-flags-interleave.ll
index fb68d4cbd9e4b..b2e080fef2e57 100644
--- a/llvm/test/Transforms/LoopVectorize/fmax-without-fast-math-flags-interleave.ll
+++ b/llvm/test/Transforms/LoopVectorize/fmax-without-fast-math-flags-interleave.ll
@@ -1,8 +1,8 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals none --version 5
; RUN: opt -p loop-vectorize -force-vector-width=4 -force-vector-interleave=2 -S %s | FileCheck %s
-define float @fmax_ugt_with_select(ptr %src, i64 %n) {
-; CHECK-LABEL: define float @fmax_ugt_with_select(
+define float @fmax_ogt_with_select(ptr %src, i64 %n) {
+; CHECK-LABEL: define float @fmax_ogt_with_select(
; CHECK-SAME: ptr [[SRC:%.*]], i64 [[N:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*]]:
; CHECK-NEXT: br label %[[LOOP:.*]]
@@ -11,7 +11,7 @@ define float @fmax_ugt_with_select(ptr %src, i64 %n) {
; CHECK-NEXT: [[MAX:%.*]] = phi float [ -1.000000e+07, %[[ENTRY]] ], [ [[MAX_NEXT:%.*]], %[[LOOP]] ]
; CHECK-NEXT: [[GEP_SRC:%.*]] = getelementptr inbounds nuw float, ptr [[SRC]], i64 [[IV]]
; CHECK-NEXT: [[L:%.*]] = load float, ptr [[GEP_SRC]], align 4
-; CHECK-NEXT: [[CMP:%.*]] = fcmp ugt float [[L]], [[MAX]]
+; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt float [[L]], [[MAX]]
; CHECK-NEXT: [[MAX_NEXT]] = select i1 [[CMP]], float [[L]], float [[MAX]]
; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
; CHECK-NEXT: [[EC:%.*]] = icmp eq i64 [[IV_NEXT]], [[N]]
@@ -28,7 +28,7 @@ loop:
%max = phi float [ -1.000000e+07, %entry ], [ %max.next, %loop ]
%gep.src = getelementptr inbounds nuw float, ptr %src, i64 %iv
%l = load float, ptr %gep.src, align 4
- %cmp = fcmp ugt float %l, %max
+ %cmp = fcmp ogt float %l, %max
%max.next = select i1 %cmp, float %l, float %max
%iv.next = add nuw nsw i64 %iv, 1
%ec = icmp eq i64 %iv.next, %n
diff --git a/llvm/test/Transforms/LoopVectorize/fmax-without-fast-math-flags.ll b/llvm/test/Transforms/LoopVectorize/fmax-without-fast-math-flags.ll
index 3a8ef7e0b08c0..5661406b88a5a 100644
--- a/llvm/test/Transforms/LoopVectorize/fmax-without-fast-math-flags.ll
+++ b/llvm/test/Transforms/LoopVectorize/fmax-without-fast-math-flags.ll
@@ -1,8 +1,8 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals none --version 5
; RUN: opt -p loop-vectorize -force-vector-width=4 -force-vector-interleave=1 -S %s | FileCheck %s
-define float @fmax_ugt_with_select_1(ptr %src, i64 %n) {
-; CHECK-LABEL: define float @fmax_ugt_with_select_1(
+define float @fmax_ogt_with_select_1(ptr %src, i64 %n) {
+; CHECK-LABEL: define float @fmax_ogt_with_select_1(
; CHECK-SAME: ptr [[SRC:%.*]], i64 [[N:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*]]:
; CHECK-NEXT: br label %[[LOOP:.*]]
@@ -11,7 +11,7 @@ define float @fmax_ugt_with_select_1(ptr %src, i64 %n) {
; CHECK-NEXT: [[MAX:%.*]] = phi float [ -1.000000e+07, %[[ENTRY]] ], [ [[MAX_NEXT:%.*]], %[[LOOP]] ]
; CHECK-NEXT: [[GEP_SRC:%.*]] = getelementptr inbounds nuw float, ptr [[SRC]], i64 [[IV]]
; CHECK-NEXT: [[L:%.*]] = load float, ptr [[GEP_SRC]], align 4
-; CHECK-NEXT: [[CMP:%.*]] = fcmp ugt float [[L]], [[MAX]]
+; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt float [[L]], [[MAX]]
; CHECK-NEXT: [[MAX_NEXT]] = select i1 [[CMP]], float [[L]], float [[MAX]]
; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
; CHECK-NEXT: [[EC:%.*]] = icmp eq i64 [[IV_NEXT]], [[N]]
@@ -28,7 +28,7 @@ loop:
%max = phi float [ -1.000000e+07, %entry ], [ %max.next, %loop ]
%gep.src = getelementptr inbounds nuw float, ptr %src, i64 %iv
%l = load float, ptr %gep.src, align 4
- %cmp = fcmp ugt float %l, %max
+ %cmp = fcmp ogt float %l, %max
%max.next = select i1 %cmp, float %l, float %max
%iv.next = add nuw nsw i64 %iv, 1
%ec = icmp eq i64 %iv.next, %n
@@ -38,8 +38,8 @@ exit:
ret float %max.next
}
-define float @fmax_ugt_with_select_2(ptr %src, i64 %n) {
-; CHECK-LABEL: define float @fmax_ugt_with_select_2(
+define float @fmax_ogt_with_select_2(ptr %src, i64 %n) {
+; CHECK-LABEL: define float @fmax_ogt_with_select_2(
; CHECK-SAME: ptr [[SRC:%.*]], i64 [[N:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*]]:
; CHECK-NEXT: br label %[[LOOP:.*]]
@@ -48,7 +48,7 @@ define float @fmax_ugt_with_select_2(ptr %src, i64 %n) {
; CHECK-NEXT: [[MAX:%.*]] = phi float [ -1.000000e+07, %[[ENTRY]] ], [ [[MAX_NEXT:%.*]], %[[LOOP]] ]
; CHECK-NEXT: [[GEP_SRC:%.*]] = getelementptr inbounds nuw float, ptr [[SRC]], i64 [[IV]]
; CHECK-NEXT: [[L:%.*]] = load float, ptr [[GEP_SRC]], align 4
-; CHECK-NEXT: [[CMP:%.*]] = fcmp ugt float [[MAX]], [[L]]
+; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt float [[MAX]], [[L]]
; CHECK-NEXT: [[MAX_NEXT]] = select i1 [[CMP]], float [[MAX]], float [[L]]
; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
; CHECK-NEXT: [[EC:%.*]] = icmp eq i64 [[IV_NEXT]], [[N]]
@@ -65,7 +65,7 @@ loop:
%max = phi float [ -1.000000e+07, %entry ], [ %max.next, %loop ]
%gep.src = getelementptr inbounds nuw float, ptr %src, i64 %iv
%l = load float, ptr %gep.src, align 4
- %cmp = fcmp ugt float %max, %l
+ %cmp = fcmp ogt float %max, %l
%max.next = select i1 %cmp, float %max, float %l
%iv.next = add nuw nsw i64 %iv, 1
%ec = icmp eq i64 %iv.next, %n
@@ -75,8 +75,8 @@ exit:
ret float %max.next
}
-define float @fmax_ogt_with_select_1(ptr %src, i64 %n) {
-; CHECK-LABEL: define float @fmax_ogt_with_select_1(
+define float @fmax_olt_with_select_1(ptr %src, i64 %n) {
+; CHECK-LABEL: define float @fmax_olt_with_select_1(
; CHECK-SAME: ptr [[SRC:%.*]], i64 [[N:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*]]:
; CHECK-NEXT: br label %[[LOOP:.*]]
@@ -85,8 +85,8 @@ define float @fmax_ogt_with_select_1(ptr %src, i64 %n) {
; CHECK-NEXT: [[MAX:%.*]] = phi float [ -1.000000e+07, %[[ENTRY]] ], [ [[MAX_NEXT:%.*]], %[[LOOP]] ]
; CHECK-NEXT: [[GEP_SRC:%.*]] = getelementptr inbounds nuw float, ptr [[SRC]], i64 [[IV]]
; CHECK-NEXT: [[L:%.*]] = load float, ptr [[GEP_SRC]], align 4
-; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt float [[L]], [[MAX]]
-; CHECK-NEXT: [[MAX_NEXT]] = select i1 [[CMP]], float [[L]], float [[MAX]]
+; CHECK-NEXT: [[CMP:%.*]] = fcmp olt float [[L]], [[MAX]]
+; CHECK-NEXT: [[MAX_NEXT]] = select i1 [[CMP]], float [[MAX]], float [[L]]
; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
; CHECK-NEXT: [[EC:%.*]] = icmp eq i64 [[IV_NEXT]], [[N]]
; CHECK-NEXT: br i1 [[EC]], label %[[EXIT:.*]], label %[[LOOP]]
@@ -102,8 +102,8 @@ loop:
%max = phi float [ -1.000000e+07, %entry ], [ %max.next, %loop ]
%gep.src = getelementptr inbounds nuw float, ptr %src, i64 %iv
%l = load float, ptr %gep.src, align 4
- %cmp = fcmp ogt float %l, %max
- %max.next = select i1 %cmp, float %l, float %max
+ %cmp = fcmp olt float %l, %max
+ %max.next = select i1 %cmp, float %max, float %l
%iv.next = add nuw nsw i64 %iv, 1
%ec = icmp eq i64 %iv.next, %n
br i1 %ec, label %exit, label %loop
@@ -112,8 +112,8 @@ exit:
ret float %max.next
}
-define float @fmax_ogt_with_select_2(ptr %src, i64 %n) {
-; CHECK-LABEL: define float @fmax_ogt_with_select_2(
+define float @fmax_olt_with_select_2(ptr %src, i64 %n) {
+; CHECK-LABEL: define float @fmax_olt_with_select_2(
; CHECK-SAME: ptr [[SRC:%.*]], i64 [[N:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*]]:
; CHECK-NEXT: br label %[[LOOP:.*]]
@@ -122,8 +122,8 @@ define float @fmax_ogt_with_select_2(ptr %src, i64 %n) {
; CHECK-NEXT: [[MAX:%.*]] = phi float [ -1.000000e+07, %[[ENTRY]] ], [ [[MAX_NEXT:%.*]], %[[LOOP]] ]
; CHECK-NEXT: [[GEP_SRC:%.*]] = getelementptr inbounds nuw float, ptr [[SRC]], i64 [[IV]]
; CHECK-NEXT: [[L:%.*]] = load float, ptr [[GEP_SRC]], align 4
-; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt float [[MAX]], [[L]]
-; CHECK-NEXT: [[MAX_NEXT]] = select i1 [[CMP]], float [[MAX]], float [[L]]
+; CHECK-NEXT: [[CMP:%.*]] = fcmp olt float [[MAX]], [[L]]
+; CHECK-NEXT: [[MAX_NEXT]] = select i1 [[CMP]], float [[L]], float [[MAX]]
; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
; CHECK-NEXT: [[EC:%.*]] = icmp eq i64 [[IV_NEXT]], [[N]]
; CHECK-NEXT: br i1 [[EC]], label %[[EXIT:.*]], label %[[LOOP]]
@@ -139,8 +139,8 @@ loop:
%max = phi float [ -1.000000e+07, %entry ], [ %max.next, %loop ]
%gep.src = getelementptr inbounds nuw float, ptr %src, i64 %iv
%l = load float, ptr %gep.src, align 4
- %cmp = fcmp ogt float %max, %l
- %max.next = select i1 %cmp, float %max, float %l
+ %cmp = fcmp olt float %max, %l
+ %max.next = select i1 %cmp, float %l, float %max
%iv.next = add nuw nsw i64 %iv, 1
%ec = icmp eq i64 %iv.next, %n
br i1 %ec, label %exit, label %loop
@@ -149,8 +149,8 @@ exit:
ret float %max.next
}
-define float @fmax_ugt_with_select_store_result(ptr %src, ptr %dst, i64 %n) {
-; CHECK-LABEL: define float @fmax_ugt_with_select_store_result(
+define float @fmax_ogt_with_select_store_result(ptr %src, ptr %dst, i64 %n) {
+; CHECK-LABEL: define float @fmax_ogt_with_select_store_result(
; CHECK-SAME: ptr [[SRC:%.*]], ptr [[DST:%.*]], i64 [[N:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*]]:
; CHECK-NEXT: br label %[[LOOP:.*]]
@@ -159,7 +159,7 @@ define float @fmax_ugt_with_select_store_result(ptr %src, ptr %dst, i64 %n) {
; CHECK-NEXT: [[MAX:%.*]] = phi float [ -1.000000e+07, %[[ENTRY]] ], [ [[MAX_NEXT:%.*]], %[[LOOP]] ]
; CHECK-NEXT: [[GEP_SRC:%.*]] = getelementptr inbounds nuw float, ptr [[SRC]], i64 [[IV]]
; CHECK-NEXT: [[L:%.*]] = load float, ptr [[GEP_SRC]], align 4
-; CHECK-NEXT: [[CMP:%.*]] = fcmp ugt float [[L]], [[MAX]]
+; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt float [[L]], [[MAX]]
; CHECK-NEXT: [[MAX_NEXT]] = select i1 [[CMP]], float [[L]], float [[MAX]]
; CHECK-NEXT: store float [[MAX_NEXT]], ptr [[DST]], align 8
; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
@@ -177,7 +177,7 @@ loop:
%max = phi float [ -1.000000e+07, %entry ], [ %max.next, %loop ]
%gep.src = getelementptr inbounds nuw float, ptr %src, i64 %iv
%l = load float, ptr %gep.src, align 4
- %cmp = fcmp ugt float %l, %max
+ %cmp = fcmp ogt float %l, %max
%max.next = select i1 %cmp, float %l, float %max
store float %max.next, ptr %dst, align 8
%iv.next = add nuw nsw i64 %iv, 1
@@ -323,7 +323,7 @@ define float @fmax_with_select_and_load_store(ptr %src, ptr noalias %dst, i64 %n
; CHECK-NEXT: [[MAX:%.*]] = phi float [ -1.000000e+07, %[[ENTRY]] ], [ [[MAX_NEXT:%.*]], %[[LOOP]] ]
; CHECK-NEXT: [[GEP_SRC:%.*]] = getelementptr inbounds nuw float, ptr [[SRC]], i64 [[IV]]
; CHECK-NEXT: [[L:%.*]] = load float, ptr [[GEP_SRC]], align 4
-; CHECK-NEXT: [[CMP:%.*]] = fcmp ugt float [[L]], [[MAX]]
+; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt float [[L]], [[MAX]]
; CHECK-NEXT: [[IV_1:%.*]] = add i64 [[IV]], 1
; CHECK-NEXT: [[GEP_DST_1:%.*]] = getelementptr inbounds i32, ptr [[DST]], i64 [[IV_1]]
; CHECK-NEXT: [[L_2:%.*]] = load i32, ptr [[GEP_DST_1]], align 4
@@ -345,7 +345,7 @@ loop:
%max = phi float [ -1.000000e+07, %entry ], [ %max.next, %loop ]
%gep.src = getelementptr inbounds nuw float, ptr %src, i64 %iv
%l = load float, ptr %gep.src, align 4
- %cmp = fcmp ugt float %l, %max
+ %cmp = fcmp ogt float %l, %max
%iv.1 = add i64 %iv, 1
%gep.dst.1 = getelementptr inbounds i32, ptr %dst, i64 %iv.1
%l.2 = load i32, ptr %gep.dst.1
@@ -359,3 +359,77 @@ loop:
exit:
ret float %max.next
}
+
+define float @fmax_ugt_with_select_1(ptr %src, i64 %n) {
+; CHECK-LABEL: define float @fmax_ugt_with_select_1(
+; CHECK-SAME: ptr [[SRC:%.*]], i64 [[N:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: br label %[[LOOP:.*]]
+; CHECK: [[LOOP]]:
+; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[IV_NEXT:%.*]], %[[LOOP]] ]
+; CHECK-NEXT: [[MAX:%.*]] = phi float [ -1.000000e+07, %[[ENTRY]] ], [ [[MAX_NEXT:%.*]], %[[LOOP]] ]
+; CHECK-NEXT: [[GEP_SRC:%.*]] = getelementptr inbounds nuw float, ptr [[SRC]], i64 [[IV]]
+; CHECK-NEXT: [[L:%.*]] = load float, ptr [[GEP_SRC]], align 4
+; CHECK-NEXT: [[CMP:%.*]] = fcmp ugt float [[L]], [[MAX]]
+; CHECK-NEXT: [[MAX_NEXT]] = select i1 [[CMP]], float [[L]], float [[MAX]]
+; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
+; CHECK-NEXT: [[EC:%.*]] = icmp eq i64 [[IV_NEXT]], [[N]]
+; CHECK-NEXT: br i1 [[EC]], label %[[EXIT:.*]], label %[[LOOP]]
+; CHECK: [[EXIT]]:
+; CHECK-NEXT: [[MAX_NEXT_LCSSA:%.*]] = phi float [ [[MAX_NEXT]], %[[LOOP]] ]
+; CHECK-NEXT: ret float [[MAX_NEXT_LCSSA]]
+;
+entry:
+ br label %loop
+
+loop:
+ %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
+ %max = phi float [ -1.000000e+07, %entry ], [ %max.next, %loop ]
+ %gep.src = getelementptr inbounds nuw float, ptr %src, i64 %iv
+ %l = load float, ptr %gep.src, align 4
+ %cmp = fcmp ugt float %l, %max
+ %max.next = select i1 %cmp, float %l, float %max
+ %iv.next = add nuw nsw i64 %iv, 1
+ %ec = icmp eq i64 %iv.next, %n
+ br i1 %ec, label %exit, label %loop
+
+exit:
+ ret float %max.next
+}
+
+define float @fmax_oge_with_select_1(ptr %src, i64 %n) {
+; CHECK-LABEL: define float @fmax_oge_with_select_1(
+; CHECK-SAME: ptr [[SRC:%.*]], i64 [[N:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: br label %[[LOOP:.*]]
+; CHECK: [[LOOP]]:
+; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[IV_NEXT:%.*]], %[[LOOP]] ]
+; CHECK-NEXT: [[MAX:%.*]] = phi float [ -1.000000e+07, %[[ENTRY]] ], [ [[MAX_NEXT:%.*]], %[[LOOP]] ]
+; CHECK-NEXT: [[GEP_SRC:%.*]] = getelementptr inbounds nuw float, ptr [[SRC]], i64 [[IV]]
+; CHECK-NEXT: [[L:%.*]] = load float, ptr [[GEP_SRC]], align 4
+; CHECK-NEXT: [[CMP:%.*]] = fcmp oge float [[L]], [[MAX]]
+; CHECK-NEXT: [[MAX_NEXT]] = select i1 [[CMP]], float [[L]], float [[MAX]]
+; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
+; CHECK-NEXT: [[EC:%.*]] = icmp eq i64 [[IV_NEXT]], [[N]]
+; CHECK-NEXT: br i1 [[EC]], label %[[EXIT:.*]], label %[[LOOP]]
+; CHECK: [[EXIT]]:
+; CHECK-NEXT: [[MAX_NEXT_LCSSA:%.*]] = phi float [ [[MAX_NEXT]], %[[LOOP]] ]
+; CHECK-NEXT: ret float [[MAX_NEXT_LCSSA]]
+;
+entry:
+ br label %loop
+
+loop:
+ %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
+ %max = phi float [ -1.000000e+07, %entry ], [ %max.next, %loop ]
+ %gep.src = getelementptr inbounds nuw float, ptr %src, i64 %iv
+ %l = load float, ptr %gep.src, align 4
+ %cmp = fcmp oge float %l, %max
+ %max.next = select i1 %cmp, float %l, float %max
+ %iv.next = add nuw nsw i64 %iv, 1
+ %ec = icmp eq i64 %iv.next, %n
+ br i1 %ec, label %exit, label %loop
+
+exit:
+ ret float %max.next
+}
More information about the llvm-commits
mailing list