jlb6740 opened PR #1665 from vcode-add-movss-addss-subss
to master
:
- Need to better separate data structures for sse and regular regs
Lowering is not right .. made sure all paths towards lowering are
covered but still need to review what is there and correctNeed to emit code. Currently have placeholders.
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
bjorn3 submitted PR Review.
bjorn3 created PR Review Comment:
/// These indicate ways of extending (widening) a value, using the Intel /// naming: B(yte) = u8, W(ord) = u16, L(ong)word = u32, Q(uad)word = u64 #[derive(Clone, PartialEq)]
bjorn3 submitted PR Review.
bjorn3 created PR Review Comment:
/// Some basic ALU operations. #[derive(Clone, PartialEq)]
bjorn3 submitted PR Review.
bjorn3 created PR Review Comment:
pub(crate) fn xmm0() -> Reg {
bjorn3 created PR Review Comment:
Probably just forgotten.
bjorn3 submitted PR Review.
bjorn3 submitted PR Review.
bjorn3 created PR Review Comment:
Otherwise
self.vcode.vreg_types[vreg.get_index()]
would panic on out of bounds indexing.
julian-seward1 submitted PR Review.
julian-seward1 created PR Review Comment:
We should really rename both this and the existing
RM_R_Op
to something more sensible. ForRM_R_Op
I'm not sure what. For this, maybeSSE2_BinOp
would be good. Basically all two-operand SSE2 instructions (the R/R and R/M) versions can be represented this way, so it's nice and compact.
julian-seward1 submitted PR Review.
julian-seward1 submitted PR Review.
julian-seward1 created PR Review Comment:
Errr, this is tricky, for reasons to do with copy coalescing in regalloc. At least for now, I'd prefer to have an Xmm-to-Xmm move instruction that operates only on the entire register. We can come back and refine this later. So you'd drop the
Scalar
bit here, givingSSE_Mov_R_R
. And correspondingly emit whatever Intel recommends for Xmm-to-Xmm moves .. is itmovapd reg, reg
perhaps?
julian-seward1 created PR Review Comment:
Per comments above, this would want to be
SSE_BinOp_RM_R
.
julian-seward1 created PR Review Comment:
I guess
RM_R_Op
should then be changed toINT_RM_R_Op
.
julian-seward1 created PR Review Comment:
Hence,
sse_mov_r_r
julian-seward1 created PR Review Comment:
Not 100% sure I understand the question, but .. let's keep the XMM and integer insns separate. So I think the answer is then "no".
julian-seward1 created PR Review Comment:
Because they have never actually been used so far.
julian-seward1 created PR Review Comment:
Per comments above, I'd prefer that
mov_r_r
continued to be for int-only moves, but renamed tomov_int_r_r
, and we make a new one that's only for xmm regs, calledmov_xmm_r_r
.
julian-seward1 created PR Review Comment:
I'd prefer you called this
ty_is_flt64
and rename its integer counterpart toty_is_int64
.
julian-seward1 submitted PR Review.
julian-seward1 created PR Review Comment:
This is old-x86-backend-world, btw.
jlb6740 submitted PR Review.
jlb6740 created PR Review Comment:
Yes I see ... initially I wasn't sure why the need for the loop. I don't see a grow() for vectors but perhaps instead of looping we can replace with a resize statement? Something like:
self.vcode.vreg_types.resize(ir::types::I8, vreg.get_index() - self.vcode.vreg_types.len())
jlb6740 edited PR Review Comment.
jlb6740 submitted PR Review.
jlb6740 created PR Review Comment:
What prompted this comment was here in lower.rs:
For a lot of opcodes we can specify from here which Inst::mov variant we want to call but for return for example, multiple types apply and I found I was going to only be calling one version which might not be the correct one. I was going to check types in lower.rs, but instead I created a mov specific to the return op and put the decision logic there.
bjorn3 submitted PR Review.
bjorn3 created PR Review Comment:
vreg.get_index()
may be smaller thanself.vcode.vreg_types.len()
, in which case the substraction will underflow.
julian-seward1 submitted PR Review.
julian-seward1 created PR Review Comment:
Ah, that is a good point. Yes. True. Nevertheless, the general flavour of the rest of the instruction selector (lower.rs) is that we keep int and vec instructions separate, and we don't hand that problem to the instruction-representation layer. So the lowering logic to handle
Opcode::FallthroughReturn | Opcode::Return
will need to do the type test itself, rather than handing it off toreturn_mov_r_r
. FWIW I think there are only very few places like this, where we need to check int-vs-vec/float types at the lowering level -- in prologue construction is the only other place I can think of.
jlb6740 submitted PR Review.
jlb6740 created PR Review Comment:
I kept the guard. It's just local, but it looks like this:
if self.vcode.vreg_types.len() < vreg.get_index() { self.vcode.vreg_types.resize( vreg.get_index() - self.vcode.vreg_types.len(), ir::types::I8, ) } self.vcode.vreg_types[vreg.get_index()] = ty;
as opposed to this with the while loop:
while self.vcode.vreg_types.len() <= vreg.get_index() { self.vcode.vreg_types.push(ir::types::I8); // Default type. } self.vcode.vreg_types[vreg.get_index()] = ty;
I assumed that top "if-branch would be more efficient but not sure what rust is doing under the covers for the resize compared to the push.
bnjbvr submitted PR Review.
bnjbvr created PR Review Comment:
In general, a resize may reallocate all the memory you need at once, while several pushes in a row may cause several series of reallocation, so
resize
is to be preferred. (I don't know if rustc even gets to use some kind of SIMD tricks to fill the memory with the default value.)
jlb6740 submitted PR Review.
jlb6740 created PR Review Comment:
@Bnjbvr ... Cool thanks. Good to know.
jlb6740 deleted PR Review Comment.
jlb6740 submitted PR Review.
jlb6740 created PR Review Comment:
@bnjbvr .. Cool thanks.
jlb6740 edited PR Review Comment.
jlb6740 deleted PR Review Comment.
jlb6740 submitted PR Review.
jlb6740 created PR Review Comment:
@bnjbvr Ok thanks. That SIMD question is an interesting one.
jlb6740 edited PR Review Comment.
jlb6740 edited PR Review Comment.
jlb6740 updated PR #1665 from vcode-add-movss-addss-subss
to master
:
- Need to better separate data structures for sse and regular regs
Lowering is not right .. made sure all paths towards lowering are
covered but still need to review what is there and correctNeed to emit code. Currently have placeholders.
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
jlb6740 updated PR #1665 from vcode-add-movss-addss-subss
to master
:
- Need to better separate data structures for sse and regular regs
Lowering is not right .. made sure all paths towards lowering are
covered but still need to review what is there and correctNeed to emit code. Currently have placeholders.
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
jlb6740 updated PR #1665 from vcode-add-movss-addss-subss
to master
:
- Need to better separate data structures for sse and regular regs
Lowering is not right .. made sure all paths towards lowering are
covered but still need to review what is there and correctNeed to emit code. Currently have placeholders.
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
jlb6740 updated PR #1665 from vcode-add-movss-addss-subss
to master
:
- Need to better separate data structures for sse and regular regs
Lowering is not right .. made sure all paths towards lowering are
covered but still need to review what is there and correctNeed to emit code. Currently have placeholders.
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
jlb6740 updated PR #1665 from vcode-add-movss-addss-subss
to master
:
- Need to better separate data structures for sse and regular regs
Lowering is not right .. made sure all paths towards lowering are
covered but still need to review what is there and correctNeed to emit code. Currently have placeholders.
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
jlb6740 updated PR #1665 from vcode-add-movss-addss-subss
to master
:
- Need to better separate data structures for sse and regular regs
Lowering is not right .. made sure all paths towards lowering are
covered but still need to review what is there and correctNeed to emit code. Currently have placeholders.
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
jlb6740 updated PR #1665 from vcode-add-movss-addss-subss
to master
:
- Need to better separate data structures for sse and regular regs
Lowering is not right .. made sure all paths towards lowering are
covered but still need to review what is there and correctNeed to emit code. Currently have placeholders.
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
jlb6740 updated PR #1665 from vcode-add-movss-addss-subss
to master
:
- Need to better separate data structures for sse and regular regs
Lowering is not right .. made sure all paths towards lowering are
covered but still need to review what is there and correctNeed to emit code. Currently have placeholders.
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
jlb6740 updated PR #1665 from vcode-add-movss-addss-subss
to master
:
- Need to better separate data structures for sse and regular regs
Lowering is not right .. made sure all paths towards lowering are
covered but still need to review what is there and correctNeed to emit code. Currently have placeholders.
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
Last updated: Nov 22 2024 at 17:03 UTC