[llvm] [SLP][TTI][WebAssembly] Model nonzero i8x16 OR reductions in TTI (PR #205119)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 22 09:04:14 PDT 2026
================
@@ -0,0 +1,218 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
+; RUN: opt -mtriple=wasm32 -mattr=+simd128 -passes=slp-vectorizer -S %s | FileCheck %s
+
+define i1 @or_reduction_nonzero(ptr %p) {
+; CHECK-LABEL: define i1 @or_reduction_nonzero(
+; CHECK-SAME: ptr [[P:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: [[TMP0:%.*]] = load <16 x i8>, ptr [[P]], align 1
+; CHECK-NEXT: [[TMP1:%.*]] = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> [[TMP0]])
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne i8 [[TMP1]], 0
----------------
alexey-bataev wrote:
I think we just need to change SLP reduction to make it to estimate/generate a vector comparison here instead of a scalar, without changes in TTY. Just recognize the pattern and generate a vector comparison, it should be faster for all targets
https://github.com/llvm/llvm-project/pull/205119
More information about the llvm-commits
mailing list