-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[InstCombine] Let shrinkSplatShuffle act on vectors of different lengths #148593
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
Changes from 1 commit
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 |
|---|---|---|
|
|
@@ -960,8 +960,8 @@ define <3 x i31> @wide_splat3(<3 x i33> %x) { | |
|
|
||
| define <8 x i8> @wide_lengthening_splat(<4 x i16> %v) { | ||
| ; CHECK-LABEL: @wide_lengthening_splat( | ||
| ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <4 x i16> [[V:%.*]], <4 x i16> poison, <8 x i32> zeroinitializer | ||
| ; CHECK-NEXT: [[TR:%.*]] = trunc <8 x i16> [[SHUF]] to <8 x i8> | ||
| ; CHECK-NEXT: [[TMP1:%.*]] = trunc <4 x i16> [[V:%.*]] to <4 x i8> | ||
| ; CHECK-NEXT: [[TR:%.*]] = shufflevector <4 x i8> [[TMP1]], <4 x i8> poison, <8 x i32> zeroinitializer | ||
|
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. Also test shortening splat? I think in that case the profitability is less clear.
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 I think we want to restrict it to only when Shuf->getOperand(0) is shorter than Shuf?
Contributor
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 don't understand why it wouldn't be profitable in that case, could you please elaborate? Also added test
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. We're now performing trunc on a wider type than before, and that can be slower on some targets. E.g. a <8 x i16> trunc may take twice as many uops as a <4 x i16> trunc. There is definitely at least hardware on RISC-V where this is the case.
Contributor
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. Thanks! changed |
||
| ; CHECK-NEXT: ret <8 x i8> [[TR]] | ||
| ; | ||
| %shuf = shufflevector <4 x i16> %v, <4 x i16> %v, <8 x i32> zeroinitializer | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is
Shuf->getOperand(0)->getType()->getWithNewType(Trunc.getType()->getScalarType())?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, done