Revert "[X86][BMI1] X86DAGToDAGISel: select BEXTR from x << (32 - y) >> (32 - y) pattern"

*Seems* to be breaking sanitizer-x86_64-linux-fast buildbot,
the ELF/relocatable-versioned.s test:

==17758==MemorySanitizer CHECK failed: /b/sanitizer-x86_64-linux-fast/build/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc:191 "((kBlockMagic)) == ((((u64*)addr)[0]))" (0x6a6cb03abcebc041, 0x0)
    #0 0x59716b in MsanCheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) /b/sanitizer-x86_64-linux-fast/build/llvm/projects/compiler-rt/lib/msan/msan.cc:393
    #1 0x586635 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) /b/sanitizer-x86_64-linux-fast/build/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_termination.cc:79
    #2 0x57d5ff in __sanitizer::InternalFree(void*, __sanitizer::SizeClassAllocatorLocalCache<__sanitizer::SizeClassAllocator32<__sanitizer::AP32> >*) /b/sanitizer-x86_64-linux-fast/build/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc:191
    #3 0x7fc21b24193f  (/lib/x86_64-linux-gnu/libc.so.6+0x3593f)
    #4 0x7fc21b241999 in exit (/lib/x86_64-linux-gnu/libc.so.6+0x35999)
    #5 0x7fc21b22c2e7 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e7)
    #6 0x57c039 in _start (/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/lld+0x57c039)

This reverts commit r345014.

llvm-svn: 345017
This commit is contained in:
Roman Lebedev 2018-10-23 10:34:57 +00:00
parent e4dee2696e
commit c29dbbdb10
4 changed files with 414 additions and 258 deletions

View File

@ -2688,10 +2688,6 @@ bool X86DAGToDAGISel::foldLoadStoreIntoMemOperand(SDNode *Node) {
// c) x & (-1 >> (32 - y))
// d) x << (32 - y) >> (32 - y)
bool X86DAGToDAGISel::matchBitExtract(SDNode *Node) {
assert(
(Node->getOpcode() == ISD::AND || Node->getOpcode() == ISD::SRL) &&
"Should be either an and-mask, or right-shift after clearing high bits.");
// BEXTR is BMI instruction, BZHI is BMI2 instruction. We need at least one.
if (!Subtarget->hasBMI() && !Subtarget->hasBMI2())
return false;
@ -2702,16 +2698,13 @@ bool X86DAGToDAGISel::matchBitExtract(SDNode *Node) {
if (NVT != MVT::i32 && NVT != MVT::i64)
return false;
unsigned Size = NVT.getSizeInBits();
SDValue NBits;
// If we have BMI2's BZHI, we are ok with muti-use patterns.
// Else, if we only have BMI1's BEXTR, we require one-use.
const bool CanHaveExtraUses = Subtarget->hasBMI2();
auto checkOneUse = [CanHaveExtraUses](SDValue Op, unsigned NUses = 1) {
return CanHaveExtraUses ||
Op.getNode()->hasNUsesOfValue(NUses, Op.getResNo());
auto checkOneUse = [CanHaveExtraUses](SDValue Op) {
return CanHaveExtraUses || Op.hasOneUse();
};
// a) x & ((1 << nbits) + (-1))
@ -2747,73 +2740,31 @@ bool X86DAGToDAGISel::matchBitExtract(SDNode *Node) {
return true;
};
SDValue X;
// d) x << (32 - y) >> (32 - y)
auto matchPatternD = [&checkOneUse, Size, &X, &NBits](SDNode *Node) -> bool {
if (Node->getOpcode() != ISD::SRL)
return false;
SDValue N0 = Node->getOperand(0);
if (N0->getOpcode() != ISD::SHL || !checkOneUse(N0))
return false;
SDValue N1 = Node->getOperand(1);
SDValue N01 = N0->getOperand(1);
// Both of the shifts must be by the exact same value.
// There should not be any uses of the shift amount outside of the pattern.
if (N1 != N01 || !checkOneUse(N1, 2))
return false;
// Skip over a truncate of the shift amount.
if (N1->getOpcode() == ISD::TRUNCATE) {
N1 = N1->getOperand(0);
// The trunc should have been the only user of the real shift amount.
if (!checkOneUse(N1))
return false;
}
// Match the shift amount as: (bitwidth - y). It should go away, too.
if (N1.getOpcode() != ISD::SUB)
return false;
auto N10 = dyn_cast<ConstantSDNode>(N1.getOperand(0));
if (!N10 || N10->getZExtValue() != Size)
return false;
X = N0->getOperand(0);
NBits = N1.getOperand(1);
return true;
};
auto matchLowBitMask = [&matchPatternA,
&matchPatternB](SDValue Mask) -> bool {
// FIXME: pattern c.
// FIXME: patterns c, d.
return matchPatternA(Mask) || matchPatternB(Mask);
};
if (Node->getOpcode() == ISD::AND) {
X = Node->getOperand(0);
SDValue Mask = Node->getOperand(1);
SDValue X = Node->getOperand(0);
SDValue Mask = Node->getOperand(1);
if (matchLowBitMask(Mask)) {
// Great.
} else {
std::swap(X, Mask);
if (!matchLowBitMask(Mask))
return false;
}
} else if (!matchPatternD(Node))
return false;
if (matchLowBitMask(Mask)) {
// Great.
} else {
std::swap(X, Mask);
if (!matchLowBitMask(Mask))
return false;
}
SDLoc DL(Node);
SDValue OrigNBits = NBits;
// Do we need to truncate the shift amount?
if (NBits.getValueType() != MVT::i8) {
NBits = CurDAG->getNode(ISD::TRUNCATE, DL, MVT::i8, NBits);
insertDAGNode(*CurDAG, OrigNBits, NBits);
}
// Insert 8-bit NBits into lowest 8 bits of NVT-sized (32 or 64-bit) register.
// All the other bits are undefined, we do not care about them.
SDValue ImplDef =
SDValue(CurDAG->getMachineNode(TargetOpcode::IMPLICIT_DEF, DL, NVT), 0);
insertDAGNode(*CurDAG, NBits, ImplDef);
SDValue OrigNBits = NBits;
NBits = CurDAG->getTargetInsertSubreg(X86::sub_8bit, DL, NVT, ImplDef, NBits);
insertDAGNode(*CurDAG, OrigNBits, NBits);
@ -3012,8 +2963,17 @@ bool X86DAGToDAGISel::tryShiftAmountMod(SDNode *N) {
if (ShiftAmt->getOpcode() == ISD::TRUNCATE)
ShiftAmt = ShiftAmt->getOperand(0);
// This function is called after X86DAGToDAGISel::matchBitExtract(),
// so we are not afraid that we might mess up BZHI/BEXTR pattern.
// Special case to avoid messing up a BZHI pattern.
// Look for (srl (shl X, (size - y)), (size - y)
if (Subtarget->hasBMI2() && (VT == MVT::i32 || VT == MVT::i64) &&
N->getOpcode() == ISD::SRL && N->getOperand(0).getOpcode() == ISD::SHL &&
// Shift amounts the same?
N->getOperand(1) == N->getOperand(0).getOperand(1) &&
// Shift amounts size - y?
ShiftAmt.getOpcode() == ISD::SUB &&
isa<ConstantSDNode>(ShiftAmt.getOperand(0)) &&
cast<ConstantSDNode>(ShiftAmt.getOperand(0))->getZExtValue() == Size)
return false;
SDValue NewShiftAmt;
if (ShiftAmt->getOpcode() == ISD::ADD || ShiftAmt->getOpcode() == ISD::SUB) {
@ -3212,9 +3172,6 @@ void X86DAGToDAGISel::Select(SDNode *Node) {
}
case ISD::SRL:
if (matchBitExtract(Node))
return;
LLVM_FALLTHROUGH;
case ISD::SRA:
case ISD::SHL:
if (tryShiftAmountMod(Node))

View File

@ -2519,6 +2519,14 @@ let Predicates = [HasBMI2] in {
(and (x86memop addr:$src),
(srl -1, (sub bitwidth, GR8:$lz))),
RC, VT, DstInst, DstMemInst>;
// x << (bitwidth - y) >> (bitwidth - y)
defm : _bmi_bzhi_pattern<(srl (shl RC:$src, (sub bitwidth, GR8:$lz)),
(sub bitwidth, GR8:$lz)),
(srl (shl (x86memop addr:$src),
(sub bitwidth, GR8:$lz)),
(sub bitwidth, GR8:$lz)),
RC, VT, DstInst, DstMemInst>;
}
defm : bmi_bzhi_patterns<GR32, 32, i32, BZHI32rr, loadi32, BZHI32rm>;
@ -2537,6 +2545,24 @@ let Predicates = [HasBMI2] in {
def : Pat<(and (loadi64 addr:$src), (srl -1, (i8 (trunc (sub 64, GR32:$lz))))),
(BZHI64rm addr:$src,
(INSERT_SUBREG (i64 (IMPLICIT_DEF)), GR32:$lz, sub_32bit))>;
// x << (32 - y) >> (32 - y)
def : Pat<(srl (shl GR32:$src, (i8 (trunc (sub 32, GR32:$lz)))),
(i8 (trunc (sub 32, GR32:$lz)))),
(BZHI32rr GR32:$src, GR32:$lz)>;
def : Pat<(srl (shl (loadi32 addr:$src), (i8 (trunc (sub 32, GR32:$lz)))),
(i8 (trunc (sub 32, GR32:$lz)))),
(BZHI32rm addr:$src, GR32:$lz)>;
// x << (64 - y) >> (64 - y)
def : Pat<(srl (shl GR64:$src, (i8 (trunc (sub 64, GR32:$lz)))),
(i8 (trunc (sub 64, GR32:$lz)))),
(BZHI64rr GR64:$src,
(INSERT_SUBREG (i64 (IMPLICIT_DEF)), GR32:$lz, sub_32bit))>;
def : Pat<(srl (shl (loadi64 addr:$src), (i8 (trunc (sub 64, GR32:$lz)))),
(i8 (trunc (sub 64, GR32:$lz)))),
(BZHI64rm addr:$src,
(INSERT_SUBREG (i64 (IMPLICIT_DEF)), GR32:$lz, sub_32bit))>;
} // HasBMI2
multiclass bmi_pdep_pext<string mnemonic, RegisterClass RC,

View File

@ -2813,12 +2813,14 @@ define i32 @bextr32_c0(i32 %val, i32 %numskipbits, i32 %numlowbits) nounwind {
;
; X86-BMI1NOTBM-LABEL: bextr32_c0:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-BMI1NOTBM-NEXT: shrl %cl, %edx
; X86-BMI1NOTBM-NEXT: shll $8, %eax
; X86-BMI1NOTBM-NEXT: bextrl %eax, %edx, %eax
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subl {{[0-9]+}}(%esp), %ecx
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_c0:
@ -2844,10 +2846,13 @@ define i32 @bextr32_c0(i32 %val, i32 %numskipbits, i32 %numlowbits) nounwind {
; X64-BMI1NOTBM-LABEL: bextr32_c0:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movl %edi, %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %edi
; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: bextrl %edx, %edi, %eax
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: negl %edx
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_c0:
@ -2877,12 +2882,14 @@ define i32 @bextr32_c1_indexzext(i32 %val, i8 %numskipbits, i8 %numlowbits) noun
;
; X86-BMI1NOTBM-LABEL: bextr32_c1_indexzext:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %al
; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-BMI1NOTBM-NEXT: shrl %cl, %edx
; X86-BMI1NOTBM-NEXT: shll $8, %eax
; X86-BMI1NOTBM-NEXT: bextrl %eax, %edx, %eax
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_c1_indexzext:
@ -2908,10 +2915,13 @@ define i32 @bextr32_c1_indexzext(i32 %val, i8 %numskipbits, i8 %numlowbits) noun
; X64-BMI1NOTBM-LABEL: bextr32_c1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movl %edi, %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %edi
; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: bextrl %edx, %edi, %eax
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: negb %dl
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_c1_indexzext:
@ -2944,13 +2954,15 @@ define i32 @bextr32_c2_load(i32* %w, i32 %numskipbits, i32 %numlowbits) nounwind
;
; X86-BMI1NOTBM-LABEL: bextr32_c2_load:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-BMI1NOTBM-NEXT: movl (%edx), %edx
; X86-BMI1NOTBM-NEXT: shrl %cl, %edx
; X86-BMI1NOTBM-NEXT: shll $8, %eax
; X86-BMI1NOTBM-NEXT: bextrl %eax, %edx, %eax
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: movl (%eax), %eax
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subl {{[0-9]+}}(%esp), %ecx
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_c2_load:
@ -2980,8 +2992,10 @@ define i32 @bextr32_c2_load(i32* %w, i32 %numskipbits, i32 %numlowbits) nounwind
; X64-BMI1NOTBM-NEXT: movl (%rdi), %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: bextrl %edx, %eax, %eax
; X64-BMI1NOTBM-NEXT: negl %edx
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_c2_load:
@ -3013,13 +3027,15 @@ define i32 @bextr32_c3_load_indexzext(i32* %w, i8 %numskipbits, i8 %numlowbits)
;
; X86-BMI1NOTBM-LABEL: bextr32_c3_load_indexzext:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %al
; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-BMI1NOTBM-NEXT: movl (%edx), %edx
; X86-BMI1NOTBM-NEXT: shrl %cl, %edx
; X86-BMI1NOTBM-NEXT: shll $8, %eax
; X86-BMI1NOTBM-NEXT: bextrl %eax, %edx, %eax
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: movl (%eax), %eax
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_c3_load_indexzext:
@ -3049,8 +3065,10 @@ define i32 @bextr32_c3_load_indexzext(i32* %w, i8 %numskipbits, i8 %numlowbits)
; X64-BMI1NOTBM-NEXT: movl (%rdi), %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: bextrl %edx, %eax, %eax
; X64-BMI1NOTBM-NEXT: negb %dl
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_c3_load_indexzext:
@ -3083,12 +3101,14 @@ define i32 @bextr32_c4_commutative(i32 %val, i32 %numskipbits, i32 %numlowbits)
;
; X86-BMI1NOTBM-LABEL: bextr32_c4_commutative:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-BMI1NOTBM-NEXT: shrl %cl, %edx
; X86-BMI1NOTBM-NEXT: shll $8, %eax
; X86-BMI1NOTBM-NEXT: bextrl %eax, %edx, %eax
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subl {{[0-9]+}}(%esp), %ecx
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_c4_commutative:
@ -3114,10 +3134,13 @@ define i32 @bextr32_c4_commutative(i32 %val, i32 %numskipbits, i32 %numlowbits)
; X64-BMI1NOTBM-LABEL: bextr32_c4_commutative:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movl %edi, %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %edi
; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: bextrl %edx, %edi, %eax
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: negl %edx
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_c4_commutative:
@ -3157,13 +3180,16 @@ define i32 @bextr32_c5_skipextrauses(i32 %val, i32 %numskipbits, i32 %numlowbits
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: pushl %esi
; X86-BMI1NOTBM-NEXT: subl $8, %esp
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %edx
; X86-BMI1NOTBM-NEXT: shll $8, %eax
; X86-BMI1NOTBM-NEXT: bextrl %eax, %edx, %esi
; X86-BMI1NOTBM-NEXT: movl %ecx, (%esp)
; X86-BMI1NOTBM-NEXT: movl %eax, %ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %esi
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subl {{[0-9]+}}(%esp), %ecx
; X86-BMI1NOTBM-NEXT: shll %cl, %esi
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %esi
; X86-BMI1NOTBM-NEXT: movl %eax, (%esp)
; X86-BMI1NOTBM-NEXT: calll use32
; X86-BMI1NOTBM-NEXT: movl %esi, %eax
; X86-BMI1NOTBM-NEXT: addl $8, %esp
@ -3204,10 +3230,13 @@ define i32 @bextr32_c5_skipextrauses(i32 %val, i32 %numskipbits, i32 %numlowbits
; X64-BMI1NOTBM-LABEL: bextr32_c5_skipextrauses:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: pushq %rbx
; X64-BMI1NOTBM-NEXT: movl %edi, %ebx
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %edi
; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: bextrl %edx, %edi, %ebx
; X64-BMI1NOTBM-NEXT: shrl %cl, %ebx
; X64-BMI1NOTBM-NEXT: negl %edx
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shll %cl, %ebx
; X64-BMI1NOTBM-NEXT: shrl %cl, %ebx
; X64-BMI1NOTBM-NEXT: movl %esi, %edi
; X64-BMI1NOTBM-NEXT: callq use32
; X64-BMI1NOTBM-NEXT: movl %ebx, %eax
@ -3350,10 +3379,13 @@ define i64 @bextr64_c0(i64 %val, i64 %numskipbits, i64 %numlowbits) nounwind {
; X64-BMI1NOTBM-LABEL: bextr64_c0:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: movq %rsi, %rcx
; X64-BMI1NOTBM-NEXT: movq %rdi, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rdi
; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rdi, %rax
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: negl %edx
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_c0:
@ -3483,12 +3515,14 @@ define i64 @bextr64_c1_indexzext(i64 %val, i8 %numskipbits, i8 %numlowbits) noun
;
; X64-BMI1NOTBM-LABEL: bextr64_c1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: # kill: def $edx killed $edx def $rdx
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movq %rdi, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rdi
; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rdi, %rax
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: negb %dl
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_c1_indexzext:
@ -3629,8 +3663,10 @@ define i64 @bextr64_c2_load(i64* %w, i64 %numskipbits, i64 %numlowbits) nounwind
; X64-BMI1NOTBM-NEXT: movq (%rdi), %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rax, %rax
; X64-BMI1NOTBM-NEXT: negl %edx
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_c2_load:
@ -3764,13 +3800,14 @@ define i64 @bextr64_c3_load_indexzext(i64* %w, i8 %numskipbits, i8 %numlowbits)
;
; X64-BMI1NOTBM-LABEL: bextr64_c3_load_indexzext:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: # kill: def $edx killed $edx def $rdx
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movq (%rdi), %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rax, %rax
; X64-BMI1NOTBM-NEXT: negb %dl
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_c3_load_indexzext:
@ -3906,10 +3943,13 @@ define i64 @bextr64_c4_commutative(i64 %val, i64 %numskipbits, i64 %numlowbits)
; X64-BMI1NOTBM-LABEL: bextr64_c4_commutative:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: movq %rsi, %rcx
; X64-BMI1NOTBM-NEXT: movq %rdi, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rdi
; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rdi, %rax
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: negl %edx
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_c4_commutative:
@ -4089,10 +4129,13 @@ define i64 @bextr64_c5_skipextrauses(i64 %val, i64 %numskipbits, i64 %numlowbits
; X64-BMI1NOTBM-LABEL: bextr64_c5_skipextrauses:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: pushq %rbx
; X64-BMI1NOTBM-NEXT: movq %rsi, %rcx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rdi
; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rdi, %rbx
; X64-BMI1NOTBM-NEXT: movq %rdi, %rbx
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rbx
; X64-BMI1NOTBM-NEXT: negl %edx
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shlq %cl, %rbx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rbx
; X64-BMI1NOTBM-NEXT: movq %rsi, %rdi
; X64-BMI1NOTBM-NEXT: callq use64
; X64-BMI1NOTBM-NEXT: movq %rbx, %rax
@ -4136,12 +4179,14 @@ define i32 @bextr32_d0(i32 %val, i32 %numskipbits, i32 %numlowbits) nounwind {
;
; X86-BMI1NOTBM-LABEL: bextr32_d0:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-BMI1NOTBM-NEXT: shrl %cl, %edx
; X86-BMI1NOTBM-NEXT: shll $8, %eax
; X86-BMI1NOTBM-NEXT: bextrl %eax, %edx, %eax
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subl {{[0-9]+}}(%esp), %ecx
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_d0:
@ -4167,10 +4212,13 @@ define i32 @bextr32_d0(i32 %val, i32 %numskipbits, i32 %numlowbits) nounwind {
; X64-BMI1NOTBM-LABEL: bextr32_d0:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movl %edi, %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %edi
; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: bextrl %edx, %edi, %eax
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: negl %edx
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_d0:
@ -4200,12 +4248,14 @@ define i32 @bextr32_d1_indexzext(i32 %val, i8 %numskipbits, i8 %numlowbits) noun
;
; X86-BMI1NOTBM-LABEL: bextr32_d1_indexzext:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %al
; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-BMI1NOTBM-NEXT: shrl %cl, %edx
; X86-BMI1NOTBM-NEXT: shll $8, %eax
; X86-BMI1NOTBM-NEXT: bextrl %eax, %edx, %eax
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_d1_indexzext:
@ -4231,10 +4281,13 @@ define i32 @bextr32_d1_indexzext(i32 %val, i8 %numskipbits, i8 %numlowbits) noun
; X64-BMI1NOTBM-LABEL: bextr32_d1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movl %edi, %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %edi
; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: bextrl %edx, %edi, %eax
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: negb %dl
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_d1_indexzext:
@ -4267,13 +4320,15 @@ define i32 @bextr32_d2_load(i32* %w, i32 %numskipbits, i32 %numlowbits) nounwind
;
; X86-BMI1NOTBM-LABEL: bextr32_d2_load:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-BMI1NOTBM-NEXT: movl (%edx), %edx
; X86-BMI1NOTBM-NEXT: shrl %cl, %edx
; X86-BMI1NOTBM-NEXT: shll $8, %eax
; X86-BMI1NOTBM-NEXT: bextrl %eax, %edx, %eax
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: movl (%eax), %eax
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subl {{[0-9]+}}(%esp), %ecx
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_d2_load:
@ -4303,8 +4358,10 @@ define i32 @bextr32_d2_load(i32* %w, i32 %numskipbits, i32 %numlowbits) nounwind
; X64-BMI1NOTBM-NEXT: movl (%rdi), %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: bextrl %edx, %eax, %eax
; X64-BMI1NOTBM-NEXT: negl %edx
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_d2_load:
@ -4336,13 +4393,15 @@ define i32 @bextr32_d3_load_indexzext(i32* %w, i8 %numskipbits, i8 %numlowbits)
;
; X86-BMI1NOTBM-LABEL: bextr32_d3_load_indexzext:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %al
; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-BMI1NOTBM-NEXT: movl (%edx), %edx
; X86-BMI1NOTBM-NEXT: shrl %cl, %edx
; X86-BMI1NOTBM-NEXT: shll $8, %eax
; X86-BMI1NOTBM-NEXT: bextrl %eax, %edx, %eax
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: movl (%eax), %eax
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_d3_load_indexzext:
@ -4372,8 +4431,10 @@ define i32 @bextr32_d3_load_indexzext(i32* %w, i8 %numskipbits, i8 %numlowbits)
; X64-BMI1NOTBM-NEXT: movl (%rdi), %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: bextrl %edx, %eax, %eax
; X64-BMI1NOTBM-NEXT: negb %dl
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_d3_load_indexzext:
@ -4416,13 +4477,16 @@ define i32 @bextr32_d5_skipextrauses(i32 %val, i32 %numskipbits, i32 %numlowbits
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: pushl %esi
; X86-BMI1NOTBM-NEXT: subl $8, %esp
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %edx
; X86-BMI1NOTBM-NEXT: shll $8, %eax
; X86-BMI1NOTBM-NEXT: bextrl %eax, %edx, %esi
; X86-BMI1NOTBM-NEXT: movl %ecx, (%esp)
; X86-BMI1NOTBM-NEXT: movl %eax, %ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %esi
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subl {{[0-9]+}}(%esp), %ecx
; X86-BMI1NOTBM-NEXT: shll %cl, %esi
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %esi
; X86-BMI1NOTBM-NEXT: movl %eax, (%esp)
; X86-BMI1NOTBM-NEXT: calll use32
; X86-BMI1NOTBM-NEXT: movl %esi, %eax
; X86-BMI1NOTBM-NEXT: addl $8, %esp
@ -4463,10 +4527,13 @@ define i32 @bextr32_d5_skipextrauses(i32 %val, i32 %numskipbits, i32 %numlowbits
; X64-BMI1NOTBM-LABEL: bextr32_d5_skipextrauses:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: pushq %rbx
; X64-BMI1NOTBM-NEXT: movl %edi, %ebx
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %edi
; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: bextrl %edx, %edi, %ebx
; X64-BMI1NOTBM-NEXT: shrl %cl, %ebx
; X64-BMI1NOTBM-NEXT: negl %edx
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shll %cl, %ebx
; X64-BMI1NOTBM-NEXT: shrl %cl, %ebx
; X64-BMI1NOTBM-NEXT: movl %esi, %edi
; X64-BMI1NOTBM-NEXT: callq use32
; X64-BMI1NOTBM-NEXT: movl %ebx, %eax
@ -4646,10 +4713,13 @@ define i64 @bextr64_d0(i64 %val, i64 %numskipbits, i64 %numlowbits) nounwind {
; X64-BMI1NOTBM-LABEL: bextr64_d0:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: movq %rsi, %rcx
; X64-BMI1NOTBM-NEXT: movq %rdi, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rdi
; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rdi, %rax
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: negl %edx
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_d0:
@ -4816,12 +4886,14 @@ define i64 @bextr64_d1_indexzext(i64 %val, i8 %numskipbits, i8 %numlowbits) noun
;
; X64-BMI1NOTBM-LABEL: bextr64_d1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: # kill: def $edx killed $edx def $rdx
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movq %rdi, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rdi
; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rdi, %rax
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: negb %dl
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_d1_indexzext:
@ -4999,8 +5071,10 @@ define i64 @bextr64_d2_load(i64* %w, i64 %numskipbits, i64 %numlowbits) nounwind
; X64-BMI1NOTBM-NEXT: movq (%rdi), %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rax, %rax
; X64-BMI1NOTBM-NEXT: negl %edx
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_d2_load:
@ -5171,13 +5245,14 @@ define i64 @bextr64_d3_load_indexzext(i64* %w, i8 %numskipbits, i8 %numlowbits)
;
; X64-BMI1NOTBM-LABEL: bextr64_d3_load_indexzext:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: # kill: def $edx killed $edx def $rdx
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movq (%rdi), %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rax, %rax
; X64-BMI1NOTBM-NEXT: negb %dl
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_d3_load_indexzext:
@ -5391,10 +5466,13 @@ define i64 @bextr64_d5_skipextrauses(i64 %val, i64 %numskipbits, i64 %numlowbits
; X64-BMI1NOTBM-LABEL: bextr64_d5_skipextrauses:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: pushq %rbx
; X64-BMI1NOTBM-NEXT: movq %rsi, %rcx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rdi
; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rdi, %rbx
; X64-BMI1NOTBM-NEXT: movq %rdi, %rbx
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rbx
; X64-BMI1NOTBM-NEXT: negl %edx
; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
; X64-BMI1NOTBM-NEXT: shlq %cl, %rbx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rbx
; X64-BMI1NOTBM-NEXT: movq %rsi, %rdi
; X64-BMI1NOTBM-NEXT: callq use64
; X64-BMI1NOTBM-NEXT: movq %rbx, %rax

View File

@ -1442,8 +1442,11 @@ define i32 @bzhi32_c0(i32 %val, i32 %numlowbits) nounwind {
; X86-BMI1NOTBM-LABEL: bzhi32_c0:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: shll $8, %eax
; X86-BMI1NOTBM-NEXT: bextrl %eax, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subl {{[0-9]+}}(%esp), %ecx
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bzhi32_c0:
@ -1464,8 +1467,12 @@ define i32 @bzhi32_c0(i32 %val, i32 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi32_c0:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrl %esi, %edi, %eax
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movl %edi, %eax
; X64-BMI1NOTBM-NEXT: negl %ecx
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_c0:
@ -1491,9 +1498,12 @@ define i32 @bzhi32_c1_indexzext(i32 %val, i8 %numlowbits) nounwind {
;
; X86-BMI1NOTBM-LABEL: bzhi32_c1_indexzext:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %al
; X86-BMI1NOTBM-NEXT: shll $8, %eax
; X86-BMI1NOTBM-NEXT: bextrl %eax, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bzhi32_c1_indexzext:
@ -1514,8 +1524,12 @@ define i32 @bzhi32_c1_indexzext(i32 %val, i8 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi32_c1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrl %esi, %edi, %eax
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movl %edi, %eax
; X64-BMI1NOTBM-NEXT: negb %cl
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_c1_indexzext:
@ -1544,16 +1558,19 @@ define i32 @bzhi32_c2_load(i32* %w, i32 %numlowbits) nounwind {
; X86-BMI1NOTBM-LABEL: bzhi32_c2_load:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-BMI1NOTBM-NEXT: shll $8, %ecx
; X86-BMI1NOTBM-NEXT: bextrl %ecx, (%eax), %eax
; X86-BMI1NOTBM-NEXT: movl (%eax), %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subl {{[0-9]+}}(%esp), %ecx
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bzhi32_c2_load:
; X86-BMI1BMI2: # %bb.0:
; X86-BMI1BMI2-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1BMI2-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-BMI1BMI2-NEXT: bzhil %ecx, (%eax), %eax
; X86-BMI1BMI2-NEXT: bzhil %eax, (%ecx), %eax
; X86-BMI1BMI2-NEXT: retl
;
; X64-NOBMI-LABEL: bzhi32_c2_load:
@ -1568,8 +1585,12 @@ define i32 @bzhi32_c2_load(i32* %w, i32 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi32_c2_load:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrl %esi, (%rdi), %eax
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movl (%rdi), %eax
; X64-BMI1NOTBM-NEXT: negl %ecx
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_c2_load:
@ -1598,9 +1619,12 @@ define i32 @bzhi32_c3_load_indexzext(i32* %w, i8 %numlowbits) nounwind {
; X86-BMI1NOTBM-LABEL: bzhi32_c3_load_indexzext:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: shll $8, %ecx
; X86-BMI1NOTBM-NEXT: bextrl %ecx, (%eax), %eax
; X86-BMI1NOTBM-NEXT: movl (%eax), %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bzhi32_c3_load_indexzext:
@ -1622,8 +1646,12 @@ define i32 @bzhi32_c3_load_indexzext(i32* %w, i8 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi32_c3_load_indexzext:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrl %esi, (%rdi), %eax
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movl (%rdi), %eax
; X64-BMI1NOTBM-NEXT: negb %cl
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_c3_load_indexzext:
@ -1652,8 +1680,11 @@ define i32 @bzhi32_c4_commutative(i32 %val, i32 %numlowbits) nounwind {
; X86-BMI1NOTBM-LABEL: bzhi32_c4_commutative:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: shll $8, %eax
; X86-BMI1NOTBM-NEXT: bextrl %eax, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subl {{[0-9]+}}(%esp), %ecx
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bzhi32_c4_commutative:
@ -1674,8 +1705,12 @@ define i32 @bzhi32_c4_commutative(i32 %val, i32 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi32_c4_commutative:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrl %esi, %edi, %eax
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movl %edi, %eax
; X64-BMI1NOTBM-NEXT: negl %ecx
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_c4_commutative:
@ -1756,8 +1791,12 @@ define i64 @bzhi64_c0(i64 %val, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_c0:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: movq %rsi, %rcx
; X64-BMI1NOTBM-NEXT: movq %rdi, %rax
; X64-BMI1NOTBM-NEXT: negl %ecx
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_c0:
@ -1836,9 +1875,12 @@ define i64 @bzhi64_c1_indexzext(i64 %val, i8 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_c1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: # kill: def $esi killed $esi def $rsi
; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movq %rdi, %rax
; X64-BMI1NOTBM-NEXT: negb %cl
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_c1_indexzext:
@ -1928,8 +1970,12 @@ define i64 @bzhi64_c2_load(i64* %w, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_c2_load:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: movq %rsi, %rcx
; X64-BMI1NOTBM-NEXT: movq (%rdi), %rax
; X64-BMI1NOTBM-NEXT: negl %ecx
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_c2_load:
@ -2018,9 +2064,12 @@ define i64 @bzhi64_c3_load_indexzext(i64* %w, i8 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_c3_load_indexzext:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: # kill: def $esi killed $esi def $rsi
; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movq (%rdi), %rax
; X64-BMI1NOTBM-NEXT: negb %cl
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_c3_load_indexzext:
@ -2102,8 +2151,12 @@ define i64 @bzhi64_c4_commutative(i64 %val, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_c4_commutative:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: movq %rsi, %rcx
; X64-BMI1NOTBM-NEXT: movq %rdi, %rax
; X64-BMI1NOTBM-NEXT: negl %ecx
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_c4_commutative:
@ -2134,8 +2187,11 @@ define i32 @bzhi32_d0(i32 %val, i32 %numlowbits) nounwind {
; X86-BMI1NOTBM-LABEL: bzhi32_d0:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: shll $8, %eax
; X86-BMI1NOTBM-NEXT: bextrl %eax, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subl {{[0-9]+}}(%esp), %ecx
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bzhi32_d0:
@ -2156,8 +2212,12 @@ define i32 @bzhi32_d0(i32 %val, i32 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi32_d0:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrl %esi, %edi, %eax
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movl %edi, %eax
; X64-BMI1NOTBM-NEXT: negl %ecx
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_d0:
@ -2183,9 +2243,12 @@ define i32 @bzhi32_d1_indexzext(i32 %val, i8 %numlowbits) nounwind {
;
; X86-BMI1NOTBM-LABEL: bzhi32_d1_indexzext:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %al
; X86-BMI1NOTBM-NEXT: shll $8, %eax
; X86-BMI1NOTBM-NEXT: bextrl %eax, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bzhi32_d1_indexzext:
@ -2206,8 +2269,12 @@ define i32 @bzhi32_d1_indexzext(i32 %val, i8 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi32_d1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrl %esi, %edi, %eax
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movl %edi, %eax
; X64-BMI1NOTBM-NEXT: negb %cl
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_d1_indexzext:
@ -2236,16 +2303,19 @@ define i32 @bzhi32_d2_load(i32* %w, i32 %numlowbits) nounwind {
; X86-BMI1NOTBM-LABEL: bzhi32_d2_load:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-BMI1NOTBM-NEXT: shll $8, %ecx
; X86-BMI1NOTBM-NEXT: bextrl %ecx, (%eax), %eax
; X86-BMI1NOTBM-NEXT: movl (%eax), %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subl {{[0-9]+}}(%esp), %ecx
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bzhi32_d2_load:
; X86-BMI1BMI2: # %bb.0:
; X86-BMI1BMI2-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1BMI2-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-BMI1BMI2-NEXT: bzhil %ecx, (%eax), %eax
; X86-BMI1BMI2-NEXT: bzhil %eax, (%ecx), %eax
; X86-BMI1BMI2-NEXT: retl
;
; X64-NOBMI-LABEL: bzhi32_d2_load:
@ -2260,8 +2330,12 @@ define i32 @bzhi32_d2_load(i32* %w, i32 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi32_d2_load:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrl %esi, (%rdi), %eax
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movl (%rdi), %eax
; X64-BMI1NOTBM-NEXT: negl %ecx
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_d2_load:
@ -2290,9 +2364,12 @@ define i32 @bzhi32_d3_load_indexzext(i32* %w, i8 %numlowbits) nounwind {
; X86-BMI1NOTBM-LABEL: bzhi32_d3_load_indexzext:
; X86-BMI1NOTBM: # %bb.0:
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: shll $8, %ecx
; X86-BMI1NOTBM-NEXT: bextrl %ecx, (%eax), %eax
; X86-BMI1NOTBM-NEXT: movl (%eax), %eax
; X86-BMI1NOTBM-NEXT: xorl %ecx, %ecx
; X86-BMI1NOTBM-NEXT: subb {{[0-9]+}}(%esp), %cl
; X86-BMI1NOTBM-NEXT: shll %cl, %eax
; X86-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X86-BMI1NOTBM-NEXT: shrl %cl, %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bzhi32_d3_load_indexzext:
@ -2314,8 +2391,12 @@ define i32 @bzhi32_d3_load_indexzext(i32* %w, i8 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi32_d3_load_indexzext:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrl %esi, (%rdi), %eax
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movl (%rdi), %eax
; X64-BMI1NOTBM-NEXT: negb %cl
; X64-BMI1NOTBM-NEXT: shll %cl, %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_d3_load_indexzext:
@ -2455,8 +2536,12 @@ define i64 @bzhi64_d0(i64 %val, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_d0:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: movq %rsi, %rcx
; X64-BMI1NOTBM-NEXT: movq %rdi, %rax
; X64-BMI1NOTBM-NEXT: negl %ecx
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_d0:
@ -2592,9 +2677,12 @@ define i64 @bzhi64_d1_indexzext(i64 %val, i8 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_d1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: # kill: def $esi killed $esi def $rsi
; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movq %rdi, %rax
; X64-BMI1NOTBM-NEXT: negb %cl
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_d1_indexzext:
@ -2735,8 +2823,12 @@ define i64 @bzhi64_d2_load(i64* %w, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_d2_load:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: movq %rsi, %rcx
; X64-BMI1NOTBM-NEXT: movq (%rdi), %rax
; X64-BMI1NOTBM-NEXT: negl %ecx
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_d2_load:
@ -2876,9 +2968,12 @@ define i64 @bzhi64_d3_load_indexzext(i64* %w, i8 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_d3_load_indexzext:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: # kill: def $esi killed $esi def $rsi
; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
; X64-BMI1NOTBM-NEXT: movq (%rdi), %rax
; X64-BMI1NOTBM-NEXT: negb %cl
; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_d3_load_indexzext: