[llvm] [AArch64] Add MATCH loops to LoopIdiomVectorizePass (PR #101976)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 11 05:55:47 PST 2024


================
@@ -0,0 +1,416 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -mtriple=aarch64 -mattr=+sve -passes='loop(loop-idiom-vectorize)' -verify-loop-info -verify-dom-info -S < %s | FileCheck %s
+; RUN: opt -mtriple=aarch64 -mattr=+sve -passes='loop(loop-idiom-vectorize)' -disable-loop-idiom-vectorize-find-first-byte -S < %s | FileCheck -check-prefix=DISABLE %s
+
+; Base case based on `libcxx/include/__algorithm/find_first_of.h':
+;   char* find_first_of(char *first, char *last, char *s_first, char *s_last) {
+;     for (; first != last; ++first)
+;       for (char *it = s_first; it != s_last; ++it)
+;         if (*first == *it)
----------------
david-arm wrote:

Given this can exit early before loading the rest of the needle (`*it`) you need memory checks to ensure `*it` does not cross a page boundary, similar to what we did for the mismatch expand code.

https://github.com/llvm/llvm-project/pull/101976


More information about the llvm-commits mailing list