[llvm-branch-commits] [llvm] [LoongArch] Use INSERT_SUBREG for PseudoXVINSGR2VR into an undefined vector. NFC (PR #242332)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Nov 13 05:56:15 PST 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-loongarch
Author: Jay Foad (jayfoad)
<details>
<summary>Changes</summary>
When inserting an element into the low half of an undefined LASX vector,
the insert is done on the low 128 bits and the result was widened with
SUBREG_TO_REG. That means that the instruction defining the low 128 bits
also defined the upper 128 bits, which is not the case. Insert the result
into the undefined source vector with INSERT_SUBREG instead, which keeps
its upper 128 bits undefined.
Co-Authored-By: Claude Opus 5.5 <noreply@<!-- -->anthropic.com>
---
<sub>Stack created with <a href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
---
Full diff: https://github.com/llvm/llvm-project/pull/242332.diff
1 Files Affected:
- (modified) llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp (+2-1)
``````````diff
diff --git a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
index 81172881d6aba..b16486614dc18 100644
--- a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
@@ -9539,7 +9539,8 @@ emitPseudoXVINSGR2VR(MachineInstr &MI, MachineBasicBlock *BB,
.addReg(Elt)
.addImm(Idx);
- BuildMI(*BB, MI, DL, TII->get(LoongArch::SUBREG_TO_REG), XDst)
+ BuildMI(*BB, MI, DL, TII->get(LoongArch::INSERT_SUBREG), XDst)
+ .addReg(XSrc)
.addReg(ScratchSubReg2)
.addImm(LoongArch::sub_128);
} else {
``````````
</details>
https://github.com/llvm/llvm-project/pull/242332
More information about the llvm-branch-commits
mailing list