-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[RISCV][VLOPT] Added support for vmv.s.x and vfmv.s.f #149562
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 5 commits
2b54de9
a703c3b
54b5107
01b806b
f6add81
f3c0432
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 |
---|---|---|
|
@@ -7,13 +7,14 @@ define i32 @test(ptr %a, i64 %n) { | |
; CHECK-LABEL: test: | ||
; CHECK: # %bb.0: # %entry | ||
; CHECK-NEXT: li a3, 0 | ||
; CHECK-NEXT: vsetvli a2, zero, e32, m1, ta, ma | ||
; CHECK-NEXT: vsetivli zero, 1, e32, m1, ta, ma | ||
; CHECK-NEXT: vmv.s.x v8, zero | ||
; CHECK-NEXT: .LBB0_1: # %loop | ||
; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 | ||
; CHECK-NEXT: vl1re32.v v9, (a0) | ||
; CHECK-NEXT: mv a2, a3 | ||
; CHECK-NEXT: addi a1, a1, -1 | ||
; CHECK-NEXT: vsetvli a3, zero, e32, m1, ta, ma | ||
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. An extra vsetvli is being created here 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. Looking at the code for this example, this looks to be an inloop reduction which should be super rare in practice. For vadd, we really should be doing an out of loop reduction instead. One thing that's worth investigating (but not blocking this review) is why for this case the extra vsetvli isn't being PREd into the loop header. If it was, even in this case the extra toggle would be loop invariant (and I think our backwards walk would kill the toggle anyways.). 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. IIUC, doPRE doesn't handle the loop we see in this program, so it bails. I'm writing a patch to change that, and removing the WIP from this PR, as changing doPRE is out of the scope of this PR. |
||
; CHECK-NEXT: vredsum.vs v9, v9, v8 | ||
; CHECK-NEXT: vmv.x.s a3, v9 | ||
; CHECK-NEXT: addw a3, a3, a3 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,9 +129,8 @@ define <vscale x 8 x i8> @insertelt_nxv8i8_idx(<vscale x 8 x i8> %v, i8 signext | |
; CHECK-LABEL: insertelt_nxv8i8_idx: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: addi a2, a1, 1 | ||
; CHECK-NEXT: vsetvli a3, zero, e8, m1, ta, ma | ||
; CHECK-NEXT: vmv.s.x v9, a0 | ||
; CHECK-NEXT: vsetvli zero, a2, e8, m1, tu, ma | ||
; CHECK-NEXT: vmv.s.x v9, a0 | ||
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. That's interesting that we now perform the vmv.s.x in tu policy. I thought that we didn't go from ta -> tu generally? Is the passthru in this vmv.s.x not poison? Either way I'm going out on a limb here and assuming this is profitable given we're avoiding a VL toggle |
||
; CHECK-NEXT: vslideup.vx v8, v9, a1 | ||
; CHECK-NEXT: ret | ||
%r = insertelement <vscale x 8 x i8> %v, i8 %elt, i32 %idx | ||
|
@@ -333,9 +332,8 @@ define <vscale x 4 x i16> @insertelt_nxv4i16_idx(<vscale x 4 x i16> %v, i16 sign | |
; CHECK-LABEL: insertelt_nxv4i16_idx: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: addi a2, a1, 1 | ||
; CHECK-NEXT: vsetvli a3, zero, e16, m1, ta, ma | ||
; CHECK-NEXT: vmv.s.x v9, a0 | ||
; CHECK-NEXT: vsetvli zero, a2, e16, m1, tu, ma | ||
; CHECK-NEXT: vmv.s.x v9, a0 | ||
; CHECK-NEXT: vslideup.vx v8, v9, a1 | ||
; CHECK-NEXT: ret | ||
%r = insertelement <vscale x 4 x i16> %v, i16 %elt, i32 %idx | ||
|
@@ -503,9 +501,8 @@ define <vscale x 2 x i32> @insertelt_nxv2i32_idx(<vscale x 2 x i32> %v, i32 sign | |
; CHECK-LABEL: insertelt_nxv2i32_idx: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: addi a2, a1, 1 | ||
; CHECK-NEXT: vsetvli a3, zero, e32, m1, ta, ma | ||
; CHECK-NEXT: vmv.s.x v9, a0 | ||
; CHECK-NEXT: vsetvli zero, a2, e32, m1, tu, ma | ||
; CHECK-NEXT: vmv.s.x v9, a0 | ||
; CHECK-NEXT: vslideup.vx v8, v9, a1 | ||
; CHECK-NEXT: ret | ||
%r = insertelement <vscale x 2 x i32> %v, i32 %elt, i32 %idx | ||
|
Uh oh!
There was an error while loading. Please reload this page.