-
Notifications
You must be signed in to change notification settings - Fork 1.5k
x64: Convert Div instructions to new assembler #10855
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
x64: Convert Div instructions to new assembler #10855
Conversation
Subscribe to Label Action
This issue or pull request has been labeled: "cranelift", "cranelift:area:x64", "winch"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
07ff483
to
6aa8f8b
Compare
Seem to be unrelated connection errors in CI like -
Edit - They went away, now passes all tests |
@alexcrichton is this good to go? |
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.
Oh oops, my bad!
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.
This looks almost good to go; can you update the few locations I pointed out before I merge?
inst("vdivss", fmt("B", [rw(xmm1), r(xmm2), r(xmm_m32)]), vex(L128)._f3()._0f().op(0x5E).r(), _64b | compat | avx), | ||
inst("vdivsd", fmt("B", [rw(xmm1), r(xmm2), r(xmm_m64)]), vex(L128)._f2()._0f().op(0x5E).r(), _64b | compat | avx), |
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.
Just looking at the manual and, though this all will boil down to the same thing, I think we should be more pedantic and write:
inst("vdivss", fmt("B", [rw(xmm1), r(xmm2), r(xmm_m32)]), vex(L128)._f3()._0f().op(0x5E).r(), _64b | compat | avx), | |
inst("vdivsd", fmt("B", [rw(xmm1), r(xmm2), r(xmm_m64)]), vex(L128)._f2()._0f().op(0x5E).r(), _64b | compat | avx), | |
inst("vdivss", fmt("B", [rw(xmm1), r(xmm2), r(xmm_m32)]), vex(LIG)._f3()._0f().wig().op(0x5E).r(), _64b | compat | avx), | |
inst("vdivsd", fmt("B", [rw(xmm1), r(xmm2), r(xmm_m64)]), vex(LIG)._f2()._0f().wig().op(0x5E).r(), _64b | compat | avx), |
(And this probably means other VEX instructions should get checked but we don't have to do that in this PR).
inst("vdivps", fmt("B", [rw(xmm1), r(xmm2), r(xmm_m128)]), vex(L128)._0f().op(0x5E).r(), _64b | compat | avx), | ||
inst("vdivpd", fmt("B", [rw(xmm1), r(xmm2), r(xmm_m128)]), vex(L128)._66()._0f().op(0x5E).r(), _64b | compat | avx), |
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.
inst("vdivps", fmt("B", [rw(xmm1), r(xmm2), r(xmm_m128)]), vex(L128)._0f().op(0x5E).r(), _64b | compat | avx), | |
inst("vdivpd", fmt("B", [rw(xmm1), r(xmm2), r(xmm_m128)]), vex(L128)._66()._0f().op(0x5E).r(), _64b | compat | avx), | |
inst("vdivps", fmt("B", [rw(xmm1), r(xmm2), r(xmm_m128)]), vex(L128)._0f().wig().op(0x5E).r(), _64b | compat | avx), | |
inst("vdivpd", fmt("B", [rw(xmm1), r(xmm2), r(xmm_m128)]), vex(L128)._66().wig()._0f().op(0x5E).r(), _64b | compat | avx), |
(rule (x64_divsd src1 src2) | ||
(xmm_rm_r_unaligned (SseOpcode.Divsd) src1 src2)) | ||
(x64_divsd_a src1 src2)) |
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.
A nit to add the rule priority and, in these very short cases, fit it on a single line:
(rule 0 (x64_divsd src1 src2) x64_divsd_a src1 src2))
use crate::dsl::{Feature::*, Inst, Location::*, VexLength::*, align}; | ||
use crate::dsl::{fmt, implicit, inst, r, rex, rw, vex}; |
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.
More nits:
use crate::dsl::{Feature::*, Inst, Location::*, VexLength::*, align}; | |
use crate::dsl::{fmt, implicit, inst, r, rex, rw, vex}; | |
use crate::dsl::{Feature::*, Inst, Location::*, VexLength::*}; | |
use crate::dsl::{align, fmt, implicit, inst, r, rex, rw, vex}; |
Oops, looks like @alexcrichton and I raced; we can fix these nits later! |
Some final review comments went unaddressed in bytecodealliance#10855 that this change resolve, primarily using `LIG` for non-vector definitions. I was going to add `.wig()` everywhere but, after thinking about it, it _is_ the default value for `vex()` and leaving it out reduces the amount of information one has to parse. This also cleans up a few extra lines I saw lying around.
Some final review comments went unaddressed in #10855 that this change resolve, primarily using `LIG` for non-vector definitions. I was going to add `.wig()` everywhere but, after thinking about it, it _is_ the default value for `vex()` and leaving it out reduces the amount of information one has to parse. This also cleans up a few extra lines I saw lying around.
Converts div instructions to new assembler. Remove old div impl from codegen for SSE variants, not Vex variants.