Skip to content

[SystemZ] Bugfix in getDemandedSrcElements(). #88623

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

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7818,7 +7818,7 @@ static APInt getDemandedSrcElements(SDValue Op, const APInt &DemandedElts,
break;
}
case Intrinsic::s390_vperm:
SrcDemE = APInt(NumElts, 1);
SrcDemE = APInt(NumElts, -1);
break;
default:
llvm_unreachable("Unhandled intrinsic.");
Expand Down
19 changes: 19 additions & 0 deletions llvm/test/CodeGen/SystemZ/knownbits-intrinsics-binop.ll
Original file line number Diff line number Diff line change
Expand Up @@ -458,3 +458,22 @@ define <16 x i8> @f30() {
i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
ret <16 x i8> %res
}

; Test VPERM with various constant operands.
define i32 @f31() {
; CHECK-LABEL: f31:
; CHECK-LABEL: # %bb.0:
; CHECK-NEXT: larl %r1, .LCPI31_0
; CHECK-NEXT: vl %v0, 0(%r1), 3
; CHECK-NEXT: larl %r1, .LCPI31_1
; CHECK-NEXT: vl %v1, 0(%r1), 3
; CHECK-NEXT: vperm %v0, %v1, %v1, %v0
; CHECK-NEXT: vlgvb %r2, %v0, 0
; CHECK-NEXT: nilf %r2, 7
; CHECK-NEXT: # kill: def $r2l killed $r2l killed $r2d
; CHECK-NEXT: br %r14
%P = tail call <16 x i8> @llvm.s390.vperm(<16 x i8> <i8 0, i8 1, i8 1, i8 2, i8 1, i8 2, i8 2, i8 3, i8 1, i8 2, i8 2, i8 3, i8 2, i8 3, i8 3, i8 4>, <16 x i8> <i8 0, i8 1, i8 1, i8 2, i8 1, i8 2, i8 2, i8 3, i8 1, i8 2, i8 2, i8 3, i8 2, i8 3, i8 3, i8 4>, <16 x i8> <i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 0>)
%E = extractelement <16 x i8> %P, i64 0
%res = zext i8 %E to i32
ret i32 %res
}