Skip to content

cgen: Add portable SIMD-aware lowering for hot loops - #1280

Merged
godofecht merged 5 commits into
mainfrom
fix-739-portable-simd-pragma-11619965655346489604
Oct 3, 2026
Merged

godofecht merged 5 commits into
mainfrom
fix-739-portable-simd-pragma-11619965655346489604

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Adds #pragma omp simd as a portable SIMD vectorization hint for hot loops with straight-line bodies on the C backend.

This PR targets the C generation step, wrapping the vectorization pragmas under conditional compilation macros (#if defined(_OPENMP), #elif defined(__clang__), etc.) to generate portable code that can take advantage of #pragma omp simd across compilers while still falling back to clang loop vectorize(enable) or GCC ivdep depending on the environment. Golden tests were updated accordingly.

Part of #739


PR created automatically by Jules for task 11619965655346489604 started by @godofecht

This updates the C code generator to emit `#pragma omp simd` for stepped loops
with straight-line bodies when `_OPENMP` is defined, providing a portable
compiler-independent SIMD vectorization hint before falling back to
the clang or GCC specific `#pragma clang loop vectorize` or `#pragma GCC ivdep`.

The golden tests `for_vectorize_pragma` and `for_vectorize_pragma_skip`
were updated to reflect the new output.
Bootstrap C has been regenerated and verified.

Part of #739

Co-authored-by: godofecht <[email protected]>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@godofecht
godofecht merged commit 9aff4a2 into main Oct 3, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant