Skip to content

Conversation

@folkertdev
Copy link
Contributor

@folkertdev folkertdev commented Jan 30, 2026

fixes #97804

It appears that this issue was fixed silently in LLVM 19. The original codegen was terrible, but starting at LLVM 19 opt is able to generate good code.

https://llvm.godbolt.org/z/5vq8scP6q

cc @programmerjake

@folkertdev folkertdev added the A-SIMD Area: SIMD (Single Instruction Multiple Data) label Jan 30, 2026
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 30, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 30, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@folkertdev
Copy link
Contributor Author

folkertdev commented Jan 30, 2026

Hmm, it is fixed on x86_64 and aarch64, but not for other targets where vector types require a target feature.

  • for s390x it only optimizes when the vector target feature is available
  • for wasm32 even with +simd128 it does not optimize (should just be a splat I think?)

Do we consider that fixed?

@folkertdev
Copy link
Contributor Author

I did file llvm/llvm-project#178940 for the wasm issue, cc @nikic

@workingjubilee
Copy link
Member

workingjubilee commented Jan 30, 2026

For s390x without +vector, it probably comes from type legalization: LLVM, if it can't fit a type or operation with that type to a series of machine operations, will, during... lowering to SelectionDAG, I think?... "scalarize" the operations into operations on a valid type.

@folkertdev
Copy link
Contributor Author

I'm a bit out of my depth here, but I would expect the transformation to a vector splat to happen much earlier than that. You're right that it does appear use information about what types are legal for the current target though.

@workingjubilee
Copy link
Member

I think this is fine to merge if the test gets qualified with the appropriate architectures or whatever.

@Mark-Simulacrum
Copy link
Member

@rustbot author

Yeah, with appropriate ignore-X added seems OK to approve, though we should probably leave the issue open in that case?

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 1, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 1, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-SIMD Area: SIMD (Single Instruction Multiple Data) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Array Repeat operator should not use a loop for small sizes

6 participants