Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6 |
|
#
b3cba9be |
| 12-Dec-2024 |
Mel Chen <mel.chen@sifive.com> |
[LoopVectorize] Vectorize select-cmp reduction pattern for increasing integer induction variable (#67812)
Consider the following loop:
```
int rdx = init;
for (int i = 0; i < n; ++i)
rdx
[LoopVectorize] Vectorize select-cmp reduction pattern for increasing integer induction variable (#67812)
Consider the following loop:
```
int rdx = init;
for (int i = 0; i < n; ++i)
rdx = (a[i] > b[i]) ? i : rdx;
```
We can vectorize this loop if `i` is an increasing induction variable.
The final reduced value will be the maximum of `i` that the condition
`a[i] > b[i]` is satisfied, or the start value `init`.
This patch added new RecurKind enums - IFindLastIV and FFindLastIV.
---------
Co-authored-by: Alexey Bataev <5361294+alexey-bataev@users.noreply.github.com>
show more ...
|
Revision tags: llvmorg-19.1.5 |
|
#
90f5c8b7 |
| 26-Nov-2024 |
Mel Chen <mel.chen@sifive.com> |
[LV][NFC] Auto-generate the test cases related to FindLastIV idioms. (#117560)
Pre-commit for #67812
|
Revision tags: llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2 |
|
#
ab9cd27f |
| 29-Sep-2023 |
Mel Chen <mel.chen@sifive.com> |
[LV][NFC] Move and add truncated-related FindLastIV reduction test cases. (#67674)
|
#
707686b0 |
| 28-Sep-2023 |
Mel Chen <mel.chen@sifive.com> |
[LV][NFC] Remove unnecessary parameter attributes from the test cases. (#67630)
The vectorization of the FindLastIV reduction does not depend on the
nocapture and readonly attributes.
|
#
ad415e30 |
| 25-Sep-2023 |
Ramkumar Ramachandra <Ramkumar.Ramachandra@imgtec.com> |
LoopVectorize/iv-select-cmp: comment out-of-bound tests (NFC)
To help future contributors understand a couple of mysterious out-of-bound tests, add a brief comment to each.
|
Revision tags: llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3 |
|
#
ef48e904 |
| 15-Aug-2023 |
Ramkumar Ramachandra <Ramkumar.Ramachandra@imgtec.com> |
LoopVectorize/iv-select-cmp: add test for decreasing IV out-of-bound
The most straightforward extension to D150851 would involve handling the decreasing IV case, for which tests have been added in 1
LoopVectorize/iv-select-cmp: add test for decreasing IV out-of-bound
The most straightforward extension to D150851 would involve handling the decreasing IV case, for which tests have been added in 110ec1863a (LoopVectorize/iv-select-cmp: add test for decreasing IV, const start). However, the commit missed a testcase for the out-of-bound sentinel value LONG_MAX, which should not be vectorized. Fix this by adding a test corresponding to the following program:
long test(long *a) { long rdx = 331; for (long i = LONG_MAX; i >= 0; i--) { if (a[i] > 3) rdx = i; } return rdx; }
Differential Revision: https://reviews.llvm.org/D157969
show more ...
|
Revision tags: llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init |
|
#
04b1276a |
| 24-Jul-2023 |
Ramkumar Ramachandra <Ramkumar.Ramachandra@imgtec.com> |
LoopVectorize/iv-select-cmp: add tests for truncated IV
The current tests in iv-select-cmp.ll are not representative of clang output of common real-world C programs, which are often written with i32
LoopVectorize/iv-select-cmp: add tests for truncated IV
The current tests in iv-select-cmp.ll are not representative of clang output of common real-world C programs, which are often written with i32 induction vars, as opposed to i64 induction vars. Hence, add five tests corresponding to the following programs:
int test(int *a, int n) { int rdx = 331; for (int i = 0; i < n; i++) { if (a[i] > 3) rdx = i; } return rdx; }
int test(int *a) { int rdx = 331; for (int i = 0; i < 20000; i++) { if (a[i] > 3) rdx = i; } return rdx; }
int test(int *a, long n) { int rdx = 331; for (int i = 0; i < n; i++) { if (a[i] > 3) rdx = i; } return rdx; }
int test(int *a, unsigned n) { int rdx = 331; for (int i = 0; i < n; i++) { if (a[i] > 3) rdx = i; } return rdx; }
int test(int *a) { int rdx = 331; for (long i = INT_MIN - 1; i < UINT_MAX; i++) { if (a[i] > 3) rdx = i; } return rdx; }
The first two can theoretically be vectorized without a runtime-check, while the third and fourth cannot. The fifth cannot be vectorized, even with a runtime-check.
This issue was found while reviewing D150851.
Differential Revision: https://reviews.llvm.org/D156124
show more ...
|
#
110ec186 |
| 24-Jul-2023 |
Ramkumar Ramachandra <Ramkumar.Ramachandra@imgtec.com> |
LoopVectorize/iv-select-cmp: add test for decreasing IV, const start
The most straightforward extension to D150851 would involve a loop with decreasing induction variable, with a constant start valu
LoopVectorize/iv-select-cmp: add test for decreasing IV, const start
The most straightforward extension to D150851 would involve a loop with decreasing induction variable, with a constant start value. iv-select-cmp.ll only contains a negative test for the decreasing induction variable case when the start value is variable, namely not_vectorized_select_decreasing_induction_icmp. Hence, add a test for the most straightforward extension to D150851, in preparation to vectorize:
long rdx = 331; for (long i = 19999; i >= 0; i--) { if (a[i] > 3) rdx = i; } return rdx;
Differential Revision: https://reviews.llvm.org/D156152
show more ...
|
#
4ddc1745 |
| 27-Jun-2023 |
Mel Chen <mel.chen@sifive.com> |
[LV] Add tests for select-cmp reduction pattern. (NFC)
The test cases for selecting increasing integer induction variable.
Reviewed By: fhahn, shiva0217
Differential Revision: https://reviews.llvm
[LV] Add tests for select-cmp reduction pattern. (NFC)
The test cases for selecting increasing integer induction variable.
Reviewed By: fhahn, shiva0217
Differential Revision: https://reviews.llvm.org/D153936
show more ...
|