diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2025-04-05 17:46:47 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2025-04-05 17:55:24 -0700 |
| commit | e30cb329d81cc83a082f6919943361b8d9710509 (patch) | |
| tree | ffe0ebc7f6fc0922eb040054adc67483e3d4b572 /tests/codegen | |
| parent | 0b45675cfcec57f30a3794e1a1e18423aa9cf200 (diff) | |
| download | rust-e30cb329d81cc83a082f6919943361b8d9710509.tar.gz rust-e30cb329d81cc83a082f6919943361b8d9710509.zip | |
Polymorphize `array::IntoIter`'s iterator impl
Diffstat (limited to 'tests/codegen')
| -rw-r--r-- | tests/codegen/issues/issue-101082.rs | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/codegen/issues/issue-101082.rs b/tests/codegen/issues/issue-101082.rs index 7fb850ca253..89295da5bd1 100644 --- a/tests/codegen/issues/issue-101082.rs +++ b/tests/codegen/issues/issue-101082.rs @@ -11,7 +11,18 @@ #[no_mangle] pub fn test() -> usize { // CHECK-LABEL: @test( - // CHECK: ret {{i64|i32}} 165 + // host: ret {{i64|i32}} 165 + + // FIXME: Now that this autovectorizes via a masked load, it doesn't actually + // const-fold for certain widths. The `test_eight` case below shows that, yes, + // what we're emitting *can* be const-folded, except that the way LLVM does it + // for certain widths doesn't today. We should be able to put this back to + // the same check after <https://github.com/llvm/llvm-project/issues/134513> + // x86-64-v3: <i64 23, i64 16, i64 54, i64 3> + // x86-64-v3: llvm.masked.load + // x86-64-v3: %[[R:.+]] = {{.+}}llvm.vector.reduce.add.v4i64 + // x86-64-v3: ret i64 %[[R]] + let values = [23, 16, 54, 3, 60, 9]; let mut acc = 0; for item in values { @@ -19,3 +30,15 @@ pub fn test() -> usize { } acc } + +#[no_mangle] +pub fn test_eight() -> usize { + // CHECK-LABEL: @test_eight( + // CHECK: ret {{i64|i32}} 220 + let values = [23, 16, 54, 3, 60, 9, 13, 42]; + let mut acc = 0; + for item in values { + acc += item; + } + acc +} |
