-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[ExpandVectorPredication] Expand vp.load.ff. #154440
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -465,6 +465,21 @@ CachingVPExpander::expandPredicationInMemoryIntrinsic(IRBuilder<> &Builder, | |
| VPI.getName()); | ||
| break; | ||
| } | ||
| case Intrinsic::vp_load_ff: { | ||
| // Mask out all but the first lane. | ||
| Value *NewMask = ConstantInt::getFalse(MaskParam->getType()); | ||
| NewMask = Builder.CreateInsertElement( | ||
| NewMask, ConstantInt::getTrue(MaskParam->getType()->getScalarType()), | ||
| (uint64_t)0); | ||
| NewMask = Builder.CreateAnd(MaskParam, NewMask); | ||
| Value *MaskedLoad = Builder.CreateMaskedLoad( | ||
| VPI.getType()->subtypes()[0], PtrParam, AlignOpt.valueOrOne(), NewMask); | ||
| Value *EVLResult = Builder.getInt32(1); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the returned scalar be
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original EVL has been moved to the mask by this point. The EVL this code sees will be VLMax so its always more than 1.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should instead use Sorry for being pedantic, hopefully nothing ever ends up needing to expand vp.load.ff. But it seems like we should avoid returning a scalar that's greater than the original EVL.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that would introduce the forward progress problem Philip mentioned. Maybe we need to do this expansion before the EVL rewrite?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. Or we could keep the EVL as legal for vp.load.ff in That way we have access to the original EVL in |
||
| Value *InsertValue = Builder.CreateInsertValue( | ||
| PoisonValue::get(VPI.getType()), MaskedLoad, 0); | ||
| NewMemoryInst = Builder.CreateInsertValue(InsertValue, EVLResult, 1); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| assert(NewMemoryInst); | ||
|
|
@@ -609,6 +624,7 @@ Value *CachingVPExpander::expandPredication(VPIntrinsic &VPI) { | |
| case Intrinsic::vp_store: | ||
| case Intrinsic::vp_gather: | ||
| case Intrinsic::vp_scatter: | ||
| case Intrinsic::vp_load_ff: | ||
| return expandPredicationInMemoryIntrinsic(Builder, VPI); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.