summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2019-02-04 19:04:26 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2019-02-04 19:04:26 +0000
commitb7ecc9b6241b9580ce7c4972e8514f2367a6f49d (patch)
treeb126f2b7e5eec1d704f5be09897253e692b797d3
parentb3e86709dc76afac082bd3c7ed4c90ef9847f7b5 (diff)
downloadbcm5719-llvm-b7ecc9b6241b9580ce7c4972e8514f2367a6f49d.tar.gz
bcm5719-llvm-b7ecc9b6241b9580ce7c4972e8514f2367a6f49d.zip
[X86] X86DAGToDAGISel::matchBitExtract(): prepare 'control' in 32 bits
Summary: Noticed while looking at D56052. ``` // The 'control' of BEXTR has the pattern of: // [15...8 bit][ 7...0 bit] location // [ bit count][ shift] name // I.e. 0b000000011'00000001 means (x >> 0b1) & 0b11 ``` I.e. we do not care about any of the bits aside from the low 16 bits. So there is no point in doing the `slh`,`or` in 64 bits, let's just do everything in 32 bits, and anyext if needed. We could do that in 16 even, but we intentionally don't zext to i16 (longer encoding IIRC), so i'm guessing the same applies here. Reviewers: craig.topper, andreadb, RKSimon Reviewed By: craig.topper Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D56715 llvm-svn: 353073
-rw-r--r--llvm/lib/Target/X86/X86ISelDAGToDAG.cpp53
-rw-r--r--llvm/test/CodeGen/X86/extract-bits.ll115
-rw-r--r--llvm/test/CodeGen/X86/extract-lowbits.ll28
3 files changed, 101 insertions, 95 deletions
diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
index 9fff820460b..25fb5d74698 100644
--- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -2958,23 +2958,31 @@ bool X86DAGToDAGISel::matchBitExtract(SDNode *Node) {
}
SDValue OrigNBits = NBits;
- if (NBits.getValueType() != XVT) {
- // Truncate the shift amount.
- NBits = CurDAG->getNode(ISD::TRUNCATE, DL, MVT::i8, NBits);
- insertDAGNode(*CurDAG, OrigNBits, NBits);
-
- // Insert 8-bit NBits into lowest 8 bits of XVT-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, XVT), 0);
- insertDAGNode(*CurDAG, OrigNBits, ImplDef);
- NBits =
- CurDAG->getTargetInsertSubreg(X86::sub_8bit, DL, XVT, ImplDef, NBits);
- insertDAGNode(*CurDAG, OrigNBits, NBits);
- }
+ // Truncate the shift amount.
+ NBits = CurDAG->getNode(ISD::TRUNCATE, DL, MVT::i8, NBits);
+ insertDAGNode(*CurDAG, OrigNBits, NBits);
+
+ // Insert 8-bit NBits into lowest 8 bits of 32-bit register.
+ // All the other bits are undefined, we do not care about them.
+ SDValue ImplDef = SDValue(
+ CurDAG->getMachineNode(TargetOpcode::IMPLICIT_DEF, DL, MVT::i32), 0);
+ insertDAGNode(*CurDAG, OrigNBits, ImplDef);
+ NBits = CurDAG->getTargetInsertSubreg(X86::sub_8bit, DL, MVT::i32, ImplDef,
+ NBits);
+ insertDAGNode(*CurDAG, OrigNBits, NBits);
if (Subtarget->hasBMI2()) {
// Great, just emit the the BZHI..
+ if (XVT != MVT::i32) {
+ // But have to place the bit count into the wide-enough register first.
+ SDValue ImplDef = SDValue(
+ CurDAG->getMachineNode(TargetOpcode::IMPLICIT_DEF, DL, XVT), 0);
+ insertDAGNode(*CurDAG, OrigNBits, ImplDef);
+ NBits = CurDAG->getTargetInsertSubreg(X86::sub_32bit, DL, XVT, ImplDef,
+ NBits);
+ insertDAGNode(*CurDAG, OrigNBits, NBits);
+ }
+
SDValue Extract = CurDAG->getNode(X86ISD::BZHI, DL, XVT, X, NBits);
ReplaceNode(Node, Extract.getNode());
SelectCode(Extract.getNode());
@@ -2990,7 +2998,7 @@ bool X86DAGToDAGISel::matchBitExtract(SDNode *Node) {
// Shift NBits left by 8 bits, thus producing 'control'.
// This makes the low 8 bits to be zero.
SDValue C8 = CurDAG->getConstant(8, DL, MVT::i8);
- SDValue Control = CurDAG->getNode(ISD::SHL, DL, XVT, NBits, C8);
+ SDValue Control = CurDAG->getNode(ISD::SHL, DL, MVT::i32, NBits, C8);
insertDAGNode(*CurDAG, OrigNBits, Control);
// If the 'X' is *logically* shifted, we can fold that shift into 'control'.
@@ -3002,12 +3010,23 @@ bool X86DAGToDAGISel::matchBitExtract(SDNode *Node) {
"Expected shift amount to be i8");
// Now, *zero*-extend the shift amount. The bits 8...15 *must* be zero!
+ // We could zext to i16 in some form, but we intentionally don't do that.
SDValue OrigShiftAmt = ShiftAmt;
- ShiftAmt = CurDAG->getNode(ISD::ZERO_EXTEND, DL, XVT, ShiftAmt);
+ ShiftAmt = CurDAG->getNode(ISD::ZERO_EXTEND, DL, MVT::i32, ShiftAmt);
insertDAGNode(*CurDAG, OrigShiftAmt, ShiftAmt);
// And now 'or' these low 8 bits of shift amount into the 'control'.
- Control = CurDAG->getNode(ISD::OR, DL, XVT, Control, ShiftAmt);
+ Control = CurDAG->getNode(ISD::OR, DL, MVT::i32, Control, ShiftAmt);
+ insertDAGNode(*CurDAG, OrigNBits, Control);
+ }
+
+ // But have to place the 'control' into the wide-enough register first.
+ if (XVT != MVT::i32) {
+ SDValue ImplDef =
+ SDValue(CurDAG->getMachineNode(TargetOpcode::IMPLICIT_DEF, DL, XVT), 0);
+ insertDAGNode(*CurDAG, OrigNBits, ImplDef);
+ Control = CurDAG->getTargetInsertSubreg(X86::sub_32bit, DL, XVT, ImplDef,
+ Control);
insertDAGNode(*CurDAG, OrigNBits, Control);
}
diff --git a/llvm/test/CodeGen/X86/extract-bits.ll b/llvm/test/CodeGen/X86/extract-bits.ll
index 13458a1e560..7921e9685ce 100644
--- a/llvm/test/CodeGen/X86/extract-bits.ll
+++ b/llvm/test/CodeGen/X86/extract-bits.ll
@@ -665,9 +665,9 @@ define i64 @bextr64_a0(i64 %val, i64 %numskipbits, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bextr64_a0:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -813,7 +813,7 @@ define i64 @bextr64_a0_arithmetic(i64 %val, i64 %numskipbits, i64 %numlowbits) n
; X64-BMI1NOTBM-NEXT: movq %rsi, %rcx
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-BMI1NOTBM-NEXT: sarq %cl, %rdi
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -953,10 +953,9 @@ define i64 @bextr64_a1_indexzext(i64 %val, i8 zeroext %numskipbits, i8 zeroext %
;
; X64-BMI1NOTBM-LABEL: bextr64_a1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: # kill: def $edx killed $edx def $rdx
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -1104,9 +1103,9 @@ define i64 @bextr64_a2_load(i64* %w, i64 %numskipbits, i64 %numlowbits) nounwind
;
; X64-BMI1NOTBM-LABEL: bextr64_a2_load:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -1251,10 +1250,9 @@ define i64 @bextr64_a3_load_indexzext(i64* %w, i8 zeroext %numskipbits, i8 zeroe
;
; X64-BMI1NOTBM-LABEL: bextr64_a3_load_indexzext:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: # kill: def $edx killed $edx def $rdx
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -1399,9 +1397,9 @@ define i64 @bextr64_a4_commutative(i64 %val, i64 %numskipbits, i64 %numlowbits)
;
; X64-BMI1NOTBM-LABEL: bextr64_a4_commutative:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -1586,9 +1584,9 @@ define i64 @bextr64_a5_skipextrauses(i64 %val, i64 %numskipbits, i64 %numlowbits
; X64-BMI1NOTBM-LABEL: bextr64_a5_skipextrauses:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: pushq %rbx
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rbx
; X64-BMI1NOTBM-NEXT: movq %rsi, %rdi
; X64-BMI1NOTBM-NEXT: callq use64
@@ -1828,10 +1826,9 @@ define i32 @bextr64_32_a1(i64 %val, i64 %numskipbits, i32 %numlowbits) nounwind
;
; X64-BMI1NOTBM-LABEL: bextr64_32_a1:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: # kill: def $edx killed $edx def $rdx
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $eax killed $eax killed $rax
; X64-BMI1NOTBM-NEXT: retq
@@ -2075,10 +2072,9 @@ define i32 @bextr64_32_a2(i64 %val, i64 %numskipbits, i32 %numlowbits) nounwind
;
; X64-BMI1NOTBM-LABEL: bextr64_32_a2:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: # kill: def $edx killed $edx def $rdx
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $eax killed $eax killed $rax
; X64-BMI1NOTBM-NEXT: retq
@@ -2666,9 +2662,9 @@ define i64 @bextr64_b0(i64 %val, i64 %numskipbits, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bextr64_b0:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -2805,10 +2801,9 @@ define i64 @bextr64_b1_indexzext(i64 %val, i8 zeroext %numskipbits, i8 zeroext %
;
; X64-BMI1NOTBM-LABEL: bextr64_b1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: # kill: def $edx killed $edx def $rdx
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -2953,9 +2948,9 @@ define i64 @bextr64_b2_load(i64* %w, i64 %numskipbits, i64 %numlowbits) nounwind
;
; X64-BMI1NOTBM-LABEL: bextr64_b2_load:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -3097,10 +3092,9 @@ define i64 @bextr64_b3_load_indexzext(i64* %w, i8 zeroext %numskipbits, i8 zeroe
;
; X64-BMI1NOTBM-LABEL: bextr64_b3_load_indexzext:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: # kill: def $edx killed $edx def $rdx
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -3242,9 +3236,9 @@ define i64 @bextr64_b4_commutative(i64 %val, i64 %numskipbits, i64 %numlowbits)
;
; X64-BMI1NOTBM-LABEL: bextr64_b4_commutative:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -3424,9 +3418,9 @@ define i64 @bextr64_b5_skipextrauses(i64 %val, i64 %numskipbits, i64 %numlowbits
; X64-BMI1NOTBM-LABEL: bextr64_b5_skipextrauses:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: pushq %rbx
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rbx
; X64-BMI1NOTBM-NEXT: movq %rsi, %rdi
; X64-BMI1NOTBM-NEXT: callq use64
@@ -3662,10 +3656,9 @@ define i32 @bextr64_32_b1(i64 %val, i64 %numskipbits, i8 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bextr64_32_b1:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: # kill: def $edx killed $edx def $rdx
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $eax killed $eax killed $rax
; X64-BMI1NOTBM-NEXT: retq
@@ -3765,10 +3758,9 @@ define i32 @bextr64_32_b2(i64 %val, i64 %numskipbits, i8 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bextr64_32_b2:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: # kill: def $edx killed $edx def $rdx
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $eax killed $eax killed $rax
; X64-BMI1NOTBM-NEXT: retq
@@ -6135,10 +6127,9 @@ define i32 @bextr64_32_c1(i64 %val, i64 %numskipbits, i32 %numlowbits) nounwind
;
; X64-BMI1NOTBM-LABEL: bextr64_32_c1:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: # kill: def $edx killed $edx def $rdx
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $eax killed $eax killed $rax
; X64-BMI1NOTBM-NEXT: retq
@@ -6235,10 +6226,9 @@ define i32 @bextr64_32_c2(i64 %val, i64 %numskipbits, i32 %numlowbits) nounwind
;
; X64-BMI1NOTBM-LABEL: bextr64_32_c2:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: # kill: def $edx killed $edx def $rdx
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $eax killed $eax killed $rax
; X64-BMI1NOTBM-NEXT: retq
@@ -6775,9 +6765,9 @@ define i64 @bextr64_d0(i64 %val, i64 %numskipbits, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bextr64_d0:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -6945,10 +6935,9 @@ 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: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -7123,9 +7112,9 @@ define i64 @bextr64_d2_load(i64* %w, i64 %numskipbits, i64 %numlowbits) nounwind
;
; X64-BMI1NOTBM-LABEL: bextr64_d2_load:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -7297,10 +7286,9 @@ 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: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -7515,9 +7503,9 @@ 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: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rbx
; X64-BMI1NOTBM-NEXT: movq %rsi, %rdi
; X64-BMI1NOTBM-NEXT: callq use64
@@ -7663,9 +7651,9 @@ define i32 @bextr64_32_d0(i64 %val, i64 %numskipbits, i64 %numlowbits) nounwind
;
; X64-BMI1NOTBM-LABEL: bextr64_32_d0:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $eax killed $eax killed $rax
; X64-BMI1NOTBM-NEXT: retq
@@ -7762,10 +7750,9 @@ define i32 @bextr64_32_d1(i64 %val, i64 %numskipbits, i32 %numlowbits) nounwind
;
; X64-BMI1NOTBM-LABEL: bextr64_32_d1:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: # kill: def $edx killed $edx def $rdx
-; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
-; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $eax killed $eax killed $rax
; X64-BMI1NOTBM-NEXT: retq
diff --git a/llvm/test/CodeGen/X86/extract-lowbits.ll b/llvm/test/CodeGen/X86/extract-lowbits.ll
index ac85edd16f2..47c611ebef6 100644
--- a/llvm/test/CodeGen/X86/extract-lowbits.ll
+++ b/llvm/test/CodeGen/X86/extract-lowbits.ll
@@ -354,7 +354,7 @@ define i64 @bzhi64_a0(i64 %val, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_a0:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
+; X64-BMI1NOTBM-NEXT: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -439,7 +439,7 @@ define i64 @bzhi64_a1_indexzext(i64 %val, i8 zeroext %numlowbits) nounwind {
; X64-BMI1NOTBM-LABEL: bzhi64_a1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: # kill: def $esi killed $esi def $rsi
-; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
+; X64-BMI1NOTBM-NEXT: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -534,7 +534,7 @@ define i64 @bzhi64_a2_load(i64* %w, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_a2_load:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
+; X64-BMI1NOTBM-NEXT: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -629,7 +629,7 @@ define i64 @bzhi64_a3_load_indexzext(i64* %w, i8 zeroext %numlowbits) nounwind {
; X64-BMI1NOTBM-LABEL: bzhi64_a3_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: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -716,7 +716,7 @@ define i64 @bzhi64_a4_commutative(i64 %val, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_a4_commutative:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
+; X64-BMI1NOTBM-NEXT: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -1060,7 +1060,7 @@ define i64 @bzhi64_b0(i64 %val, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_b0:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
+; X64-BMI1NOTBM-NEXT: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -1144,7 +1144,7 @@ define i64 @bzhi64_b1_indexzext(i64 %val, i8 zeroext %numlowbits) nounwind {
; X64-BMI1NOTBM-LABEL: bzhi64_b1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: # kill: def $esi killed $esi def $rsi
-; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
+; X64-BMI1NOTBM-NEXT: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -1234,7 +1234,7 @@ define i64 @bzhi64_b2_load(i64* %w, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_b2_load:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
+; X64-BMI1NOTBM-NEXT: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -1324,7 +1324,7 @@ define i64 @bzhi64_b3_load_indexzext(i64* %w, i8 zeroext %numlowbits) nounwind {
; X64-BMI1NOTBM-LABEL: bzhi64_b3_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: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -1410,7 +1410,7 @@ define i64 @bzhi64_b4_commutative(i64 %val, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_b4_commutative:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
+; X64-BMI1NOTBM-NEXT: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -3120,7 +3120,7 @@ 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: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -3258,7 +3258,7 @@ 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: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -3400,7 +3400,7 @@ 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: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
@@ -3542,7 +3542,7 @@ 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: shll $8, %esi
; X64-BMI1NOTBM-NEXT: bextrq %rsi, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
OpenPOWER on IntegriCloud