-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[RISCV] Rewrite vrgather.vx undef, (vmv.s.x), 0, v0 as vmv.v.x #136010
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 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 |
|---|---|---|
|
|
@@ -96,13 +96,11 @@ define <8 x float> @vmerge_vxm(<8 x float> %v, float %s) { | |
| ; CHECK-LABEL: vmerge_vxm: | ||
| ; CHECK: # %bb.0: | ||
| ; CHECK-NEXT: li a0, 25 | ||
| ; CHECK-NEXT: vsetivli zero, 8, e32, m1, tu, ma | ||
| ; CHECK-NEXT: vfmv.s.f v8, fa0 | ||
| ; CHECK-NEXT: vsetivli zero, 1, e32, m4, tu, ma | ||
| ; CHECK-NEXT: vmv.s.x v0, a0 | ||
| ; CHECK-NEXT: vmv2r.v v10, v8 | ||
| ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, mu | ||
| ; CHECK-NEXT: vrgather.vi v10, v8, 0, v0.t | ||
| ; CHECK-NEXT: vmv.v.v v8, v10 | ||
| ; CHECK-NEXT: vfmv.s.f v8, fa0 | ||
|
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. Note that this vfmv.s.f could be eliminated if we rewrote the mask on the vmerge. I don't plan to do this, just noting it's vaguely possible. I'm mildly of the opinion that this approach (the post lowering DAG) has been pushed as far as we should, and that if we want to further improve, we should instead starting canonicalizing shuffles before lowering. I may change my mind based on what future cases I stumble into. :) |
||
| ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma | ||
| ; CHECK-NEXT: vfmerge.vfm v8, v8, fa0, v0 | ||
| ; CHECK-NEXT: ret | ||
| %ins = insertelement <8 x float> %v, float %s, i32 0 | ||
| %shuf = shufflevector <8 x float> %ins, <8 x float> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 0, i32 0, i32 5, i32 6, i32 7> | ||
|
|
@@ -112,15 +110,10 @@ define <8 x float> @vmerge_vxm(<8 x float> %v, float %s) { | |
| define <8 x float> @vmerge_vxm2(<8 x float> %v, float %s) { | ||
| ; CHECK-LABEL: vmerge_vxm2: | ||
| ; CHECK: # %bb.0: | ||
| ; CHECK-NEXT: vsetivli zero, 1, e32, m4, tu, ma | ||
| ; CHECK-NEXT: vmv1r.v v12, v8 | ||
| ; CHECK-NEXT: vmv2r.v v10, v8 | ||
| ; CHECK-NEXT: li a0, 25 | ||
| ; CHECK-NEXT: vfmv.s.f v12, fa0 | ||
| ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma | ||
| ; CHECK-NEXT: vmv.s.x v0, a0 | ||
| ; CHECK-NEXT: vmv1r.v v10, v12 | ||
| ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, mu | ||
| ; CHECK-NEXT: vrgather.vi v8, v10, 0, v0.t | ||
| ; CHECK-NEXT: vfmerge.vfm v8, v8, fa0, v0 | ||
| ; CHECK-NEXT: ret | ||
| %ins = insertelement <8 x float> %v, float %s, i32 0 | ||
| %shuf = shufflevector <8 x float> %v, <8 x float> %ins, <8 x i32> <i32 8, i32 1, i32 2, i32 8, i32 8, i32 5, i32 6, i32 7> | ||
|
|
||
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.
The choice of m4 here is very odd, but not really related to this change. This is happening in InsertVSETVLI because the LMUL isn't really demanded, but starts at m1, the original SEW of the vmv.s.x is e8, and we decide to adjust the input to preserve the SEW/LMUL ratio. I don't believe this actually matters, it just creates an odd looking diff.