[PATCH] D134236: [GlobalISel][Legalizer] Fix lowerSelect() not sign-extending the mask value.
Amara Emerson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 20 08:40:56 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG78833a43e8d8: [GlobalISel][Legalizer] Fix lowerSelect() not sign-extending the mask value. (authored by aemerson).
Changed prior to commit:
https://reviews.llvm.org/D134236?vs=461408&id=461579#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134236/new/
https://reviews.llvm.org/D134236
Files:
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
llvm/test/CodeGen/AArch64/GlobalISel/legalize-select.mir
Index: llvm/test/CodeGen/AArch64/GlobalISel/legalize-select.mir
===================================================================
--- llvm/test/CodeGen/AArch64/GlobalISel/legalize-select.mir
+++ llvm/test/CodeGen/AArch64/GlobalISel/legalize-select.mir
@@ -307,7 +307,8 @@
; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C1]](s32), [[C1]](s32), [[C1]](s32), [[C1]](s32)
; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(eq), %w0(s32), [[C]]
; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT %cmp(s1)
- ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[ZEXT]](s32)
+ ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[ZEXT]], 1
+ ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[SEXT_INREG]](s32)
; CHECK-NEXT: [[DEF:%[0-9]+]]:_(<4 x s1>) = G_IMPLICIT_DEF
; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
; CHECK-NEXT: [[IVEC:%[0-9]+]]:_(<4 x s1>) = G_INSERT_VECTOR_ELT [[DEF]], [[TRUNC]](s1), [[C2]](s64)
Index: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
===================================================================
--- llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -7247,10 +7247,8 @@
// The condition was potentially zero extended before, but we want a sign
// extended boolean.
- if (MaskTy.getSizeInBits() <= DstTy.getScalarSizeInBits() &&
- MaskTy != LLT::scalar(1)) {
+ if (MaskTy != LLT::scalar(1))
MaskElt = MIRBuilder.buildSExtInReg(MaskTy, MaskElt, 1).getReg(0);
- }
// Continue the sign extension (or truncate) to match the data type.
MaskElt = MIRBuilder.buildSExtOrTrunc(DstTy.getElementType(),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134236.461579.patch
Type: text/x-patch
Size: 1693 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220920/09ed286c/attachment.bin>
More information about the llvm-commits
mailing list