[llvm] [GISel] Lower scalar G_SELECT in LegalizerHelper (PR #79342)
Kai Nacke via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 24 13:21:33 PST 2024
================
@@ -7972,13 +7971,22 @@ LegalizerHelper::LegalizeResult LegalizerHelper::lowerSelect(MachineInstr &MI) {
MaskElt = MIRBuilder.buildSExtInReg(MaskTy, MaskElt, 1).getReg(0);
// Continue the sign extension (or truncate) to match the data type.
- MaskElt = MIRBuilder.buildSExtOrTrunc(DstTy.getElementType(),
- MaskElt).getReg(0);
+ MaskElt =
+ MIRBuilder
+ .buildSExtOrTrunc(DstTy.isVector() ? DstTy.getElementType() : DstTy,
+ MaskElt)
+ .getReg(0);
- // Generate a vector splat idiom.
- auto ShufSplat = MIRBuilder.buildShuffleSplat(DstTy, MaskElt);
- MaskReg = ShufSplat.getReg(0);
+ if (DstTy.isVector()) {
+ // Generate a vector splat idiom.
+ auto ShufSplat = MIRBuilder.buildShuffleSplat(DstTy, MaskElt);
+ MaskReg = ShufSplat.getReg(0);
+ } else
+ MaskReg = MaskElt;
----------------
redstar wrote:
Changed.
https://github.com/llvm/llvm-project/pull/79342
More information about the llvm-commits
mailing list