[X86] Add CMOV to i686 BMI/TBM tests

As mentioned on D75748, there is no such target that has BMI/TBM support but not the much older CMOV.
This commit is contained in:
Simon Pilgrim 2020-03-06 17:26:20 +00:00
parent 7a2ab876fd
commit fb8149cac8

View File

@ -1,9 +1,9 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=i686-unknown-linux-gnu -mattr=-bmi,-tbm,-bmi2 < %s | FileCheck %s --check-prefixes=CHECK,X86,NOBMI2,X86-NOBMI2,FALLBACK0,X86-FALLBACK0
; RUN: llc -mtriple=i686-unknown-linux-gnu -mattr=+bmi,-tbm,-bmi2 < %s | FileCheck %s --check-prefixes=CHECK,X86,NOBMI2,X86-NOBMI2,FALLBACK1,X86-FALLBACK1
; RUN: llc -mtriple=i686-unknown-linux-gnu -mattr=+bmi,+tbm,-bmi2 < %s | FileCheck %s --check-prefixes=CHECK,X86,NOBMI2,X86-NOBMI2,FALLBACK2,X86-FALLBACK2
; RUN: llc -mtriple=i686-unknown-linux-gnu -mattr=+bmi,+tbm,+bmi2 < %s | FileCheck %s --check-prefixes=CHECK,X86,BMI2,X86-BMI2,FALLBACK3,X86-FALLBACK3
; RUN: llc -mtriple=i686-unknown-linux-gnu -mattr=+bmi,-tbm,+bmi2 < %s | FileCheck %s --check-prefixes=CHECK,X86,BMI2,X86-BMI2,FALLBACK4,X86-FALLBACK4
; RUN: llc -mtriple=i686-unknown-linux-gnu -mattr=+cmov,+bmi,-tbm,-bmi2 < %s | FileCheck %s --check-prefixes=CHECK,X86,NOBMI2,X86-NOBMI2,FALLBACK1,X86-FALLBACK1
; RUN: llc -mtriple=i686-unknown-linux-gnu -mattr=+cmov,+bmi,+tbm,-bmi2 < %s | FileCheck %s --check-prefixes=CHECK,X86,NOBMI2,X86-NOBMI2,FALLBACK2,X86-FALLBACK2
; RUN: llc -mtriple=i686-unknown-linux-gnu -mattr=+cmov,+bmi,+tbm,+bmi2 < %s | FileCheck %s --check-prefixes=CHECK,X86,BMI2,X86-BMI2,FALLBACK3,X86-FALLBACK3
; RUN: llc -mtriple=i686-unknown-linux-gnu -mattr=+cmov,+bmi,-tbm,+bmi2 < %s | FileCheck %s --check-prefixes=CHECK,X86,BMI2,X86-BMI2,FALLBACK4,X86-FALLBACK4
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=-bmi,-tbm,-bmi2 < %s | FileCheck %s --check-prefixes=CHECK,X64,NOBMI2,X64-NOBMI2,FALLBACK0,X64-FALLBACK0
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=+bmi,-tbm,-bmi2 < %s | FileCheck %s --check-prefixes=CHECK,X64,NOBMI2,X64-NOBMI2,FALLBACK1,X64-FALLBACK1
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=+bmi,+tbm,-bmi2 < %s | FileCheck %s --check-prefixes=CHECK,X64,NOBMI2,X64-NOBMI2,FALLBACK2,X64-FALLBACK2
@ -511,37 +511,71 @@ define i32 @clear_highbits32_c4_commutative(i32 %val, i32 %numhighbits) nounwind
; ---------------------------------------------------------------------------- ;
define i64 @clear_highbits64_c0(i64 %val, i64 %numhighbits) nounwind {
; X86-NOBMI2-LABEL: clear_highbits64_c0:
; X86-NOBMI2: # %bb.0:
; X86-NOBMI2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-NOBMI2-NEXT: movl $-1, %eax
; X86-NOBMI2-NEXT: movl $-1, %edx
; X86-NOBMI2-NEXT: shrl %cl, %edx
; X86-NOBMI2-NEXT: shrdl %cl, %eax, %eax
; X86-NOBMI2-NEXT: testb $32, %cl
; X86-NOBMI2-NEXT: je .LBB13_2
; X86-NOBMI2-NEXT: # %bb.1:
; X86-NOBMI2-NEXT: movl %edx, %eax
; X86-NOBMI2-NEXT: xorl %edx, %edx
; X86-NOBMI2-NEXT: .LBB13_2:
; X86-NOBMI2-NEXT: andl {{[0-9]+}}(%esp), %eax
; X86-NOBMI2-NEXT: andl {{[0-9]+}}(%esp), %edx
; X86-NOBMI2-NEXT: retl
; X86-FALLBACK0-LABEL: clear_highbits64_c0:
; X86-FALLBACK0: # %bb.0:
; X86-FALLBACK0-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK0-NEXT: movl $-1, %eax
; X86-FALLBACK0-NEXT: movl $-1, %edx
; X86-FALLBACK0-NEXT: shrl %cl, %edx
; X86-FALLBACK0-NEXT: shrdl %cl, %eax, %eax
; X86-FALLBACK0-NEXT: testb $32, %cl
; X86-FALLBACK0-NEXT: je .LBB13_2
; X86-FALLBACK0-NEXT: # %bb.1:
; X86-FALLBACK0-NEXT: movl %edx, %eax
; X86-FALLBACK0-NEXT: xorl %edx, %edx
; X86-FALLBACK0-NEXT: .LBB13_2:
; X86-FALLBACK0-NEXT: andl {{[0-9]+}}(%esp), %eax
; X86-FALLBACK0-NEXT: andl {{[0-9]+}}(%esp), %edx
; X86-FALLBACK0-NEXT: retl
;
; X86-FALLBACK1-LABEL: clear_highbits64_c0:
; X86-FALLBACK1: # %bb.0:
; X86-FALLBACK1-NEXT: pushl %esi
; X86-FALLBACK1-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK1-NEXT: movl $-1, %eax
; X86-FALLBACK1-NEXT: movl $-1, %esi
; X86-FALLBACK1-NEXT: shrl %cl, %esi
; X86-FALLBACK1-NEXT: shrdl %cl, %eax, %eax
; X86-FALLBACK1-NEXT: xorl %edx, %edx
; X86-FALLBACK1-NEXT: testb $32, %cl
; X86-FALLBACK1-NEXT: cmovnel %esi, %eax
; X86-FALLBACK1-NEXT: cmovel %esi, %edx
; X86-FALLBACK1-NEXT: andl {{[0-9]+}}(%esp), %eax
; X86-FALLBACK1-NEXT: andl {{[0-9]+}}(%esp), %edx
; X86-FALLBACK1-NEXT: popl %esi
; X86-FALLBACK1-NEXT: retl
;
; X86-FALLBACK2-LABEL: clear_highbits64_c0:
; X86-FALLBACK2: # %bb.0:
; X86-FALLBACK2-NEXT: pushl %esi
; X86-FALLBACK2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK2-NEXT: movl $-1, %eax
; X86-FALLBACK2-NEXT: movl $-1, %esi
; X86-FALLBACK2-NEXT: shrl %cl, %esi
; X86-FALLBACK2-NEXT: shrdl %cl, %eax, %eax
; X86-FALLBACK2-NEXT: xorl %edx, %edx
; X86-FALLBACK2-NEXT: testb $32, %cl
; X86-FALLBACK2-NEXT: cmovnel %esi, %eax
; X86-FALLBACK2-NEXT: cmovel %esi, %edx
; X86-FALLBACK2-NEXT: andl {{[0-9]+}}(%esp), %eax
; X86-FALLBACK2-NEXT: andl {{[0-9]+}}(%esp), %edx
; X86-FALLBACK2-NEXT: popl %esi
; X86-FALLBACK2-NEXT: retl
;
; X86-BMI2-LABEL: clear_highbits64_c0:
; X86-BMI2: # %bb.0:
; X86-BMI2-NEXT: pushl %esi
; X86-BMI2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-BMI2-NEXT: movl $-1, %eax
; X86-BMI2-NEXT: shrxl %ecx, %eax, %edx
; X86-BMI2-NEXT: shrxl %ecx, %eax, %esi
; X86-BMI2-NEXT: shrdl %cl, %eax, %eax
; X86-BMI2-NEXT: testb $32, %cl
; X86-BMI2-NEXT: je .LBB13_2
; X86-BMI2-NEXT: # %bb.1:
; X86-BMI2-NEXT: movl %edx, %eax
; X86-BMI2-NEXT: xorl %edx, %edx
; X86-BMI2-NEXT: .LBB13_2:
; X86-BMI2-NEXT: testb $32, %cl
; X86-BMI2-NEXT: cmovnel %esi, %eax
; X86-BMI2-NEXT: cmovel %esi, %edx
; X86-BMI2-NEXT: andl {{[0-9]+}}(%esp), %eax
; X86-BMI2-NEXT: andl {{[0-9]+}}(%esp), %edx
; X86-BMI2-NEXT: popl %esi
; X86-BMI2-NEXT: retl
;
; X64-NOBMI2-LABEL: clear_highbits64_c0:
@ -564,37 +598,71 @@ define i64 @clear_highbits64_c0(i64 %val, i64 %numhighbits) nounwind {
}
define i64 @clear_highbits64_c1_indexzext(i64 %val, i8 %numhighbits) nounwind {
; X86-NOBMI2-LABEL: clear_highbits64_c1_indexzext:
; X86-NOBMI2: # %bb.0:
; X86-NOBMI2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-NOBMI2-NEXT: movl $-1, %eax
; X86-NOBMI2-NEXT: movl $-1, %edx
; X86-NOBMI2-NEXT: shrl %cl, %edx
; X86-NOBMI2-NEXT: shrdl %cl, %eax, %eax
; X86-NOBMI2-NEXT: testb $32, %cl
; X86-NOBMI2-NEXT: je .LBB14_2
; X86-NOBMI2-NEXT: # %bb.1:
; X86-NOBMI2-NEXT: movl %edx, %eax
; X86-NOBMI2-NEXT: xorl %edx, %edx
; X86-NOBMI2-NEXT: .LBB14_2:
; X86-NOBMI2-NEXT: andl {{[0-9]+}}(%esp), %eax
; X86-NOBMI2-NEXT: andl {{[0-9]+}}(%esp), %edx
; X86-NOBMI2-NEXT: retl
; X86-FALLBACK0-LABEL: clear_highbits64_c1_indexzext:
; X86-FALLBACK0: # %bb.0:
; X86-FALLBACK0-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK0-NEXT: movl $-1, %eax
; X86-FALLBACK0-NEXT: movl $-1, %edx
; X86-FALLBACK0-NEXT: shrl %cl, %edx
; X86-FALLBACK0-NEXT: shrdl %cl, %eax, %eax
; X86-FALLBACK0-NEXT: testb $32, %cl
; X86-FALLBACK0-NEXT: je .LBB14_2
; X86-FALLBACK0-NEXT: # %bb.1:
; X86-FALLBACK0-NEXT: movl %edx, %eax
; X86-FALLBACK0-NEXT: xorl %edx, %edx
; X86-FALLBACK0-NEXT: .LBB14_2:
; X86-FALLBACK0-NEXT: andl {{[0-9]+}}(%esp), %eax
; X86-FALLBACK0-NEXT: andl {{[0-9]+}}(%esp), %edx
; X86-FALLBACK0-NEXT: retl
;
; X86-FALLBACK1-LABEL: clear_highbits64_c1_indexzext:
; X86-FALLBACK1: # %bb.0:
; X86-FALLBACK1-NEXT: pushl %esi
; X86-FALLBACK1-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK1-NEXT: movl $-1, %eax
; X86-FALLBACK1-NEXT: movl $-1, %esi
; X86-FALLBACK1-NEXT: shrl %cl, %esi
; X86-FALLBACK1-NEXT: shrdl %cl, %eax, %eax
; X86-FALLBACK1-NEXT: xorl %edx, %edx
; X86-FALLBACK1-NEXT: testb $32, %cl
; X86-FALLBACK1-NEXT: cmovnel %esi, %eax
; X86-FALLBACK1-NEXT: cmovel %esi, %edx
; X86-FALLBACK1-NEXT: andl {{[0-9]+}}(%esp), %eax
; X86-FALLBACK1-NEXT: andl {{[0-9]+}}(%esp), %edx
; X86-FALLBACK1-NEXT: popl %esi
; X86-FALLBACK1-NEXT: retl
;
; X86-FALLBACK2-LABEL: clear_highbits64_c1_indexzext:
; X86-FALLBACK2: # %bb.0:
; X86-FALLBACK2-NEXT: pushl %esi
; X86-FALLBACK2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK2-NEXT: movl $-1, %eax
; X86-FALLBACK2-NEXT: movl $-1, %esi
; X86-FALLBACK2-NEXT: shrl %cl, %esi
; X86-FALLBACK2-NEXT: shrdl %cl, %eax, %eax
; X86-FALLBACK2-NEXT: xorl %edx, %edx
; X86-FALLBACK2-NEXT: testb $32, %cl
; X86-FALLBACK2-NEXT: cmovnel %esi, %eax
; X86-FALLBACK2-NEXT: cmovel %esi, %edx
; X86-FALLBACK2-NEXT: andl {{[0-9]+}}(%esp), %eax
; X86-FALLBACK2-NEXT: andl {{[0-9]+}}(%esp), %edx
; X86-FALLBACK2-NEXT: popl %esi
; X86-FALLBACK2-NEXT: retl
;
; X86-BMI2-LABEL: clear_highbits64_c1_indexzext:
; X86-BMI2: # %bb.0:
; X86-BMI2-NEXT: pushl %esi
; X86-BMI2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-BMI2-NEXT: movl $-1, %eax
; X86-BMI2-NEXT: shrxl %ecx, %eax, %edx
; X86-BMI2-NEXT: shrxl %ecx, %eax, %esi
; X86-BMI2-NEXT: shrdl %cl, %eax, %eax
; X86-BMI2-NEXT: testb $32, %cl
; X86-BMI2-NEXT: je .LBB14_2
; X86-BMI2-NEXT: # %bb.1:
; X86-BMI2-NEXT: movl %edx, %eax
; X86-BMI2-NEXT: xorl %edx, %edx
; X86-BMI2-NEXT: .LBB14_2:
; X86-BMI2-NEXT: testb $32, %cl
; X86-BMI2-NEXT: cmovnel %esi, %eax
; X86-BMI2-NEXT: cmovel %esi, %edx
; X86-BMI2-NEXT: andl {{[0-9]+}}(%esp), %eax
; X86-BMI2-NEXT: andl {{[0-9]+}}(%esp), %edx
; X86-BMI2-NEXT: popl %esi
; X86-BMI2-NEXT: retl
;
; X64-NOBMI2-LABEL: clear_highbits64_c1_indexzext:
@ -619,43 +687,83 @@ define i64 @clear_highbits64_c1_indexzext(i64 %val, i8 %numhighbits) nounwind {
}
define i64 @clear_highbits64_c2_load(i64* %w, i64 %numhighbits) nounwind {
; X86-NOBMI2-LABEL: clear_highbits64_c2_load:
; X86-NOBMI2: # %bb.0:
; X86-NOBMI2-NEXT: pushl %esi
; X86-NOBMI2-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-NOBMI2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-NOBMI2-NEXT: movl $-1, %eax
; X86-NOBMI2-NEXT: movl $-1, %edx
; X86-NOBMI2-NEXT: shrl %cl, %edx
; X86-NOBMI2-NEXT: shrdl %cl, %eax, %eax
; X86-NOBMI2-NEXT: testb $32, %cl
; X86-NOBMI2-NEXT: je .LBB15_2
; X86-NOBMI2-NEXT: # %bb.1:
; X86-NOBMI2-NEXT: movl %edx, %eax
; X86-NOBMI2-NEXT: xorl %edx, %edx
; X86-NOBMI2-NEXT: .LBB15_2:
; X86-NOBMI2-NEXT: andl (%esi), %eax
; X86-NOBMI2-NEXT: andl 4(%esi), %edx
; X86-NOBMI2-NEXT: popl %esi
; X86-NOBMI2-NEXT: retl
; X86-FALLBACK0-LABEL: clear_highbits64_c2_load:
; X86-FALLBACK0: # %bb.0:
; X86-FALLBACK0-NEXT: pushl %esi
; X86-FALLBACK0-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-FALLBACK0-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK0-NEXT: movl $-1, %eax
; X86-FALLBACK0-NEXT: movl $-1, %edx
; X86-FALLBACK0-NEXT: shrl %cl, %edx
; X86-FALLBACK0-NEXT: shrdl %cl, %eax, %eax
; X86-FALLBACK0-NEXT: testb $32, %cl
; X86-FALLBACK0-NEXT: je .LBB15_2
; X86-FALLBACK0-NEXT: # %bb.1:
; X86-FALLBACK0-NEXT: movl %edx, %eax
; X86-FALLBACK0-NEXT: xorl %edx, %edx
; X86-FALLBACK0-NEXT: .LBB15_2:
; X86-FALLBACK0-NEXT: andl (%esi), %eax
; X86-FALLBACK0-NEXT: andl 4(%esi), %edx
; X86-FALLBACK0-NEXT: popl %esi
; X86-FALLBACK0-NEXT: retl
;
; X86-FALLBACK1-LABEL: clear_highbits64_c2_load:
; X86-FALLBACK1: # %bb.0:
; X86-FALLBACK1-NEXT: pushl %edi
; X86-FALLBACK1-NEXT: pushl %esi
; X86-FALLBACK1-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-FALLBACK1-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK1-NEXT: movl $-1, %eax
; X86-FALLBACK1-NEXT: movl $-1, %edi
; X86-FALLBACK1-NEXT: shrl %cl, %edi
; X86-FALLBACK1-NEXT: shrdl %cl, %eax, %eax
; X86-FALLBACK1-NEXT: xorl %edx, %edx
; X86-FALLBACK1-NEXT: testb $32, %cl
; X86-FALLBACK1-NEXT: cmovnel %edi, %eax
; X86-FALLBACK1-NEXT: cmovel %edi, %edx
; X86-FALLBACK1-NEXT: andl (%esi), %eax
; X86-FALLBACK1-NEXT: andl 4(%esi), %edx
; X86-FALLBACK1-NEXT: popl %esi
; X86-FALLBACK1-NEXT: popl %edi
; X86-FALLBACK1-NEXT: retl
;
; X86-FALLBACK2-LABEL: clear_highbits64_c2_load:
; X86-FALLBACK2: # %bb.0:
; X86-FALLBACK2-NEXT: pushl %edi
; X86-FALLBACK2-NEXT: pushl %esi
; X86-FALLBACK2-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-FALLBACK2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK2-NEXT: movl $-1, %eax
; X86-FALLBACK2-NEXT: movl $-1, %edi
; X86-FALLBACK2-NEXT: shrl %cl, %edi
; X86-FALLBACK2-NEXT: shrdl %cl, %eax, %eax
; X86-FALLBACK2-NEXT: xorl %edx, %edx
; X86-FALLBACK2-NEXT: testb $32, %cl
; X86-FALLBACK2-NEXT: cmovnel %edi, %eax
; X86-FALLBACK2-NEXT: cmovel %edi, %edx
; X86-FALLBACK2-NEXT: andl (%esi), %eax
; X86-FALLBACK2-NEXT: andl 4(%esi), %edx
; X86-FALLBACK2-NEXT: popl %esi
; X86-FALLBACK2-NEXT: popl %edi
; X86-FALLBACK2-NEXT: retl
;
; X86-BMI2-LABEL: clear_highbits64_c2_load:
; X86-BMI2: # %bb.0:
; X86-BMI2-NEXT: pushl %edi
; X86-BMI2-NEXT: pushl %esi
; X86-BMI2-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-BMI2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-BMI2-NEXT: movl $-1, %eax
; X86-BMI2-NEXT: shrxl %ecx, %eax, %edx
; X86-BMI2-NEXT: shrxl %ecx, %eax, %edi
; X86-BMI2-NEXT: shrdl %cl, %eax, %eax
; X86-BMI2-NEXT: testb $32, %cl
; X86-BMI2-NEXT: je .LBB15_2
; X86-BMI2-NEXT: # %bb.1:
; X86-BMI2-NEXT: movl %edx, %eax
; X86-BMI2-NEXT: xorl %edx, %edx
; X86-BMI2-NEXT: .LBB15_2:
; X86-BMI2-NEXT: testb $32, %cl
; X86-BMI2-NEXT: cmovnel %edi, %eax
; X86-BMI2-NEXT: cmovel %edi, %edx
; X86-BMI2-NEXT: andl (%esi), %eax
; X86-BMI2-NEXT: andl 4(%esi), %edx
; X86-BMI2-NEXT: popl %esi
; X86-BMI2-NEXT: popl %edi
; X86-BMI2-NEXT: retl
;
; X64-NOBMI2-LABEL: clear_highbits64_c2_load:
@ -679,43 +787,83 @@ define i64 @clear_highbits64_c2_load(i64* %w, i64 %numhighbits) nounwind {
}
define i64 @clear_highbits64_c3_load_indexzext(i64* %w, i8 %numhighbits) nounwind {
; X86-NOBMI2-LABEL: clear_highbits64_c3_load_indexzext:
; X86-NOBMI2: # %bb.0:
; X86-NOBMI2-NEXT: pushl %esi
; X86-NOBMI2-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-NOBMI2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-NOBMI2-NEXT: movl $-1, %eax
; X86-NOBMI2-NEXT: movl $-1, %edx
; X86-NOBMI2-NEXT: shrl %cl, %edx
; X86-NOBMI2-NEXT: shrdl %cl, %eax, %eax
; X86-NOBMI2-NEXT: testb $32, %cl
; X86-NOBMI2-NEXT: je .LBB16_2
; X86-NOBMI2-NEXT: # %bb.1:
; X86-NOBMI2-NEXT: movl %edx, %eax
; X86-NOBMI2-NEXT: xorl %edx, %edx
; X86-NOBMI2-NEXT: .LBB16_2:
; X86-NOBMI2-NEXT: andl (%esi), %eax
; X86-NOBMI2-NEXT: andl 4(%esi), %edx
; X86-NOBMI2-NEXT: popl %esi
; X86-NOBMI2-NEXT: retl
; X86-FALLBACK0-LABEL: clear_highbits64_c3_load_indexzext:
; X86-FALLBACK0: # %bb.0:
; X86-FALLBACK0-NEXT: pushl %esi
; X86-FALLBACK0-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-FALLBACK0-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK0-NEXT: movl $-1, %eax
; X86-FALLBACK0-NEXT: movl $-1, %edx
; X86-FALLBACK0-NEXT: shrl %cl, %edx
; X86-FALLBACK0-NEXT: shrdl %cl, %eax, %eax
; X86-FALLBACK0-NEXT: testb $32, %cl
; X86-FALLBACK0-NEXT: je .LBB16_2
; X86-FALLBACK0-NEXT: # %bb.1:
; X86-FALLBACK0-NEXT: movl %edx, %eax
; X86-FALLBACK0-NEXT: xorl %edx, %edx
; X86-FALLBACK0-NEXT: .LBB16_2:
; X86-FALLBACK0-NEXT: andl (%esi), %eax
; X86-FALLBACK0-NEXT: andl 4(%esi), %edx
; X86-FALLBACK0-NEXT: popl %esi
; X86-FALLBACK0-NEXT: retl
;
; X86-FALLBACK1-LABEL: clear_highbits64_c3_load_indexzext:
; X86-FALLBACK1: # %bb.0:
; X86-FALLBACK1-NEXT: pushl %edi
; X86-FALLBACK1-NEXT: pushl %esi
; X86-FALLBACK1-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-FALLBACK1-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK1-NEXT: movl $-1, %eax
; X86-FALLBACK1-NEXT: movl $-1, %edi
; X86-FALLBACK1-NEXT: shrl %cl, %edi
; X86-FALLBACK1-NEXT: shrdl %cl, %eax, %eax
; X86-FALLBACK1-NEXT: xorl %edx, %edx
; X86-FALLBACK1-NEXT: testb $32, %cl
; X86-FALLBACK1-NEXT: cmovnel %edi, %eax
; X86-FALLBACK1-NEXT: cmovel %edi, %edx
; X86-FALLBACK1-NEXT: andl (%esi), %eax
; X86-FALLBACK1-NEXT: andl 4(%esi), %edx
; X86-FALLBACK1-NEXT: popl %esi
; X86-FALLBACK1-NEXT: popl %edi
; X86-FALLBACK1-NEXT: retl
;
; X86-FALLBACK2-LABEL: clear_highbits64_c3_load_indexzext:
; X86-FALLBACK2: # %bb.0:
; X86-FALLBACK2-NEXT: pushl %edi
; X86-FALLBACK2-NEXT: pushl %esi
; X86-FALLBACK2-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-FALLBACK2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK2-NEXT: movl $-1, %eax
; X86-FALLBACK2-NEXT: movl $-1, %edi
; X86-FALLBACK2-NEXT: shrl %cl, %edi
; X86-FALLBACK2-NEXT: shrdl %cl, %eax, %eax
; X86-FALLBACK2-NEXT: xorl %edx, %edx
; X86-FALLBACK2-NEXT: testb $32, %cl
; X86-FALLBACK2-NEXT: cmovnel %edi, %eax
; X86-FALLBACK2-NEXT: cmovel %edi, %edx
; X86-FALLBACK2-NEXT: andl (%esi), %eax
; X86-FALLBACK2-NEXT: andl 4(%esi), %edx
; X86-FALLBACK2-NEXT: popl %esi
; X86-FALLBACK2-NEXT: popl %edi
; X86-FALLBACK2-NEXT: retl
;
; X86-BMI2-LABEL: clear_highbits64_c3_load_indexzext:
; X86-BMI2: # %bb.0:
; X86-BMI2-NEXT: pushl %edi
; X86-BMI2-NEXT: pushl %esi
; X86-BMI2-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-BMI2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-BMI2-NEXT: movl $-1, %eax
; X86-BMI2-NEXT: shrxl %ecx, %eax, %edx
; X86-BMI2-NEXT: shrxl %ecx, %eax, %edi
; X86-BMI2-NEXT: shrdl %cl, %eax, %eax
; X86-BMI2-NEXT: testb $32, %cl
; X86-BMI2-NEXT: je .LBB16_2
; X86-BMI2-NEXT: # %bb.1:
; X86-BMI2-NEXT: movl %edx, %eax
; X86-BMI2-NEXT: xorl %edx, %edx
; X86-BMI2-NEXT: .LBB16_2:
; X86-BMI2-NEXT: testb $32, %cl
; X86-BMI2-NEXT: cmovnel %edi, %eax
; X86-BMI2-NEXT: cmovel %edi, %edx
; X86-BMI2-NEXT: andl (%esi), %eax
; X86-BMI2-NEXT: andl 4(%esi), %edx
; X86-BMI2-NEXT: popl %esi
; X86-BMI2-NEXT: popl %edi
; X86-BMI2-NEXT: retl
;
; X64-NOBMI2-LABEL: clear_highbits64_c3_load_indexzext:
@ -741,37 +889,71 @@ define i64 @clear_highbits64_c3_load_indexzext(i64* %w, i8 %numhighbits) nounwin
}
define i64 @clear_highbits64_c4_commutative(i64 %val, i64 %numhighbits) nounwind {
; X86-NOBMI2-LABEL: clear_highbits64_c4_commutative:
; X86-NOBMI2: # %bb.0:
; X86-NOBMI2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-NOBMI2-NEXT: movl $-1, %eax
; X86-NOBMI2-NEXT: movl $-1, %edx
; X86-NOBMI2-NEXT: shrl %cl, %edx
; X86-NOBMI2-NEXT: shrdl %cl, %eax, %eax
; X86-NOBMI2-NEXT: testb $32, %cl
; X86-NOBMI2-NEXT: je .LBB17_2
; X86-NOBMI2-NEXT: # %bb.1:
; X86-NOBMI2-NEXT: movl %edx, %eax
; X86-NOBMI2-NEXT: xorl %edx, %edx
; X86-NOBMI2-NEXT: .LBB17_2:
; X86-NOBMI2-NEXT: andl {{[0-9]+}}(%esp), %eax
; X86-NOBMI2-NEXT: andl {{[0-9]+}}(%esp), %edx
; X86-NOBMI2-NEXT: retl
; X86-FALLBACK0-LABEL: clear_highbits64_c4_commutative:
; X86-FALLBACK0: # %bb.0:
; X86-FALLBACK0-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK0-NEXT: movl $-1, %eax
; X86-FALLBACK0-NEXT: movl $-1, %edx
; X86-FALLBACK0-NEXT: shrl %cl, %edx
; X86-FALLBACK0-NEXT: shrdl %cl, %eax, %eax
; X86-FALLBACK0-NEXT: testb $32, %cl
; X86-FALLBACK0-NEXT: je .LBB17_2
; X86-FALLBACK0-NEXT: # %bb.1:
; X86-FALLBACK0-NEXT: movl %edx, %eax
; X86-FALLBACK0-NEXT: xorl %edx, %edx
; X86-FALLBACK0-NEXT: .LBB17_2:
; X86-FALLBACK0-NEXT: andl {{[0-9]+}}(%esp), %eax
; X86-FALLBACK0-NEXT: andl {{[0-9]+}}(%esp), %edx
; X86-FALLBACK0-NEXT: retl
;
; X86-FALLBACK1-LABEL: clear_highbits64_c4_commutative:
; X86-FALLBACK1: # %bb.0:
; X86-FALLBACK1-NEXT: pushl %esi
; X86-FALLBACK1-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK1-NEXT: movl $-1, %eax
; X86-FALLBACK1-NEXT: movl $-1, %esi
; X86-FALLBACK1-NEXT: shrl %cl, %esi
; X86-FALLBACK1-NEXT: shrdl %cl, %eax, %eax
; X86-FALLBACK1-NEXT: xorl %edx, %edx
; X86-FALLBACK1-NEXT: testb $32, %cl
; X86-FALLBACK1-NEXT: cmovnel %esi, %eax
; X86-FALLBACK1-NEXT: cmovel %esi, %edx
; X86-FALLBACK1-NEXT: andl {{[0-9]+}}(%esp), %eax
; X86-FALLBACK1-NEXT: andl {{[0-9]+}}(%esp), %edx
; X86-FALLBACK1-NEXT: popl %esi
; X86-FALLBACK1-NEXT: retl
;
; X86-FALLBACK2-LABEL: clear_highbits64_c4_commutative:
; X86-FALLBACK2: # %bb.0:
; X86-FALLBACK2-NEXT: pushl %esi
; X86-FALLBACK2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK2-NEXT: movl $-1, %eax
; X86-FALLBACK2-NEXT: movl $-1, %esi
; X86-FALLBACK2-NEXT: shrl %cl, %esi
; X86-FALLBACK2-NEXT: shrdl %cl, %eax, %eax
; X86-FALLBACK2-NEXT: xorl %edx, %edx
; X86-FALLBACK2-NEXT: testb $32, %cl
; X86-FALLBACK2-NEXT: cmovnel %esi, %eax
; X86-FALLBACK2-NEXT: cmovel %esi, %edx
; X86-FALLBACK2-NEXT: andl {{[0-9]+}}(%esp), %eax
; X86-FALLBACK2-NEXT: andl {{[0-9]+}}(%esp), %edx
; X86-FALLBACK2-NEXT: popl %esi
; X86-FALLBACK2-NEXT: retl
;
; X86-BMI2-LABEL: clear_highbits64_c4_commutative:
; X86-BMI2: # %bb.0:
; X86-BMI2-NEXT: pushl %esi
; X86-BMI2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-BMI2-NEXT: movl $-1, %eax
; X86-BMI2-NEXT: shrxl %ecx, %eax, %edx
; X86-BMI2-NEXT: shrxl %ecx, %eax, %esi
; X86-BMI2-NEXT: shrdl %cl, %eax, %eax
; X86-BMI2-NEXT: testb $32, %cl
; X86-BMI2-NEXT: je .LBB17_2
; X86-BMI2-NEXT: # %bb.1:
; X86-BMI2-NEXT: movl %edx, %eax
; X86-BMI2-NEXT: xorl %edx, %edx
; X86-BMI2-NEXT: .LBB17_2:
; X86-BMI2-NEXT: testb $32, %cl
; X86-BMI2-NEXT: cmovnel %esi, %eax
; X86-BMI2-NEXT: cmovel %esi, %edx
; X86-BMI2-NEXT: andl {{[0-9]+}}(%esp), %eax
; X86-BMI2-NEXT: andl {{[0-9]+}}(%esp), %edx
; X86-BMI2-NEXT: popl %esi
; X86-BMI2-NEXT: retl
;
; X64-NOBMI2-LABEL: clear_highbits64_c4_commutative:
@ -873,35 +1055,91 @@ define i32 @oneuse32(i32 %val, i32 %numhighbits) nounwind {
}
define i64 @oneuse64(i64 %val, i64 %numhighbits) nounwind {
; X86-NOBMI2-LABEL: oneuse64:
; X86-NOBMI2: # %bb.0:
; X86-NOBMI2-NEXT: pushl %edi
; X86-NOBMI2-NEXT: pushl %esi
; X86-NOBMI2-NEXT: pushl %eax
; X86-NOBMI2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-NOBMI2-NEXT: movl $-1, %esi
; X86-NOBMI2-NEXT: movl $-1, %edi
; X86-NOBMI2-NEXT: shrl %cl, %edi
; X86-NOBMI2-NEXT: shrdl %cl, %esi, %esi
; X86-NOBMI2-NEXT: testb $32, %cl
; X86-NOBMI2-NEXT: je .LBB19_2
; X86-NOBMI2-NEXT: # %bb.1:
; X86-NOBMI2-NEXT: movl %edi, %esi
; X86-NOBMI2-NEXT: xorl %edi, %edi
; X86-NOBMI2-NEXT: .LBB19_2:
; X86-NOBMI2-NEXT: subl $8, %esp
; X86-NOBMI2-NEXT: pushl %edi
; X86-NOBMI2-NEXT: pushl %esi
; X86-NOBMI2-NEXT: calll use64
; X86-NOBMI2-NEXT: addl $16, %esp
; X86-NOBMI2-NEXT: andl {{[0-9]+}}(%esp), %esi
; X86-NOBMI2-NEXT: andl {{[0-9]+}}(%esp), %edi
; X86-NOBMI2-NEXT: movl %esi, %eax
; X86-NOBMI2-NEXT: movl %edi, %edx
; X86-NOBMI2-NEXT: addl $4, %esp
; X86-NOBMI2-NEXT: popl %esi
; X86-NOBMI2-NEXT: popl %edi
; X86-NOBMI2-NEXT: retl
; X86-FALLBACK0-LABEL: oneuse64:
; X86-FALLBACK0: # %bb.0:
; X86-FALLBACK0-NEXT: pushl %edi
; X86-FALLBACK0-NEXT: pushl %esi
; X86-FALLBACK0-NEXT: pushl %eax
; X86-FALLBACK0-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK0-NEXT: movl $-1, %esi
; X86-FALLBACK0-NEXT: movl $-1, %edi
; X86-FALLBACK0-NEXT: shrl %cl, %edi
; X86-FALLBACK0-NEXT: shrdl %cl, %esi, %esi
; X86-FALLBACK0-NEXT: testb $32, %cl
; X86-FALLBACK0-NEXT: je .LBB19_2
; X86-FALLBACK0-NEXT: # %bb.1:
; X86-FALLBACK0-NEXT: movl %edi, %esi
; X86-FALLBACK0-NEXT: xorl %edi, %edi
; X86-FALLBACK0-NEXT: .LBB19_2:
; X86-FALLBACK0-NEXT: subl $8, %esp
; X86-FALLBACK0-NEXT: pushl %edi
; X86-FALLBACK0-NEXT: pushl %esi
; X86-FALLBACK0-NEXT: calll use64
; X86-FALLBACK0-NEXT: addl $16, %esp
; X86-FALLBACK0-NEXT: andl {{[0-9]+}}(%esp), %esi
; X86-FALLBACK0-NEXT: andl {{[0-9]+}}(%esp), %edi
; X86-FALLBACK0-NEXT: movl %esi, %eax
; X86-FALLBACK0-NEXT: movl %edi, %edx
; X86-FALLBACK0-NEXT: addl $4, %esp
; X86-FALLBACK0-NEXT: popl %esi
; X86-FALLBACK0-NEXT: popl %edi
; X86-FALLBACK0-NEXT: retl
;
; X86-FALLBACK1-LABEL: oneuse64:
; X86-FALLBACK1: # %bb.0:
; X86-FALLBACK1-NEXT: pushl %edi
; X86-FALLBACK1-NEXT: pushl %esi
; X86-FALLBACK1-NEXT: pushl %eax
; X86-FALLBACK1-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK1-NEXT: movl $-1, %esi
; X86-FALLBACK1-NEXT: movl $-1, %eax
; X86-FALLBACK1-NEXT: shrl %cl, %eax
; X86-FALLBACK1-NEXT: shrdl %cl, %esi, %esi
; X86-FALLBACK1-NEXT: xorl %edi, %edi
; X86-FALLBACK1-NEXT: testb $32, %cl
; X86-FALLBACK1-NEXT: cmovnel %eax, %esi
; X86-FALLBACK1-NEXT: cmovel %eax, %edi
; X86-FALLBACK1-NEXT: subl $8, %esp
; X86-FALLBACK1-NEXT: pushl %edi
; X86-FALLBACK1-NEXT: pushl %esi
; X86-FALLBACK1-NEXT: calll use64
; X86-FALLBACK1-NEXT: addl $16, %esp
; X86-FALLBACK1-NEXT: andl {{[0-9]+}}(%esp), %esi
; X86-FALLBACK1-NEXT: andl {{[0-9]+}}(%esp), %edi
; X86-FALLBACK1-NEXT: movl %esi, %eax
; X86-FALLBACK1-NEXT: movl %edi, %edx
; X86-FALLBACK1-NEXT: addl $4, %esp
; X86-FALLBACK1-NEXT: popl %esi
; X86-FALLBACK1-NEXT: popl %edi
; X86-FALLBACK1-NEXT: retl
;
; X86-FALLBACK2-LABEL: oneuse64:
; X86-FALLBACK2: # %bb.0:
; X86-FALLBACK2-NEXT: pushl %edi
; X86-FALLBACK2-NEXT: pushl %esi
; X86-FALLBACK2-NEXT: pushl %eax
; X86-FALLBACK2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-FALLBACK2-NEXT: movl $-1, %esi
; X86-FALLBACK2-NEXT: movl $-1, %eax
; X86-FALLBACK2-NEXT: shrl %cl, %eax
; X86-FALLBACK2-NEXT: shrdl %cl, %esi, %esi
; X86-FALLBACK2-NEXT: xorl %edi, %edi
; X86-FALLBACK2-NEXT: testb $32, %cl
; X86-FALLBACK2-NEXT: cmovnel %eax, %esi
; X86-FALLBACK2-NEXT: cmovel %eax, %edi
; X86-FALLBACK2-NEXT: subl $8, %esp
; X86-FALLBACK2-NEXT: pushl %edi
; X86-FALLBACK2-NEXT: pushl %esi
; X86-FALLBACK2-NEXT: calll use64
; X86-FALLBACK2-NEXT: addl $16, %esp
; X86-FALLBACK2-NEXT: andl {{[0-9]+}}(%esp), %esi
; X86-FALLBACK2-NEXT: andl {{[0-9]+}}(%esp), %edi
; X86-FALLBACK2-NEXT: movl %esi, %eax
; X86-FALLBACK2-NEXT: movl %edi, %edx
; X86-FALLBACK2-NEXT: addl $4, %esp
; X86-FALLBACK2-NEXT: popl %esi
; X86-FALLBACK2-NEXT: popl %edi
; X86-FALLBACK2-NEXT: retl
;
; X86-BMI2-LABEL: oneuse64:
; X86-BMI2: # %bb.0:
@ -910,14 +1148,12 @@ define i64 @oneuse64(i64 %val, i64 %numhighbits) nounwind {
; X86-BMI2-NEXT: pushl %eax
; X86-BMI2-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-BMI2-NEXT: movl $-1, %esi
; X86-BMI2-NEXT: shrxl %ecx, %esi, %edi
; X86-BMI2-NEXT: shrxl %ecx, %esi, %eax
; X86-BMI2-NEXT: shrdl %cl, %esi, %esi
; X86-BMI2-NEXT: testb $32, %cl
; X86-BMI2-NEXT: je .LBB19_2
; X86-BMI2-NEXT: # %bb.1:
; X86-BMI2-NEXT: movl %edi, %esi
; X86-BMI2-NEXT: xorl %edi, %edi
; X86-BMI2-NEXT: .LBB19_2:
; X86-BMI2-NEXT: testb $32, %cl
; X86-BMI2-NEXT: cmovnel %eax, %esi
; X86-BMI2-NEXT: cmovel %eax, %edi
; X86-BMI2-NEXT: subl $8, %esp
; X86-BMI2-NEXT: pushl %edi
; X86-BMI2-NEXT: pushl %esi