summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2015-09-03 16:36:16 +0000
committerSanjay Patel <spatel@rotateright.com>2015-09-03 16:36:16 +0000
commitc9ae9d72f8eeefd2883e2d5eaccca30281898f7e (patch)
tree5987c3f217800b49211a6fabeaa306776b96a1f3 /llvm/test/CodeGen
parent31e66e32b4d80f990ec46b7248cfeb593a71085d (diff)
downloadbcm5719-llvm-c9ae9d72f8eeefd2883e2d5eaccca30281898f7e.tar.gz
bcm5719-llvm-c9ae9d72f8eeefd2883e2d5eaccca30281898f7e.zip
[x86] enable machine combiner reassociations for scalar 'xor' insts
llvm-svn: 246781
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/X86/machine-combiner-int.ll47
1 files changed, 47 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/machine-combiner-int.ll b/llvm/test/CodeGen/X86/machine-combiner-int.ll
index 37e8e59b647..4a1ba1a980a 100644
--- a/llvm/test/CodeGen/X86/machine-combiner-int.ll
+++ b/llvm/test/CodeGen/X86/machine-combiner-int.ll
@@ -145,3 +145,50 @@ define i64 @reassociate_ors_i64(i64 %x0, i64 %x1, i64 %x2, i64 %x3) {
ret i64 %t2
}
+; Verify that integer 'xors' are reassociated. The first 'xor' in
+; each test should be independent of the result of the preceding sub.
+
+define i8 @reassociate_xors_i8(i8 %x0, i8 %x1, i8 %x2, i8 %x3) {
+; CHECK-LABEL: reassociate_xors_i8:
+; CHECK: # BB#0:
+; CHECK-NEXT: subb %sil, %dil
+; CHECK-NEXT: xorb %cl, %dl
+; CHECK-NEXT: xorb %dil, %dl
+; CHECK_NEXT: movb %dx, %ax
+; CHECK_NEXT: retq
+ %t0 = sub i8 %x0, %x1
+ %t1 = xor i8 %x2, %t0
+ %t2 = xor i8 %x3, %t1
+ ret i8 %t2
+}
+
+; TODO: No way to test i16? These appear to always get promoted to i32.
+
+define i32 @reassociate_xors_i32(i32 %x0, i32 %x1, i32 %x2, i32 %x3) {
+; CHECK-LABEL: reassociate_xors_i32:
+; CHECK: # BB#0:
+; CHECK-NEXT: subl %esi, %edi
+; CHECK-NEXT: xorl %ecx, %edx
+; CHECK-NEXT: xorl %edi, %edx
+; CHECK_NEXT: movl %edx, %eax
+; CHECK_NEXT: retq
+ %t0 = sub i32 %x0, %x1
+ %t1 = xor i32 %x2, %t0
+ %t2 = xor i32 %x3, %t1
+ ret i32 %t2
+}
+
+define i64 @reassociate_xors_i64(i64 %x0, i64 %x1, i64 %x2, i64 %x3) {
+; CHECK-LABEL: reassociate_xors_i64:
+; CHECK: # BB#0:
+; CHECK-NEXT: subq %rsi, %rdi
+; CHECK-NEXT: xorq %rcx, %rdx
+; CHECK-NEXT: xorq %rdi, %rdx
+; CHECK-NEXT: movq %rdx, %rax
+; CHECK_NEXT: retq
+ %t0 = sub i64 %x0, %x1
+ %t1 = xor i64 %x2, %t0
+ %t2 = xor i64 %x3, %t1
+ ret i64 %t2
+}
+
OpenPOWER on IntegriCloud