Skip to content

Commit c7169eb

Browse files
committed
Update comment to describe trunc(lshr(extractelement(x,c1),c2)) pattern as well
1 parent e86ca2b commit c7169eb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,14 +436,18 @@ static Instruction *foldVecTruncToExtElt(TruncInst &Trunc,
436436
return ExtractElementInst::Create(VecInput, IC.Builder.getInt32(Elt));
437437
}
438438

439-
/// Whenever an element is extracted from a vector, and then truncated,
440-
/// canonicalize by converting it to a bitcast followed by an
439+
/// Whenever an element is extracted from a vector, optionally shifted down, and
440+
/// then truncated, canonicalize by converting it to a bitcast followed by an
441441
/// extractelement.
442442
///
443-
/// Example (little endian):
443+
/// Examples (little endian):
444444
/// trunc (extractelement <4 x i64> %X, 0) to i32
445445
/// --->
446446
/// extractelement <8 x i32> (bitcast <4 x i64> %X to <8 x i32>), i32 0
447+
///
448+
/// trunc (lshr (extractelement <4 x i32> %X, 0), 8) to i8
449+
/// --->
450+
/// extractelement <16 x i8> (bitcast <4 x i32> %X to <16 x i8>), i32 1
447451
static Instruction *foldVecExtTruncToExtElt(TruncInst &Trunc,
448452
InstCombinerImpl &IC) {
449453
Value *Src = Trunc.getOperand(0);

0 commit comments

Comments
 (0)