[llvm] r266261 - [ppc] add tests to show potential andc optimization
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 13 16:23:30 PDT 2016
Author: spatel
Date: Wed Apr 13 18:23:30 2016
New Revision: 266261
URL: http://llvm.org/viewvc/llvm-project?rev=266261&view=rev
Log:
[ppc] add tests to show potential andc optimization
Added:
llvm/trunk/test/CodeGen/PowerPC/andc.ll
Added: llvm/trunk/test/CodeGen/PowerPC/andc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/andc.ll?rev=266261&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/andc.ll (added)
+++ llvm/trunk/test/CodeGen/PowerPC/andc.ll Wed Apr 13 18:23:30 2016
@@ -0,0 +1,36 @@
+; RUN: llc < %s -mtriple=powerpc64-apple-darwin | FileCheck %s
+
+; TODO: These could use 'andc'.
+
+define i1 @and_cmp1(i32 %x, i32 %y) {
+; CHECK-LABEL: and_cmp1:
+; CHECK: ; BB#0:
+; CHECK-NEXT: and r2, r3, r4
+; CHECK-NEXT: li r3, 1
+; CHECK-NEXT: cmpw cr0, r2, r4
+; CHECK-NEXT: bclr 12, 2, 0
+; CHECK-NEXT: ; BB#1:
+; CHECK-NEXT: li r3, 0
+; CHECK-NEXT: blr
+;
+ %and = and i32 %x, %y
+ %cmp = icmp eq i32 %and, %y
+ ret i1 %cmp
+}
+
+define i1 @and_cmp_const(i32 %x) {
+; CHECK-LABEL: and_cmp_const:
+; CHECK: ; BB#0:
+; CHECK-NEXT: andi. r2, r3, 43
+; CHECK-NEXT: li r3, 1
+; CHECK-NEXT: cmpwi r2, 43
+; CHECK-NEXT: bclr 12, 2, 0
+; CHECK-NEXT: ; BB#1:
+; CHECK-NEXT: li r3, 0
+; CHECK-NEXT: blr
+;
+ %and = and i32 %x, 43
+ %cmp = icmp eq i32 %and, 43
+ ret i1 %cmp
+}
+
More information about the llvm-commits
mailing list