[llvm-branch-commits] [llvm-branch] r116926 - /llvm/branches/ggreif/peephole-infrastructure/test/CodeGen/ARM/and-tst-reg-peephole.ll

Gabor Greif ggreif at gmail.com
Wed Oct 20 08:47:46 PDT 2010


Author: ggreif
Date: Wed Oct 20 10:47:46 2010
New Revision: 116926

URL: http://llvm.org/viewvc/llvm-project?rev=116926&view=rev
Log:
'and r r' testcases and how they are could be optimized

Added:
    llvm/branches/ggreif/peephole-infrastructure/test/CodeGen/ARM/and-tst-reg-peephole.ll

Added: llvm/branches/ggreif/peephole-infrastructure/test/CodeGen/ARM/and-tst-reg-peephole.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/peephole-infrastructure/test/CodeGen/ARM/and-tst-reg-peephole.ll?rev=116926&view=auto
==============================================================================
--- llvm/branches/ggreif/peephole-infrastructure/test/CodeGen/ARM/and-tst-reg-peephole.ll (added)
+++ llvm/branches/ggreif/peephole-infrastructure/test/CodeGen/ARM/and-tst-reg-peephole.ll Wed Oct 20 10:47:46 2010
@@ -0,0 +1,32 @@
+; RUN: llc < %s -march=arm | FileCheck %s
+; RUN: llc < %s -march=thumb | FileCheck -check-prefix=THUMB %s
+; RUN: llc < %s -march=thumb -mattr=+thumb2 | FileCheck -check-prefix=T2 %s
+
+%struct.Foo = type { i32 }
+
+define i32 @foo(%struct.Foo* %this, i32 %mask) nounwind readonly align 2 {
+entry:
+  %ptr = getelementptr %struct.Foo* %this, i32 0, i32 0
+	%my = load i32* %ptr
+
+; CHECK:      tst r0, r1
+; CHECK-NEXT: andne r0, r0, r1
+
+; THUMB:      ands r0, r1
+; THUMB-NEXT: tst r2, r1
+
+; T2:      tst r0, r1
+; T2-NEXT: bne
+
+  %and = and i32 %my, %mask
+  %tst = icmp eq i32 %and, 0
+  br i1 %tst, label %sw.bb, label %sw.bb2
+
+sw.bb:
+  ret i32 255
+
+sw.bb2:
+; T2:      ands r0, r1
+  ret i32 %and
+}
+





More information about the llvm-branch-commits mailing list