summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2018-11-16 13:04:54 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2018-11-16 13:04:54 +0000
commit90c5b3f78ecfc08a428ea6022a5e80ddc437b99b (patch)
tree7befdbc238b05da6bc4739faf06ac89b05f67c86 /llvm/test/CodeGen
parent831be096c72fc29d62f641f95d97a35f463eb202 (diff)
downloadbcm5719-llvm-90c5b3f78ecfc08a428ea6022a5e80ddc437b99b.tar.gz
bcm5719-llvm-90c5b3f78ecfc08a428ea6022a5e80ddc437b99b.zip
[X86] X86DAGToDAGISel::matchBitExtract(): extract 'lshr' from `X`
Summary: As discussed in previous review, and noted in the FIXME, if `X` is actually an `lshr Y, Z` (logical!), we can fold the `Z` into 'control`, and let the `BEXTR` do this too. We could just insert those 8 bits of shift amount into control, but it is better to instead zero-extend them, and 'or' them in place. We can only do this for `lshr`, not `ashr`, because we do not know that the mask cover only the bits of `Y`, and not any of the sign-extended bits. The obvious question is, is this actually legal to do? I believe it is. Relevant quotes, from `Intel® 64 and IA-32 Architectures Software Developer’s Manual`, `BEXTR — Bit Field Extract`: * `Bit 7:0 of the second source operand specifies the starting bit position of bit extraction.` * `A START value exceeding the operand size will not extract any bits from the second source operand.` * `Only bit positions up to (OperandSize -1) of the first source operand are extracted.` * `All higher order bits in the destination operand (starting at bit position LENGTH) are zeroed.` * `The destination register is cleared if no bits are extracted.` FIXME: if we can do this, i wonder if we should prefer `BEXTR` over `BZHI` in such cases. Reviewers: RKSimon, craig.topper, spatel, andreadb Reviewed By: RKSimon, craig.topper, andreadb Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D54095 llvm-svn: 347048
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/X86/extract-bits.ll406
1 files changed, 176 insertions, 230 deletions
diff --git a/llvm/test/CodeGen/X86/extract-bits.ll b/llvm/test/CodeGen/X86/extract-bits.ll
index cfe6ba571df..2f1b28627a4 100644
--- a/llvm/test/CodeGen/X86/extract-bits.ll
+++ b/llvm/test/CodeGen/X86/extract-bits.ll
@@ -49,11 +49,10 @@ define i32 @bextr32_a0(i32 %val, i32 %numskipbits, i32 %numlowbits) nounwind {
; X86-BMI1NOTBM-LABEL: bextr32_a0:
; 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: movzbl {{[0-9]+}}(%esp), %ecx
+; X86-BMI1NOTBM-NEXT: orl %eax, %ecx
+; X86-BMI1NOTBM-NEXT: bextrl %ecx, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_a0:
@@ -78,11 +77,10 @@ define i32 @bextr32_a0(i32 %val, i32 %numskipbits, i32 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bextr32_a0:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
+; X64-BMI1NOTBM-NEXT: bextrl %eax, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_a0:
@@ -183,11 +181,10 @@ define i32 @bextr32_a1_indexzext(i32 %val, i8 zeroext %numskipbits, i8 zeroext %
; X86-BMI1NOTBM-LABEL: bextr32_a1_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: movzbl {{[0-9]+}}(%esp), %ecx
+; X86-BMI1NOTBM-NEXT: orl %eax, %ecx
+; X86-BMI1NOTBM-NEXT: bextrl %ecx, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_a1_indexzext:
@@ -212,11 +209,10 @@ define i32 @bextr32_a1_indexzext(i32 %val, i8 zeroext %numskipbits, i8 zeroext %
;
; X64-BMI1NOTBM-LABEL: bextr32_a1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
+; X64-BMI1NOTBM-NEXT: bextrl %eax, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_a1_indexzext:
@@ -252,13 +248,12 @@ define i32 @bextr32_a2_load(i32* %w, i32 %numskipbits, i32 %numlowbits) nounwind
;
; X86-BMI1NOTBM-LABEL: bextr32_a2_load:
; X86-BMI1NOTBM: # %bb.0:
-; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %al
+; 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: shll $8, %ecx
+; X86-BMI1NOTBM-NEXT: movzbl {{[0-9]+}}(%esp), %edx
+; X86-BMI1NOTBM-NEXT: orl %ecx, %edx
+; X86-BMI1NOTBM-NEXT: bextrl %edx, (%eax), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_a2_load:
@@ -285,12 +280,10 @@ define i32 @bextr32_a2_load(i32* %w, i32 %numskipbits, i32 %numlowbits) nounwind
;
; X64-BMI1NOTBM-LABEL: bextr32_a2_load:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
+; X64-BMI1NOTBM-NEXT: bextrl %eax, (%rdi), %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_a2_load:
@@ -325,13 +318,12 @@ define i32 @bextr32_a3_load_indexzext(i32* %w, i8 zeroext %numskipbits, i8 zeroe
;
; X86-BMI1NOTBM-LABEL: bextr32_a3_load_indexzext:
; X86-BMI1NOTBM: # %bb.0:
-; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %al
+; 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: shll $8, %ecx
+; X86-BMI1NOTBM-NEXT: movzbl {{[0-9]+}}(%esp), %edx
+; X86-BMI1NOTBM-NEXT: orl %ecx, %edx
+; X86-BMI1NOTBM-NEXT: bextrl %edx, (%eax), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_a3_load_indexzext:
@@ -358,12 +350,10 @@ define i32 @bextr32_a3_load_indexzext(i32* %w, i8 zeroext %numskipbits, i8 zeroe
;
; X64-BMI1NOTBM-LABEL: bextr32_a3_load_indexzext:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
+; X64-BMI1NOTBM-NEXT: bextrl %eax, (%rdi), %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_a3_load_indexzext:
@@ -400,11 +390,10 @@ define i32 @bextr32_a4_commutative(i32 %val, i32 %numskipbits, i32 %numlowbits)
; X86-BMI1NOTBM-LABEL: bextr32_a4_commutative:
; 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: movzbl {{[0-9]+}}(%esp), %ecx
+; X86-BMI1NOTBM-NEXT: orl %eax, %ecx
+; X86-BMI1NOTBM-NEXT: bextrl %ecx, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_a4_commutative:
@@ -429,11 +418,10 @@ define i32 @bextr32_a4_commutative(i32 %val, i32 %numskipbits, i32 %numlowbits)
;
; X64-BMI1NOTBM-LABEL: bextr32_a4_commutative:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
+; X64-BMI1NOTBM-NEXT: bextrl %eax, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_a4_commutative:
@@ -476,13 +464,13 @@ define i32 @bextr32_a5_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: movb {{[0-9]+}}(%esp), %al
-; 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: movb {{[0-9]+}}(%esp), %cl
+; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X86-BMI1NOTBM-NEXT: shll $8, %ecx
+; X86-BMI1NOTBM-NEXT: movzbl %al, %edx
+; X86-BMI1NOTBM-NEXT: orl %ecx, %edx
+; X86-BMI1NOTBM-NEXT: bextrl %edx, {{[0-9]+}}(%esp), %esi
+; X86-BMI1NOTBM-NEXT: movl %eax, (%esp)
; X86-BMI1NOTBM-NEXT: calll use32
; X86-BMI1NOTBM-NEXT: movl %esi, %eax
; X86-BMI1NOTBM-NEXT: addl $8, %esp
@@ -523,10 +511,10 @@ define i32 @bextr32_a5_skipextrauses(i32 %val, i32 %numskipbits, i32 %numlowbits
; X64-BMI1NOTBM-LABEL: bextr32_a5_skipextrauses:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: pushq %rbx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
+; X64-BMI1NOTBM-NEXT: bextrl %eax, %edi, %ebx
; X64-BMI1NOTBM-NEXT: movl %esi, %edi
; X64-BMI1NOTBM-NEXT: callq use32
; X64-BMI1NOTBM-NEXT: movl %ebx, %eax
@@ -677,11 +665,10 @@ define i64 @bextr64_a0(i64 %val, i64 %numskipbits, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bextr64_a0:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: movq %rsi, %rcx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_a0:
@@ -967,11 +954,10 @@ 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: movl %esi, %ecx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_a1_indexzext:
@@ -1118,12 +1104,10 @@ 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: movq %rsi, %rcx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: bextrq %rax, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_a2_load:
@@ -1268,12 +1252,10 @@ 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: 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: bextrq %rax, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_a3_load_indexzext:
@@ -1417,11 +1399,10 @@ define i64 @bextr64_a4_commutative(i64 %val, i64 %numskipbits, i64 %numlowbits)
;
; X64-BMI1NOTBM-LABEL: bextr64_a4_commutative:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: movq %rsi, %rcx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_a4_commutative:
@@ -1605,10 +1586,10 @@ 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: 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rbx
; X64-BMI1NOTBM-NEXT: movq %rsi, %rdi
; X64-BMI1NOTBM-NEXT: callq use64
; X64-BMI1NOTBM-NEXT: movq %rbx, %rax
@@ -1656,11 +1637,10 @@ define i32 @bextr32_b0(i32 %val, i32 %numskipbits, i32 %numlowbits) nounwind {
; X86-BMI1NOTBM-LABEL: bextr32_b0:
; 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: movzbl {{[0-9]+}}(%esp), %ecx
+; X86-BMI1NOTBM-NEXT: orl %eax, %ecx
+; X86-BMI1NOTBM-NEXT: bextrl %ecx, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_b0:
@@ -1685,11 +1665,10 @@ define i32 @bextr32_b0(i32 %val, i32 %numskipbits, i32 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bextr32_b0:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
+; X64-BMI1NOTBM-NEXT: bextrl %eax, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_b0:
@@ -1723,11 +1702,10 @@ define i32 @bextr32_b1_indexzext(i32 %val, i8 zeroext %numskipbits, i8 zeroext %
; X86-BMI1NOTBM-LABEL: bextr32_b1_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: movzbl {{[0-9]+}}(%esp), %ecx
+; X86-BMI1NOTBM-NEXT: orl %eax, %ecx
+; X86-BMI1NOTBM-NEXT: bextrl %ecx, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_b1_indexzext:
@@ -1752,11 +1730,10 @@ define i32 @bextr32_b1_indexzext(i32 %val, i8 zeroext %numskipbits, i8 zeroext %
;
; X64-BMI1NOTBM-LABEL: bextr32_b1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
+; X64-BMI1NOTBM-NEXT: bextrl %eax, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_b1_indexzext:
@@ -1792,13 +1769,12 @@ define i32 @bextr32_b2_load(i32* %w, i32 %numskipbits, i32 %numlowbits) nounwind
;
; X86-BMI1NOTBM-LABEL: bextr32_b2_load:
; X86-BMI1NOTBM: # %bb.0:
-; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %al
+; 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: shll $8, %ecx
+; X86-BMI1NOTBM-NEXT: movzbl {{[0-9]+}}(%esp), %edx
+; X86-BMI1NOTBM-NEXT: orl %ecx, %edx
+; X86-BMI1NOTBM-NEXT: bextrl %edx, (%eax), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_b2_load:
@@ -1825,12 +1801,10 @@ define i32 @bextr32_b2_load(i32* %w, i32 %numskipbits, i32 %numlowbits) nounwind
;
; X64-BMI1NOTBM-LABEL: bextr32_b2_load:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
+; X64-BMI1NOTBM-NEXT: bextrl %eax, (%rdi), %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_b2_load:
@@ -1865,13 +1839,12 @@ define i32 @bextr32_b3_load_indexzext(i32* %w, i8 zeroext %numskipbits, i8 zeroe
;
; X86-BMI1NOTBM-LABEL: bextr32_b3_load_indexzext:
; X86-BMI1NOTBM: # %bb.0:
-; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %al
+; 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: shll $8, %ecx
+; X86-BMI1NOTBM-NEXT: movzbl {{[0-9]+}}(%esp), %edx
+; X86-BMI1NOTBM-NEXT: orl %ecx, %edx
+; X86-BMI1NOTBM-NEXT: bextrl %edx, (%eax), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_b3_load_indexzext:
@@ -1898,12 +1871,10 @@ define i32 @bextr32_b3_load_indexzext(i32* %w, i8 zeroext %numskipbits, i8 zeroe
;
; X64-BMI1NOTBM-LABEL: bextr32_b3_load_indexzext:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
+; X64-BMI1NOTBM-NEXT: bextrl %eax, (%rdi), %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_b3_load_indexzext:
@@ -1940,11 +1911,10 @@ define i32 @bextr32_b4_commutative(i32 %val, i32 %numskipbits, i32 %numlowbits)
; X86-BMI1NOTBM-LABEL: bextr32_b4_commutative:
; 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: movzbl {{[0-9]+}}(%esp), %ecx
+; X86-BMI1NOTBM-NEXT: orl %eax, %ecx
+; X86-BMI1NOTBM-NEXT: bextrl %ecx, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_b4_commutative:
@@ -1969,11 +1939,10 @@ define i32 @bextr32_b4_commutative(i32 %val, i32 %numskipbits, i32 %numlowbits)
;
; X64-BMI1NOTBM-LABEL: bextr32_b4_commutative:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
+; X64-BMI1NOTBM-NEXT: bextrl %eax, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_b4_commutative:
@@ -2016,13 +1985,13 @@ define i32 @bextr32_b5_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: movb {{[0-9]+}}(%esp), %al
-; 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: movb {{[0-9]+}}(%esp), %cl
+; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X86-BMI1NOTBM-NEXT: shll $8, %ecx
+; X86-BMI1NOTBM-NEXT: movzbl %al, %edx
+; X86-BMI1NOTBM-NEXT: orl %ecx, %edx
+; X86-BMI1NOTBM-NEXT: bextrl %edx, {{[0-9]+}}(%esp), %esi
+; X86-BMI1NOTBM-NEXT: movl %eax, (%esp)
; X86-BMI1NOTBM-NEXT: calll use32
; X86-BMI1NOTBM-NEXT: movl %esi, %eax
; X86-BMI1NOTBM-NEXT: addl $8, %esp
@@ -2063,10 +2032,10 @@ define i32 @bextr32_b5_skipextrauses(i32 %val, i32 %numskipbits, i32 %numlowbits
; X64-BMI1NOTBM-LABEL: bextr32_b5_skipextrauses:
; X64-BMI1NOTBM: # %bb.0:
; X64-BMI1NOTBM-NEXT: pushq %rbx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
+; X64-BMI1NOTBM-NEXT: bextrl %eax, %edi, %ebx
; X64-BMI1NOTBM-NEXT: movl %esi, %edi
; X64-BMI1NOTBM-NEXT: callq use32
; X64-BMI1NOTBM-NEXT: movl %ebx, %eax
@@ -2214,11 +2183,10 @@ define i64 @bextr64_b0(i64 %val, i64 %numskipbits, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bextr64_b0:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: movq %rsi, %rcx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_b0:
@@ -2355,11 +2323,10 @@ 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: movl %esi, %ecx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_b1_indexzext:
@@ -2503,12 +2470,10 @@ 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: movq %rsi, %rcx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: bextrq %rax, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_b2_load:
@@ -2650,12 +2615,10 @@ 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: 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: bextrq %rax, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_b3_load_indexzext:
@@ -2796,11 +2759,10 @@ define i64 @bextr64_b4_commutative(i64 %val, i64 %numskipbits, i64 %numlowbits)
;
; X64-BMI1NOTBM-LABEL: bextr64_b4_commutative:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: movq %rsi, %rcx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_b4_commutative:
@@ -2979,10 +2941,10 @@ 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: 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rbx
; X64-BMI1NOTBM-NEXT: movq %rsi, %rdi
; X64-BMI1NOTBM-NEXT: callq use64
; X64-BMI1NOTBM-NEXT: movq %rbx, %rax
@@ -5165,11 +5127,10 @@ 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: movzbl {{[0-9]+}}(%esp), %ecx
; X86-BMI1NOTBM-NEXT: shll $8, %eax
-; X86-BMI1NOTBM-NEXT: bextrl %eax, %edx, %eax
+; X86-BMI1NOTBM-NEXT: orl %ecx, %eax
+; X86-BMI1NOTBM-NEXT: bextrl %eax, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_d0:
@@ -5194,11 +5155,10 @@ 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: # 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
+; X64-BMI1NOTBM-NEXT: bextrl %eax, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_d0:
@@ -5229,11 +5189,10 @@ 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: movzbl {{[0-9]+}}(%esp), %ecx
+; X86-BMI1NOTBM-NEXT: orl %eax, %ecx
+; X86-BMI1NOTBM-NEXT: bextrl %ecx, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_d1_indexzext:
@@ -5258,11 +5217,10 @@ 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: # 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
+; X64-BMI1NOTBM-NEXT: bextrl %eax, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_d1_indexzext:
@@ -5296,12 +5254,11 @@ 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), %ecx
+; X86-BMI1NOTBM-NEXT: movzbl {{[0-9]+}}(%esp), %edx
+; X86-BMI1NOTBM-NEXT: shll $8, %ecx
+; X86-BMI1NOTBM-NEXT: orl %edx, %ecx
+; X86-BMI1NOTBM-NEXT: bextrl %ecx, (%eax), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_d2_load:
@@ -5327,12 +5284,10 @@ define i32 @bextr32_d2_load(i32* %w, i32 %numskipbits, i32 %numlowbits) nounwind
;
; X64-BMI1NOTBM-LABEL: bextr32_d2_load:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
+; X64-BMI1NOTBM-NEXT: bextrl %eax, (%rdi), %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_d2_load:
@@ -5364,13 +5319,12 @@ 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: 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: shll $8, %ecx
+; X86-BMI1NOTBM-NEXT: movzbl {{[0-9]+}}(%esp), %edx
+; X86-BMI1NOTBM-NEXT: orl %ecx, %edx
+; X86-BMI1NOTBM-NEXT: bextrl %edx, (%eax), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bextr32_d3_load_indexzext:
@@ -5396,12 +5350,10 @@ define i32 @bextr32_d3_load_indexzext(i32* %w, i8 %numskipbits, i8 %numlowbits)
;
; X64-BMI1NOTBM-LABEL: bextr32_d3_load_indexzext:
; X64-BMI1NOTBM: # %bb.0:
-; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
+; X64-BMI1NOTBM-NEXT: bextrl %eax, (%rdi), %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_d3_load_indexzext:
@@ -5444,13 +5396,13 @@ 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), %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 {{[0-9]+}}(%esp), %eax
+; X86-BMI1NOTBM-NEXT: shll $8, %ecx
+; X86-BMI1NOTBM-NEXT: movzbl %al, %edx
+; X86-BMI1NOTBM-NEXT: orl %ecx, %edx
+; X86-BMI1NOTBM-NEXT: bextrl %edx, {{[0-9]+}}(%esp), %esi
+; X86-BMI1NOTBM-NEXT: movl %eax, (%esp)
; X86-BMI1NOTBM-NEXT: calll use32
; X86-BMI1NOTBM-NEXT: movl %esi, %eax
; X86-BMI1NOTBM-NEXT: addl $8, %esp
@@ -5491,10 +5443,10 @@ 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 %esi, %ecx
-; X64-BMI1NOTBM-NEXT: shrl %cl, %edi
; X64-BMI1NOTBM-NEXT: shll $8, %edx
-; X64-BMI1NOTBM-NEXT: bextrl %edx, %edi, %ebx
+; X64-BMI1NOTBM-NEXT: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orl %edx, %eax
+; X64-BMI1NOTBM-NEXT: bextrl %eax, %edi, %ebx
; X64-BMI1NOTBM-NEXT: movl %esi, %edi
; X64-BMI1NOTBM-NEXT: callq use32
; X64-BMI1NOTBM-NEXT: movl %ebx, %eax
@@ -5673,11 +5625,10 @@ 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: # 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_d0:
@@ -5845,11 +5796,10 @@ 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: # 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_d1_indexzext:
@@ -6023,12 +5973,10 @@ 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: movq %rsi, %rcx
-; 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: bextrq %rax, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_d2_load:
@@ -6200,12 +6148,10 @@ 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: bextrq %rax, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_d3_load_indexzext:
@@ -6419,10 +6365,10 @@ 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: movzbl %sil, %eax
+; X64-BMI1NOTBM-NEXT: orq %rdx, %rax
+; X64-BMI1NOTBM-NEXT: bextrq %rax, %rdi, %rbx
; X64-BMI1NOTBM-NEXT: movq %rsi, %rdi
; X64-BMI1NOTBM-NEXT: callq use64
; X64-BMI1NOTBM-NEXT: movq %rbx, %rax
OpenPOWER on IntegriCloud