[llvm] 335a9bc - precommit test for #65212
Nuno Lopes via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 3 08:34:25 PDT 2023
Author: Nuno Lopes
Date: 2023-09-03T16:33:57+01:00
New Revision: 335a9bc4d92436502ab8e07596a1010d632661df
URL: https://github.com/llvm/llvm-project/commit/335a9bc4d92436502ab8e07596a1010d632661df
DIFF: https://github.com/llvm/llvm-project/commit/335a9bc4d92436502ab8e07596a1010d632661df.diff
LOG: precommit test for #65212
Added:
llvm/test/Transforms/LoopVectorize/reduction-align.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/LoopVectorize/reduction-align.ll b/llvm/test/Transforms/LoopVectorize/reduction-align.ll
new file mode 100644
index 00000000000000..df5fdc65a6bd5e
--- /dev/null
+++ b/llvm/test/Transforms/LoopVectorize/reduction-align.ll
@@ -0,0 +1,46 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
+; RUN: opt < %s -passes=loop-vectorize -S | FileCheck %s
+
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @fn(ptr %hbuf, ptr %ref, i32 %height) {
+; CHECK-LABEL: define void @fn(
+; CHECK-SAME: ptr [[HBUF:%.*]], ptr [[REF:%.*]], i32 [[HEIGHT:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: store i16 0, ptr [[HBUF]], align 1
+; CHECK-NEXT: br label [[FOR_COND:%.*]]
+; CHECK: for.cond:
+; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[FOR_BODY:%.*]] ]
+; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I]], [[HEIGHT]]
+; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END:%.*]]
+; CHECK: for.body:
+; CHECK-NEXT: [[TMP0:%.*]] = load i16, ptr [[REF]], align 1
+; CHECK-NEXT: [[TMP1:%.*]] = load i16, ptr [[HBUF]], align 1
+; CHECK-NEXT: [[ADD:%.*]] = add i16 [[TMP1]], [[TMP0]]
+; CHECK-NEXT: store i16 [[ADD]], ptr [[HBUF]], align 2
+; CHECK-NEXT: [[INC]] = add i32 [[I]], 1
+; CHECK-NEXT: br label [[FOR_COND]]
+; CHECK: for.end:
+; CHECK-NEXT: ret void
+;
+entry:
+ store i16 0, ptr %hbuf, align 1
+ br label %for.cond
+
+for.cond:
+ %i = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+ %cmp = icmp slt i32 %i, %height
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body:
+ %0 = load i16, ptr %ref, align 1
+ %1 = load i16, ptr %hbuf, align 1
+ %add = add i16 %1, %0
+ store i16 %add, ptr %hbuf, align 1
+ %inc = add i32 %i, 1
+ br label %for.cond
+
+for.end:
+ ret void
+}
More information about the llvm-commits
mailing list