forked from OSchip/llvm-project
[X86] Add BMI test coverage for for or-lea with no common bits tests
Ensure D113970 handles andnot patterns as well.
This commit is contained in:
parent
19be7f9702
commit
73fd36963c
|
@ -1,5 +1,6 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
|
||||
; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefixes=CHECK,NOBMI
|
||||
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+bmi | FileCheck %s --check-prefixes=CHECK,BMI
|
||||
|
||||
; InstCombine and DAGCombiner transform an 'add' into an 'or'
|
||||
; if there are no common bits from the incoming operands.
|
||||
|
@ -134,15 +135,23 @@ define i64 @or_shift1_and1_64(i64 %x, i64 %y) {
|
|||
; In the following patterns, lhs and rhs of the or instruction have no common bits.
|
||||
|
||||
define i32 @or_and_and_rhs_neg_i32(i32 %x, i32 %y, i32 %z) {
|
||||
; CHECK-LABEL: or_and_and_rhs_neg_i32:
|
||||
; CHECK: # %bb.0: # %entry
|
||||
; CHECK-NEXT: # kill: def $esi killed $esi def $rsi
|
||||
; CHECK-NEXT: andl %esi, %edx
|
||||
; CHECK-NEXT: notl %esi
|
||||
; CHECK-NEXT: andl %edi, %esi
|
||||
; CHECK-NEXT: orl %edx, %esi
|
||||
; CHECK-NEXT: leal 1(%rsi), %eax
|
||||
; CHECK-NEXT: retq
|
||||
; NOBMI-LABEL: or_and_and_rhs_neg_i32:
|
||||
; NOBMI: # %bb.0: # %entry
|
||||
; NOBMI-NEXT: # kill: def $esi killed $esi def $rsi
|
||||
; NOBMI-NEXT: andl %esi, %edx
|
||||
; NOBMI-NEXT: notl %esi
|
||||
; NOBMI-NEXT: andl %edi, %esi
|
||||
; NOBMI-NEXT: orl %edx, %esi
|
||||
; NOBMI-NEXT: leal 1(%rsi), %eax
|
||||
; NOBMI-NEXT: retq
|
||||
;
|
||||
; BMI-LABEL: or_and_and_rhs_neg_i32:
|
||||
; BMI: # %bb.0: # %entry
|
||||
; BMI-NEXT: andl %esi, %edx
|
||||
; BMI-NEXT: andnl %edi, %esi, %eax
|
||||
; BMI-NEXT: orl %edx, %eax
|
||||
; BMI-NEXT: incl %eax
|
||||
; BMI-NEXT: retq
|
||||
entry:
|
||||
%and1 = and i32 %z, %y
|
||||
%xor = xor i32 %y, -1
|
||||
|
@ -153,15 +162,23 @@ entry:
|
|||
}
|
||||
|
||||
define i32 @or_and_and_lhs_neg_i32(i32 %x, i32 %y, i32 %z) {
|
||||
; CHECK-LABEL: or_and_and_lhs_neg_i32:
|
||||
; CHECK: # %bb.0: # %entry
|
||||
; CHECK-NEXT: # kill: def $esi killed $esi def $rsi
|
||||
; CHECK-NEXT: andl %esi, %edx
|
||||
; CHECK-NEXT: notl %esi
|
||||
; CHECK-NEXT: andl %edi, %esi
|
||||
; CHECK-NEXT: orl %edx, %esi
|
||||
; CHECK-NEXT: leal 1(%rsi), %eax
|
||||
; CHECK-NEXT: retq
|
||||
; NOBMI-LABEL: or_and_and_lhs_neg_i32:
|
||||
; NOBMI: # %bb.0: # %entry
|
||||
; NOBMI-NEXT: # kill: def $esi killed $esi def $rsi
|
||||
; NOBMI-NEXT: andl %esi, %edx
|
||||
; NOBMI-NEXT: notl %esi
|
||||
; NOBMI-NEXT: andl %edi, %esi
|
||||
; NOBMI-NEXT: orl %edx, %esi
|
||||
; NOBMI-NEXT: leal 1(%rsi), %eax
|
||||
; NOBMI-NEXT: retq
|
||||
;
|
||||
; BMI-LABEL: or_and_and_lhs_neg_i32:
|
||||
; BMI: # %bb.0: # %entry
|
||||
; BMI-NEXT: andl %esi, %edx
|
||||
; BMI-NEXT: andnl %edi, %esi, %eax
|
||||
; BMI-NEXT: orl %edx, %eax
|
||||
; BMI-NEXT: incl %eax
|
||||
; BMI-NEXT: retq
|
||||
entry:
|
||||
%and1 = and i32 %z, %y
|
||||
%xor = xor i32 %y, -1
|
||||
|
@ -172,15 +189,23 @@ entry:
|
|||
}
|
||||
|
||||
define i32 @or_and_rhs_neg_and_i32(i32 %x, i32 %y, i32 %z) {
|
||||
; CHECK-LABEL: or_and_rhs_neg_and_i32:
|
||||
; CHECK: # %bb.0: # %entry
|
||||
; CHECK-NEXT: # kill: def $esi killed $esi def $rsi
|
||||
; CHECK-NEXT: andl %esi, %edi
|
||||
; CHECK-NEXT: notl %esi
|
||||
; CHECK-NEXT: andl %edx, %esi
|
||||
; CHECK-NEXT: orl %edi, %esi
|
||||
; CHECK-NEXT: leal 1(%rsi), %eax
|
||||
; CHECK-NEXT: retq
|
||||
; NOBMI-LABEL: or_and_rhs_neg_and_i32:
|
||||
; NOBMI: # %bb.0: # %entry
|
||||
; NOBMI-NEXT: # kill: def $esi killed $esi def $rsi
|
||||
; NOBMI-NEXT: andl %esi, %edi
|
||||
; NOBMI-NEXT: notl %esi
|
||||
; NOBMI-NEXT: andl %edx, %esi
|
||||
; NOBMI-NEXT: orl %edi, %esi
|
||||
; NOBMI-NEXT: leal 1(%rsi), %eax
|
||||
; NOBMI-NEXT: retq
|
||||
;
|
||||
; BMI-LABEL: or_and_rhs_neg_and_i32:
|
||||
; BMI: # %bb.0: # %entry
|
||||
; BMI-NEXT: andnl %edx, %esi, %eax
|
||||
; BMI-NEXT: andl %esi, %edi
|
||||
; BMI-NEXT: orl %edi, %eax
|
||||
; BMI-NEXT: incl %eax
|
||||
; BMI-NEXT: retq
|
||||
entry:
|
||||
%xor = xor i32 %y, -1
|
||||
%and1 = and i32 %z, %xor
|
||||
|
@ -191,15 +216,23 @@ entry:
|
|||
}
|
||||
|
||||
define i32 @or_and_lhs_neg_and_i32(i32 %x, i32 %y, i32 %z) {
|
||||
; CHECK-LABEL: or_and_lhs_neg_and_i32:
|
||||
; CHECK: # %bb.0: # %entry
|
||||
; CHECK-NEXT: # kill: def $esi killed $esi def $rsi
|
||||
; CHECK-NEXT: andl %esi, %edi
|
||||
; CHECK-NEXT: notl %esi
|
||||
; CHECK-NEXT: andl %edx, %esi
|
||||
; CHECK-NEXT: orl %edi, %esi
|
||||
; CHECK-NEXT: leal 1(%rsi), %eax
|
||||
; CHECK-NEXT: retq
|
||||
; NOBMI-LABEL: or_and_lhs_neg_and_i32:
|
||||
; NOBMI: # %bb.0: # %entry
|
||||
; NOBMI-NEXT: # kill: def $esi killed $esi def $rsi
|
||||
; NOBMI-NEXT: andl %esi, %edi
|
||||
; NOBMI-NEXT: notl %esi
|
||||
; NOBMI-NEXT: andl %edx, %esi
|
||||
; NOBMI-NEXT: orl %edi, %esi
|
||||
; NOBMI-NEXT: leal 1(%rsi), %eax
|
||||
; NOBMI-NEXT: retq
|
||||
;
|
||||
; BMI-LABEL: or_and_lhs_neg_and_i32:
|
||||
; BMI: # %bb.0: # %entry
|
||||
; BMI-NEXT: andnl %edx, %esi, %eax
|
||||
; BMI-NEXT: andl %esi, %edi
|
||||
; BMI-NEXT: orl %edi, %eax
|
||||
; BMI-NEXT: incl %eax
|
||||
; BMI-NEXT: retq
|
||||
entry:
|
||||
%xor = xor i32 %y, -1
|
||||
%and1 = and i32 %xor, %z
|
||||
|
@ -210,14 +243,22 @@ entry:
|
|||
}
|
||||
|
||||
define i64 @or_and_and_rhs_neg_i64(i64 %x, i64 %y, i64 %z) {
|
||||
; CHECK-LABEL: or_and_and_rhs_neg_i64:
|
||||
; CHECK: # %bb.0: # %entry
|
||||
; CHECK-NEXT: andq %rsi, %rdx
|
||||
; CHECK-NEXT: notq %rsi
|
||||
; CHECK-NEXT: andq %rdi, %rsi
|
||||
; CHECK-NEXT: orq %rdx, %rsi
|
||||
; CHECK-NEXT: leaq 1(%rsi), %rax
|
||||
; CHECK-NEXT: retq
|
||||
; NOBMI-LABEL: or_and_and_rhs_neg_i64:
|
||||
; NOBMI: # %bb.0: # %entry
|
||||
; NOBMI-NEXT: andq %rsi, %rdx
|
||||
; NOBMI-NEXT: notq %rsi
|
||||
; NOBMI-NEXT: andq %rdi, %rsi
|
||||
; NOBMI-NEXT: orq %rdx, %rsi
|
||||
; NOBMI-NEXT: leaq 1(%rsi), %rax
|
||||
; NOBMI-NEXT: retq
|
||||
;
|
||||
; BMI-LABEL: or_and_and_rhs_neg_i64:
|
||||
; BMI: # %bb.0: # %entry
|
||||
; BMI-NEXT: andq %rsi, %rdx
|
||||
; BMI-NEXT: andnq %rdi, %rsi, %rax
|
||||
; BMI-NEXT: orq %rdx, %rax
|
||||
; BMI-NEXT: incq %rax
|
||||
; BMI-NEXT: retq
|
||||
entry:
|
||||
%and1 = and i64 %z, %y
|
||||
%xor = xor i64 %y, -1
|
||||
|
@ -228,14 +269,22 @@ entry:
|
|||
}
|
||||
|
||||
define i64 @or_and_and_lhs_neg_i64(i64 %x, i64 %y, i64 %z) {
|
||||
; CHECK-LABEL: or_and_and_lhs_neg_i64:
|
||||
; CHECK: # %bb.0: # %entry
|
||||
; CHECK-NEXT: andq %rsi, %rdx
|
||||
; CHECK-NEXT: notq %rsi
|
||||
; CHECK-NEXT: andq %rdi, %rsi
|
||||
; CHECK-NEXT: orq %rdx, %rsi
|
||||
; CHECK-NEXT: leaq 1(%rsi), %rax
|
||||
; CHECK-NEXT: retq
|
||||
; NOBMI-LABEL: or_and_and_lhs_neg_i64:
|
||||
; NOBMI: # %bb.0: # %entry
|
||||
; NOBMI-NEXT: andq %rsi, %rdx
|
||||
; NOBMI-NEXT: notq %rsi
|
||||
; NOBMI-NEXT: andq %rdi, %rsi
|
||||
; NOBMI-NEXT: orq %rdx, %rsi
|
||||
; NOBMI-NEXT: leaq 1(%rsi), %rax
|
||||
; NOBMI-NEXT: retq
|
||||
;
|
||||
; BMI-LABEL: or_and_and_lhs_neg_i64:
|
||||
; BMI: # %bb.0: # %entry
|
||||
; BMI-NEXT: andq %rsi, %rdx
|
||||
; BMI-NEXT: andnq %rdi, %rsi, %rax
|
||||
; BMI-NEXT: orq %rdx, %rax
|
||||
; BMI-NEXT: incq %rax
|
||||
; BMI-NEXT: retq
|
||||
entry:
|
||||
%and1 = and i64 %z, %y
|
||||
%xor = xor i64 %y, -1
|
||||
|
@ -246,14 +295,22 @@ entry:
|
|||
}
|
||||
|
||||
define i64 @or_and_rhs_neg_and_i64(i64 %x, i64 %y, i64 %z) {
|
||||
; CHECK-LABEL: or_and_rhs_neg_and_i64:
|
||||
; CHECK: # %bb.0: # %entry
|
||||
; CHECK-NEXT: andq %rsi, %rdi
|
||||
; CHECK-NEXT: notq %rsi
|
||||
; CHECK-NEXT: andq %rdx, %rsi
|
||||
; CHECK-NEXT: orq %rdi, %rsi
|
||||
; CHECK-NEXT: leaq 1(%rsi), %rax
|
||||
; CHECK-NEXT: retq
|
||||
; NOBMI-LABEL: or_and_rhs_neg_and_i64:
|
||||
; NOBMI: # %bb.0: # %entry
|
||||
; NOBMI-NEXT: andq %rsi, %rdi
|
||||
; NOBMI-NEXT: notq %rsi
|
||||
; NOBMI-NEXT: andq %rdx, %rsi
|
||||
; NOBMI-NEXT: orq %rdi, %rsi
|
||||
; NOBMI-NEXT: leaq 1(%rsi), %rax
|
||||
; NOBMI-NEXT: retq
|
||||
;
|
||||
; BMI-LABEL: or_and_rhs_neg_and_i64:
|
||||
; BMI: # %bb.0: # %entry
|
||||
; BMI-NEXT: andnq %rdx, %rsi, %rax
|
||||
; BMI-NEXT: andq %rsi, %rdi
|
||||
; BMI-NEXT: orq %rdi, %rax
|
||||
; BMI-NEXT: incq %rax
|
||||
; BMI-NEXT: retq
|
||||
entry:
|
||||
%xor = xor i64 %y, -1
|
||||
%and1 = and i64 %z, %xor
|
||||
|
@ -264,14 +321,22 @@ entry:
|
|||
}
|
||||
|
||||
define i64 @or_and_lhs_neg_and_i64(i64 %x, i64 %y, i64 %z) {
|
||||
; CHECK-LABEL: or_and_lhs_neg_and_i64:
|
||||
; CHECK: # %bb.0: # %entry
|
||||
; CHECK-NEXT: andq %rsi, %rdi
|
||||
; CHECK-NEXT: notq %rsi
|
||||
; CHECK-NEXT: andq %rdx, %rsi
|
||||
; CHECK-NEXT: orq %rdi, %rsi
|
||||
; CHECK-NEXT: leaq 1(%rsi), %rax
|
||||
; CHECK-NEXT: retq
|
||||
; NOBMI-LABEL: or_and_lhs_neg_and_i64:
|
||||
; NOBMI: # %bb.0: # %entry
|
||||
; NOBMI-NEXT: andq %rsi, %rdi
|
||||
; NOBMI-NEXT: notq %rsi
|
||||
; NOBMI-NEXT: andq %rdx, %rsi
|
||||
; NOBMI-NEXT: orq %rdi, %rsi
|
||||
; NOBMI-NEXT: leaq 1(%rsi), %rax
|
||||
; NOBMI-NEXT: retq
|
||||
;
|
||||
; BMI-LABEL: or_and_lhs_neg_and_i64:
|
||||
; BMI: # %bb.0: # %entry
|
||||
; BMI-NEXT: andnq %rdx, %rsi, %rax
|
||||
; BMI-NEXT: andq %rsi, %rdi
|
||||
; BMI-NEXT: orq %rdi, %rax
|
||||
; BMI-NEXT: incq %rax
|
||||
; BMI-NEXT: retq
|
||||
entry:
|
||||
%xor = xor i64 %y, -1
|
||||
%and1 = and i64 %xor, %z
|
||||
|
|
Loading…
Reference in New Issue