summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/X86/extract-bits.ll328
-rw-r--r--llvm/test/CodeGen/X86/extract-lowbits.ll227
2 files changed, 191 insertions, 364 deletions
diff --git a/llvm/test/CodeGen/X86/extract-bits.ll b/llvm/test/CodeGen/X86/extract-bits.ll
index a7d91ede4be..4c0d62d5279 100644
--- a/llvm/test/CodeGen/X86/extract-bits.ll
+++ b/llvm/test/CodeGen/X86/extract-bits.ll
@@ -2813,14 +2813,12 @@ define i32 @bextr32_c0(i32 %val, i32 %numskipbits, i32 %numlowbits) nounwind {
;
; X86-BMI1NOTBM-LABEL: bextr32_c0:
; X86-BMI1NOTBM: # %bb.0:
-; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %cl
; 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: 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: retl
;
; X86-BMI1BMI2-LABEL: bextr32_c0:
@@ -2846,13 +2844,10 @@ 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, %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: shrl %cl, %edi
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
+; X64-BMI1NOTBM-NEXT: bextrl %edx, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_c0:
@@ -2882,14 +2877,12 @@ 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), %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: 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: retl
;
; X86-BMI1BMI2-LABEL: bextr32_c1_indexzext:
@@ -2915,13 +2908,10 @@ 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, %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: shrl %cl, %edi
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
+; X64-BMI1NOTBM-NEXT: bextrl %edx, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_c1_indexzext:
@@ -2954,15 +2944,13 @@ 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: movb {{[0-9]+}}(%esp), %cl
; 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: 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: retl
;
; X86-BMI1BMI2-LABEL: bextr32_c2_load:
@@ -2992,10 +2980,8 @@ 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: negl %edx
-; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
-; X64-BMI1NOTBM-NEXT: shll %cl, %eax
-; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
+; X64-BMI1NOTBM-NEXT: bextrl %edx, %eax, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_c2_load:
@@ -3027,15 +3013,13 @@ 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), %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: 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: retl
;
; X86-BMI1BMI2-LABEL: bextr32_c3_load_indexzext:
@@ -3065,10 +3049,8 @@ 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: negb %dl
-; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
-; X64-BMI1NOTBM-NEXT: shll %cl, %eax
-; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
+; X64-BMI1NOTBM-NEXT: bextrl %edx, %eax, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_c3_load_indexzext:
@@ -3101,14 +3083,12 @@ define i32 @bextr32_c4_commutative(i32 %val, i32 %numskipbits, i32 %numlowbits)
;
; X86-BMI1NOTBM-LABEL: bextr32_c4_commutative:
; X86-BMI1NOTBM: # %bb.0:
-; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %cl
; 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: 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: retl
;
; X86-BMI1BMI2-LABEL: bextr32_c4_commutative:
@@ -3134,13 +3114,10 @@ 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, %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: shrl %cl, %edi
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
+; X64-BMI1NOTBM-NEXT: bextrl %edx, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_c4_commutative:
@@ -3180,16 +3157,13 @@ 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 %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: 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: calll use32
; X86-BMI1NOTBM-NEXT: movl %esi, %eax
; X86-BMI1NOTBM-NEXT: addl $8, %esp
@@ -3230,13 +3204,10 @@ 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, %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: shrl %cl, %edi
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
+; X64-BMI1NOTBM-NEXT: bextrl %edx, %edi, %ebx
; X64-BMI1NOTBM-NEXT: movl %esi, %edi
; X64-BMI1NOTBM-NEXT: callq use32
; X64-BMI1NOTBM-NEXT: movl %ebx, %eax
@@ -3379,13 +3350,10 @@ 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, %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: shrq %cl, %rdi
+; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_c0:
@@ -3515,14 +3483,12 @@ 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, %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: shrq %cl, %rdi
+; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_c1_indexzext:
@@ -3663,10 +3629,8 @@ 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: negl %edx
-; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
-; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
-; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
+; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rax, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_c2_load:
@@ -3800,14 +3764,13 @@ 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: negb %dl
-; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
-; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
-; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
+; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rax, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_c3_load_indexzext:
@@ -3943,13 +3906,10 @@ 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, %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: shrq %cl, %rdi
+; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_c4_commutative:
@@ -4129,13 +4089,10 @@ 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 %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, %rcx
+; X64-BMI1NOTBM-NEXT: shrq %cl, %rdi
+; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rdi, %rbx
; X64-BMI1NOTBM-NEXT: movq %rsi, %rdi
; X64-BMI1NOTBM-NEXT: callq use64
; X64-BMI1NOTBM-NEXT: movq %rbx, %rax
@@ -4179,14 +4136,12 @@ define i32 @bextr32_d0(i32 %val, i32 %numskipbits, i32 %numlowbits) nounwind {
;
; X86-BMI1NOTBM-LABEL: bextr32_d0:
; X86-BMI1NOTBM: # %bb.0:
-; X86-BMI1NOTBM-NEXT: movb {{[0-9]+}}(%esp), %cl
; 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: 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: retl
;
; X86-BMI1BMI2-LABEL: bextr32_d0:
@@ -4212,13 +4167,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: movl %edi, %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
-; 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: shrl %cl, %edi
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
+; X64-BMI1NOTBM-NEXT: bextrl %edx, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_d0:
@@ -4248,14 +4200,12 @@ 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), %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: 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: retl
;
; X86-BMI1BMI2-LABEL: bextr32_d1_indexzext:
@@ -4281,13 +4231,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: movl %edi, %eax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $ecx
-; 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: shrl %cl, %edi
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
+; X64-BMI1NOTBM-NEXT: bextrl %edx, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_d1_indexzext:
@@ -4320,15 +4267,13 @@ 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: movb {{[0-9]+}}(%esp), %cl
; 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: 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: retl
;
; X86-BMI1BMI2-LABEL: bextr32_d2_load:
@@ -4358,10 +4303,8 @@ 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: negl %edx
-; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
-; X64-BMI1NOTBM-NEXT: shll %cl, %eax
-; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
+; X64-BMI1NOTBM-NEXT: bextrl %edx, %eax, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_d2_load:
@@ -4393,15 +4336,13 @@ 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), %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: 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: retl
;
; X86-BMI1BMI2-LABEL: bextr32_d3_load_indexzext:
@@ -4431,10 +4372,8 @@ 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: negb %dl
-; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
-; X64-BMI1NOTBM-NEXT: shll %cl, %eax
-; X64-BMI1NOTBM-NEXT: shrl %cl, %eax
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
+; X64-BMI1NOTBM-NEXT: bextrl %edx, %eax, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr32_d3_load_indexzext:
@@ -4477,16 +4416,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), %esi
; X86-BMI1NOTBM-NEXT: movl {{[0-9]+}}(%esp), %eax
-; 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: 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: calll use32
; X86-BMI1NOTBM-NEXT: movl %esi, %eax
; X86-BMI1NOTBM-NEXT: addl $8, %esp
@@ -4527,13 +4463,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 %edi, %ebx
; X64-BMI1NOTBM-NEXT: movl %esi, %ecx
-; 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: shrl %cl, %edi
+; X64-BMI1NOTBM-NEXT: shll $8, %edx
+; X64-BMI1NOTBM-NEXT: bextrl %edx, %edi, %ebx
; X64-BMI1NOTBM-NEXT: movl %esi, %edi
; X64-BMI1NOTBM-NEXT: callq use32
; X64-BMI1NOTBM-NEXT: movl %ebx, %eax
@@ -4713,13 +4646,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: movq %rdi, %rax
; X64-BMI1NOTBM-NEXT: # kill: def $cl killed $cl killed $rcx
-; 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: shrq %cl, %rdi
+; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_d0:
@@ -4886,14 +4816,12 @@ 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, %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: shrq %cl, %rdi
+; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_d1_indexzext:
@@ -5071,10 +4999,8 @@ 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: negl %edx
-; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
-; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
-; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
+; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rax, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_d2_load:
@@ -5245,14 +5171,13 @@ 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: negb %dl
-; X64-BMI1NOTBM-NEXT: movl %edx, %ecx
-; X64-BMI1NOTBM-NEXT: shlq %cl, %rax
-; X64-BMI1NOTBM-NEXT: shrq %cl, %rax
+; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rax, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bextr64_d3_load_indexzext:
@@ -5466,13 +5391,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 %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, %rcx
+; X64-BMI1NOTBM-NEXT: shrq %cl, %rdi
+; X64-BMI1NOTBM-NEXT: shlq $8, %rdx
+; X64-BMI1NOTBM-NEXT: bextrq %rdx, %rdi, %rbx
; X64-BMI1NOTBM-NEXT: movq %rsi, %rdi
; X64-BMI1NOTBM-NEXT: callq use64
; X64-BMI1NOTBM-NEXT: movq %rbx, %rax
diff --git a/llvm/test/CodeGen/X86/extract-lowbits.ll b/llvm/test/CodeGen/X86/extract-lowbits.ll
index eae52441dfc..f81280a5290 100644
--- a/llvm/test/CodeGen/X86/extract-lowbits.ll
+++ b/llvm/test/CodeGen/X86/extract-lowbits.ll
@@ -1442,11 +1442,8 @@ 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: 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: shll $8, %eax
+; X86-BMI1NOTBM-NEXT: bextrl %eax, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bzhi32_c0:
@@ -1467,12 +1464,8 @@ define i32 @bzhi32_c0(i32 %val, i32 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi32_c0:
; X64-BMI1NOTBM: # %bb.0:
-; 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: shll $8, %esi
+; X64-BMI1NOTBM-NEXT: bextrl %esi, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_c0:
@@ -1498,12 +1491,9 @@ define i32 @bzhi32_c1_indexzext(i32 %val, i8 %numlowbits) nounwind {
;
; X86-BMI1NOTBM-LABEL: bzhi32_c1_indexzext:
; X86-BMI1NOTBM: # %bb.0:
-; 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: movb {{[0-9]+}}(%esp), %al
+; X86-BMI1NOTBM-NEXT: shll $8, %eax
+; X86-BMI1NOTBM-NEXT: bextrl %eax, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bzhi32_c1_indexzext:
@@ -1524,12 +1514,8 @@ define i32 @bzhi32_c1_indexzext(i32 %val, i8 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi32_c1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
-; 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: shll $8, %esi
+; X64-BMI1NOTBM-NEXT: bextrl %esi, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_c1_indexzext:
@@ -1558,19 +1544,16 @@ 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 (%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: movl {{[0-9]+}}(%esp), %ecx
+; X86-BMI1NOTBM-NEXT: shll $8, %ecx
+; X86-BMI1NOTBM-NEXT: bextrl %ecx, (%eax), %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 %eax, (%ecx), %eax
+; X86-BMI1BMI2-NEXT: bzhil %ecx, (%eax), %eax
; X86-BMI1BMI2-NEXT: retl
;
; X64-NOBMI-LABEL: bzhi32_c2_load:
@@ -1585,12 +1568,8 @@ define i32 @bzhi32_c2_load(i32* %w, i32 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi32_c2_load:
; X64-BMI1NOTBM: # %bb.0:
-; 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: shll $8, %esi
+; X64-BMI1NOTBM-NEXT: bextrl %esi, (%rdi), %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_c2_load:
@@ -1619,12 +1598,9 @@ 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: 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: movb {{[0-9]+}}(%esp), %cl
+; X86-BMI1NOTBM-NEXT: shll $8, %ecx
+; X86-BMI1NOTBM-NEXT: bextrl %ecx, (%eax), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bzhi32_c3_load_indexzext:
@@ -1646,12 +1622,8 @@ 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: 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: shll $8, %esi
+; X64-BMI1NOTBM-NEXT: bextrl %esi, (%rdi), %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_c3_load_indexzext:
@@ -1680,11 +1652,8 @@ 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: 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: shll $8, %eax
+; X86-BMI1NOTBM-NEXT: bextrl %eax, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bzhi32_c4_commutative:
@@ -1705,12 +1674,8 @@ define i32 @bzhi32_c4_commutative(i32 %val, i32 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi32_c4_commutative:
; X64-BMI1NOTBM: # %bb.0:
-; 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: shll $8, %esi
+; X64-BMI1NOTBM-NEXT: bextrl %esi, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_c4_commutative:
@@ -1791,12 +1756,8 @@ define i64 @bzhi64_c0(i64 %val, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_c0:
; X64-BMI1NOTBM: # %bb.0:
-; 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: shlq $8, %rsi
+; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_c0:
@@ -1875,12 +1836,9 @@ define i64 @bzhi64_c1_indexzext(i64 %val, i8 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_c1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
-; 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: # kill: def $esi killed $esi def $rsi
+; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
+; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_c1_indexzext:
@@ -1970,12 +1928,8 @@ define i64 @bzhi64_c2_load(i64* %w, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_c2_load:
; X64-BMI1NOTBM: # %bb.0:
-; 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: shlq $8, %rsi
+; X64-BMI1NOTBM-NEXT: bextrq %rsi, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_c2_load:
@@ -2064,12 +2018,9 @@ 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: 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: # kill: def $esi killed $esi def $rsi
+; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
+; X64-BMI1NOTBM-NEXT: bextrq %rsi, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_c3_load_indexzext:
@@ -2151,12 +2102,8 @@ define i64 @bzhi64_c4_commutative(i64 %val, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_c4_commutative:
; X64-BMI1NOTBM: # %bb.0:
-; 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: shlq $8, %rsi
+; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_c4_commutative:
@@ -2187,11 +2134,8 @@ 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: 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: shll $8, %eax
+; X86-BMI1NOTBM-NEXT: bextrl %eax, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bzhi32_d0:
@@ -2212,12 +2156,8 @@ define i32 @bzhi32_d0(i32 %val, i32 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi32_d0:
; X64-BMI1NOTBM: # %bb.0:
-; 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: shll $8, %esi
+; X64-BMI1NOTBM-NEXT: bextrl %esi, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_d0:
@@ -2243,12 +2183,9 @@ define i32 @bzhi32_d1_indexzext(i32 %val, i8 %numlowbits) nounwind {
;
; X86-BMI1NOTBM-LABEL: bzhi32_d1_indexzext:
; X86-BMI1NOTBM: # %bb.0:
-; 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: movb {{[0-9]+}}(%esp), %al
+; X86-BMI1NOTBM-NEXT: shll $8, %eax
+; X86-BMI1NOTBM-NEXT: bextrl %eax, {{[0-9]+}}(%esp), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bzhi32_d1_indexzext:
@@ -2269,12 +2206,8 @@ define i32 @bzhi32_d1_indexzext(i32 %val, i8 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi32_d1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
-; 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: shll $8, %esi
+; X64-BMI1NOTBM-NEXT: bextrl %esi, %edi, %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_d1_indexzext:
@@ -2303,19 +2236,16 @@ 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 (%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: movl {{[0-9]+}}(%esp), %ecx
+; X86-BMI1NOTBM-NEXT: shll $8, %ecx
+; X86-BMI1NOTBM-NEXT: bextrl %ecx, (%eax), %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 %eax, (%ecx), %eax
+; X86-BMI1BMI2-NEXT: bzhil %ecx, (%eax), %eax
; X86-BMI1BMI2-NEXT: retl
;
; X64-NOBMI-LABEL: bzhi32_d2_load:
@@ -2330,12 +2260,8 @@ define i32 @bzhi32_d2_load(i32* %w, i32 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi32_d2_load:
; X64-BMI1NOTBM: # %bb.0:
-; 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: shll $8, %esi
+; X64-BMI1NOTBM-NEXT: bextrl %esi, (%rdi), %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_d2_load:
@@ -2364,12 +2290,9 @@ 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: 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: movb {{[0-9]+}}(%esp), %cl
+; X86-BMI1NOTBM-NEXT: shll $8, %ecx
+; X86-BMI1NOTBM-NEXT: bextrl %ecx, (%eax), %eax
; X86-BMI1NOTBM-NEXT: retl
;
; X86-BMI1BMI2-LABEL: bzhi32_d3_load_indexzext:
@@ -2391,12 +2314,8 @@ 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: 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: shll $8, %esi
+; X64-BMI1NOTBM-NEXT: bextrl %esi, (%rdi), %eax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi32_d3_load_indexzext:
@@ -2536,12 +2455,8 @@ define i64 @bzhi64_d0(i64 %val, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_d0:
; X64-BMI1NOTBM: # %bb.0:
-; 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: shlq $8, %rsi
+; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_d0:
@@ -2677,12 +2592,9 @@ define i64 @bzhi64_d1_indexzext(i64 %val, i8 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_d1_indexzext:
; X64-BMI1NOTBM: # %bb.0:
-; 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: # kill: def $esi killed $esi def $rsi
+; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
+; X64-BMI1NOTBM-NEXT: bextrq %rsi, %rdi, %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_d1_indexzext:
@@ -2823,12 +2735,8 @@ define i64 @bzhi64_d2_load(i64* %w, i64 %numlowbits) nounwind {
;
; X64-BMI1NOTBM-LABEL: bzhi64_d2_load:
; X64-BMI1NOTBM: # %bb.0:
-; 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: shlq $8, %rsi
+; X64-BMI1NOTBM-NEXT: bextrq %rsi, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_d2_load:
@@ -2968,12 +2876,9 @@ 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: 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: # kill: def $esi killed $esi def $rsi
+; X64-BMI1NOTBM-NEXT: shlq $8, %rsi
+; X64-BMI1NOTBM-NEXT: bextrq %rsi, (%rdi), %rax
; X64-BMI1NOTBM-NEXT: retq
;
; X64-BMI1BMI2-LABEL: bzhi64_d3_load_indexzext:
OpenPOWER on IntegriCloud