Skip to content
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
11 changes: 6 additions & 5 deletions llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3120,15 +3120,16 @@ static Value *matchOrConcat(Instruction &Or, InstCombiner::BuilderTy &Builder) {
return ConcatIntrinsicCalls(Intrinsic::bitreverse, UpperBRev, LowerBRev);

// iX ext split: extending or(zext(x),shl(zext(y),bw/2) pattern
// to consume sext/ashr: or(zext(sext(x)),shl(zext(sext(ashr(x))),bw/2)
// to consume sext/ashr:
// or(zext(sext(x)),shl(zext(sext(ashr(x,xbw-1))),bw/2)
// or(zext(x),shl(zext(ashr(x,xbw-1)),bw/2)
Value *X;
if (match(LowerSrc, m_SExt(m_Value(X))) &&
if (match(LowerSrc, m_SExtOrSelf(m_Value(X))) &&
match(UpperSrc,
m_SExt(m_AShr(
m_SExtOrSelf(m_AShr(
m_Specific(X),
m_SpecificInt(X->getType()->getScalarSizeInBits() - 1))))) {
m_SpecificInt(X->getType()->getScalarSizeInBits() - 1)))))
return Builder.CreateSExt(X, Ty);
}

return nullptr;
}
Expand Down
6 changes: 1 addition & 5 deletions llvm/test/Transforms/InstCombine/iX-ext-split.ll
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,7 @@ define void @i128_ext_split_store_i64(i64 %x, ptr %out) {
; CHECK-LABEL: define void @i128_ext_split_store_i64(
; CHECK-SAME: i64 [[X:%.*]], ptr [[OUT:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[LO:%.*]] = zext i64 [[X]] to i128
; CHECK-NEXT: [[SIGN:%.*]] = ashr i64 [[X]], 63
; CHECK-NEXT: [[WIDEN:%.*]] = zext i64 [[SIGN]] to i128
; CHECK-NEXT: [[HI:%.*]] = shl nuw i128 [[WIDEN]], 64
; CHECK-NEXT: [[RES:%.*]] = or disjoint i128 [[HI]], [[LO]]
; CHECK-NEXT: [[RES:%.*]] = sext i64 [[X]] to i128
; CHECK-NEXT: store i128 [[RES]], ptr [[OUT]], align 16
; CHECK-NEXT: ret void
;
Expand Down
Loading