Skip to content

[PowerPC] Optimize BUILD_VECTOR from load and zeros #73609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

bzEq
Copy link
Collaborator

@bzEq bzEq commented Nov 28, 2023

We are encountered with patterns like BUILD_VECTOR 0, 0, (load), 0 resulted in suboptimal codegen. This PR improves it.

@bzEq bzEq self-assigned this Nov 28, 2023
@bzEq bzEq marked this pull request as draft November 28, 2023 04:30
@bzEq bzEq changed the title [PowerPC] Optimize BUILD_VECTOR from extload and zeros [PowerPC] Optimize BUILD_VECTOR from load and zeros Nov 28, 2023
@@ -3437,6 +3437,12 @@ def : Pat<(store (i32 (extractelt v4i32:$A, 1)), ForceXForm:$src),
def : Pat<(store (f32 (extractelt v4f32:$A, 1)), ForceXForm:$src),
(STIWX (EXTRACT_SUBREG $A, sub_64), ForceXForm:$src)>;

// BUILD_VECTOR via loads and zeros.
def : Pat<(v2f64 (build_vector (f64 (extloadf32 ForceXForm:$src)), (f64 fpimm0))),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not have an opportunity to also improve the following:

  • Non-extending load
  • Single precision and i32 (other elements are zeros)
  • Zero is at a different index
  • Little endian

bzEq pushed a commit that referenced this pull request Nov 30, 2023
@bzEq bzEq marked this pull request as ready for review November 30, 2023 05:11
@bzEq bzEq requested a review from nemanjai November 30, 2023 05:12
(v2i64 (COPY_TO_REGCLASS (LXSDX ForceXForm:$src), VSRC))>;
def : Pat<(v2i64 BVLoadAndZerosLong<0>.DAG),
(v2i64 (XXPERMDIs
(COPY_TO_REGCLASS (LXSDX ForceXForm:$src), VSRC), 2))>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use multiclass / defm to simplify the definitions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried, however looks not simplified much(Maybe I was using a different approach than what's in your mind).

@bzEq
Copy link
Collaborator Author

bzEq commented Apr 13, 2024

Ping.

@kamaub
Copy link
Contributor

kamaub commented Feb 10, 2025

Take over this patch to get it through reviews and commited in #126599, closing this PR.

@kamaub kamaub closed this Feb 10, 2025
@bzEq bzEq deleted the use-lxsspx branch February 16, 2025 06:38
@bzEq bzEq restored the use-lxsspx branch February 16, 2025 06:38
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.

4 participants