Skip to content

[SystemZ] Use the EVT version of getVectorVT() in combineTruncateExtract(). #100150

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
Jul 26, 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
3 changes: 2 additions & 1 deletion llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6653,7 +6653,8 @@ SDValue SystemZTargetLowering::combineTruncateExtract(

// Defer the creation of the bitcast from X to combineExtract,
// which might be able to optimize the extraction.
VecVT = MVT::getVectorVT(MVT::getIntegerVT(TruncBytes * 8),
VecVT = EVT::getVectorVT(*DCI.DAG.getContext(),
MVT::getIntegerVT(TruncBytes * 8),
VecVT.getStoreSize() / TruncBytes);
EVT ResVT = (TruncBytes < 4 ? MVT::i32 : TruncVT);
return combineExtract(DL, ResVT, VecVT, Vec, NewIndex, DCI, true);
Expand Down
10 changes: 10 additions & 0 deletions llvm/test/CodeGen/SystemZ/vec-combine-01.ll
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,13 @@ define void @f7(ptr %ptr1, ptr %ptr2, ptr %ptr3, ptr %ptr4) {
store i8 %trunc3, ptr %ptr4
ret void
}

; Test that a truncating store with a non-simple VT can be handled.
define void @f8(ptr %src, ptr %dst) {
; CHECK-LABEL: f8:
%1 = load <12 x i32>, ptr %src, align 64
%2 = extractelement <12 x i32> %1, i64 11
%3 = trunc i32 %2 to i16
store i16 %3, ptr %dst, align 2
ret void
}
Loading