Skip to content
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

Failure to perform extract with variable index from splat vector #50161

Closed
RKSimon opened this issue Jun 23, 2021 · 3 comments
Closed

Failure to perform extract with variable index from splat vector #50161

RKSimon opened this issue Jun 23, 2021 · 3 comments
Labels
bugzilla Issues migrated from bugzilla

Comments

@RKSimon
Copy link
Collaborator

RKSimon commented Jun 23, 2021

Bugzilla Link 50817
Resolution FIXED
Resolved on Jul 05, 2021 05:31
Version trunk
OS Windows NT
CC @rotateright
Fixed by commit(s) 3d3c0ed

Extended Description

https://c.godbolt.org/z/rq43Wqc5a

#include <x86intrin.h>

auto adjust_splat(float x, float y, int i) {
__m128 r = _mm_set1_ps(x);
r[i & 3] += y;
return r;
}
auto adjust_splat2(float x, float y, int i) {
__m128 r = _mm_set1_ps(x);
r[i & 3] = x + y;
return r;
}

If the variable-index of an extract from a splatted vector is known to be inrange, we should be safe to use the original scalar directly.

Not sure if this can be done in IR or we wait until SelectionDAG?

@rotateright
Copy link
Contributor

The splat removal should be in IR:
https://reviews.llvm.org/D104867

I'm not seeing what we want to do with the "adjust_splat2" example?

@RKSimon
Copy link
Collaborator Author

RKSimon commented Jun 24, 2021

I'm not seeing what we want to do with the "adjust_splat2" example?

adjust_splat2 was just for reference to show the possible codegen if adjust_splat managed to extract the splatted value

@rotateright
Copy link
Contributor

Fixed in IR with:
https://reviews.llvm.org/rG3d3c0ed9323b

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

2 participants