Skip to content
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

[SelectionDAG] Use ZERO_EXTEND_VECTOR_INREG for vectors #92048

Closed
wants to merge 1 commit into from

Conversation

AreaZR
Copy link
Contributor

@AreaZR AreaZR commented May 13, 2024

No description provided.

@llvmbot llvmbot added the llvm:SelectionDAG SelectionDAGISel as well label May 13, 2024
@AreaZR AreaZR marked this pull request as draft May 13, 2024 23:28
@llvmbot
Copy link

llvmbot commented May 13, 2024

@llvm/pr-subscribers-llvm-selectiondag

Author: AtariDreams (AtariDreams)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/92048.diff

1 Files Affected:

  • (modified) llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (+1-2)
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index 0aa36deda79dc..2a8794e46e988 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -1508,8 +1508,7 @@ SDValue DAGTypeLegalizer::PromoteIntRes_VPFunnelShift(SDNode *N) {
       !TLI.isOperationLegalOrCustom(Opcode, VT)) {
     SDValue HiShift = DAG.getConstant(OldBits, DL, VT);
     Hi = DAG.getNode(ISD::VP_SHL, DL, VT, Hi, HiShift, Mask, EVL);
-    // FIXME: Replace it by vp operations.
-    Lo = DAG.getZeroExtendInReg(Lo, DL, OldVT);
+    Lo = DAG.getNode(ISD::ZERO_EXTEND_VECTOR_INREG, DL, VT, Lo);
     SDValue Res = DAG.getNode(ISD::VP_OR, DL, VT, Hi, Lo, Mask, EVL);
     Res = DAG.getNode(IsFSHR ? ISD::VP_LSHR : ISD::VP_SHL, DL, VT, Res, Amt,
                       Mask, EVL);

@arsenm
Copy link
Contributor

arsenm commented May 14, 2024

Needs test

@@ -1508,8 +1508,7 @@ SDValue DAGTypeLegalizer::PromoteIntRes_VPFunnelShift(SDNode *N) {
!TLI.isOperationLegalOrCustom(Opcode, VT)) {
SDValue HiShift = DAG.getConstant(OldBits, DL, VT);
Hi = DAG.getNode(ISD::VP_SHL, DL, VT, Hi, HiShift, Mask, EVL);
// FIXME: Replace it by vp operations.
Lo = DAG.getZeroExtendInReg(Lo, DL, OldVT);
Lo = DAG.getNode(ISD::ZERO_EXTEND_VECTOR_INREG, DL, VT, Lo);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this can be correct - we've already extended Lo with GetPromotedInteger above, getZeroExtendInReg is just used to mask the lower bits.

@@ -1508,8 +1508,7 @@ SDValue DAGTypeLegalizer::PromoteIntRes_VPFunnelShift(SDNode *N) {
!TLI.isOperationLegalOrCustom(Opcode, VT)) {
SDValue HiShift = DAG.getConstant(OldBits, DL, VT);
Hi = DAG.getNode(ISD::VP_SHL, DL, VT, Hi, HiShift, Mask, EVL);
// FIXME: Replace it by vp operations.
Lo = DAG.getZeroExtendInReg(Lo, DL, OldVT);
Lo = DAG.getNode(ISD::ZERO_EXTEND_VECTOR_INREG, DL, VT, Lo);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't correct and this isn't a VP instruction so wouldn't address the FIXME. The FIXME was saying we should use ISD::VP_AND instead of ISD::AND

@topperc
Copy link
Collaborator

topperc commented May 14, 2024

I don't think this code path is exercised. I put an assert(0) in it and nothing failed.

@RKSimon RKSimon marked this pull request as ready for review May 14, 2024 19:37
@RKSimon RKSimon marked this pull request as draft May 14, 2024 21:29
@topperc
Copy link
Collaborator

topperc commented May 14, 2024

I don't think this code path is exercised. I put an assert(0) in it and nothing failed.

New test coverage e417e61532ac373e7b0708262dedefcdaf6ced9c

@AreaZR AreaZR closed this Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:SelectionDAG SelectionDAGISel as well
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants