Skip to content

Commit d714be9

Browse files
authored
[AArch64] Check for exact size when finding 1's for CMLE. (#76452)
This is a fix for the second half of #75822, where smaller constants can also be bitcast to larger types. We should be checking the size is what we expect it to be when matching ones.
1 parent baf8a39 commit d714be9

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13715,11 +13715,10 @@ static SDValue EmitVectorComparison(SDValue LHS, SDValue RHS,
1371513715
bool IsCnst = BVN && BVN->isConstantSplat(SplatValue, SplatUndef,
1371613716
SplatBitSize, HasAnyUndefs);
1371713717

13718-
bool IsSplatUniform =
13719-
SrcVT.getVectorElementType().getSizeInBits() >= SplatBitSize;
13720-
bool IsZero = IsCnst && SplatValue == 0 && IsSplatUniform;
13721-
bool IsOne = IsCnst && SplatValue == 1 && IsSplatUniform;
13722-
bool IsMinusOne = IsCnst && SplatValue.isAllOnes() && IsSplatUniform;
13718+
bool IsZero = IsCnst && SplatValue == 0;
13719+
bool IsOne =
13720+
IsCnst && SrcVT.getScalarSizeInBits() == SplatBitSize && SplatValue == 1;
13721+
bool IsMinusOne = IsCnst && SplatValue.isAllOnes();
1372313722

1372413723
if (SrcVT.getVectorElementType().isFloatingPoint()) {
1372513724
switch (CC) {

llvm/test/CodeGen/AArch64/neon-compare-instructions.ll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1792,7 +1792,8 @@ define <8 x i1> @not_cmle8xi8(<8 x i8> %0) {
17921792
define <4 x i1> @not_cmle16xi8(<4 x i32> %0) {
17931793
; CHECK-SD-LABEL: not_cmle16xi8:
17941794
; CHECK-SD: // %bb.0: // %entry
1795-
; CHECK-SD-NEXT: cmle v0.4s, v0.4s, #0
1795+
; CHECK-SD-NEXT: movi v1.8h, #1
1796+
; CHECK-SD-NEXT: cmgt v0.4s, v1.4s, v0.4s
17961797
; CHECK-SD-NEXT: xtn v0.4h, v0.4s
17971798
; CHECK-SD-NEXT: ret
17981799
;

0 commit comments

Comments
 (0)