[PowerPC] Convert a README.txt entry into a better test
authorHal Finkel <hfinkel@anl.gov>
Mon, 5 Jan 2015 21:53:52 +0000 (21:53 +0000)
committerHal Finkel <hfinkel@anl.gov>
Mon, 5 Jan 2015 21:53:52 +0000 (21:53 +0000)
We now produce the desired code as noted in the README.txt file (no spurious
or). Remove the README entry and improve the regression test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225214 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/README.txt
test/CodeGen/PowerPC/2007-03-24-cntlzd.ll

index 29238fd2a551b5b13dfa7d81a9494d8dedd50449..9571e4a0616227628e0dcb0edaeaf1b21e2a283c 100644 (file)
@@ -494,19 +494,6 @@ _bar:
 
 ===-------------------------------------------------------------------------===
 
-test/CodeGen/PowerPC/2007-03-24-cntlzd.ll compiles to:
-
-__ZNK4llvm5APInt17countLeadingZerosEv:
-        ld r2, 0(r3)
-        cntlzd r2, r2
-        or r2, r2, r2     <<-- silly.
-        addi r3, r2, -64
-        blr 
-
-The dead or is a 'truncate' from 64- to 32-bits.
-
-===-------------------------------------------------------------------------===
-
 We generate horrible ppc code for this:
 
 #define N  2000000
index 3620b0e6340a3e01c0e076e1f9f433cacf749d28..bbca76fd087b88de5cc72bcce0d65b7157cb0109 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc < %s -march=ppc64 -mcpu=g5 | grep cntlzd
+; RUN: llc < %s -march=ppc64 -mcpu=g5 | FileCheck %s
 
 define i32 @_ZNK4llvm5APInt17countLeadingZerosEv(i64 *%t) nounwind {
         %tmp19 = load i64* %t
@@ -7,6 +7,12 @@ define i32 @_ZNK4llvm5APInt17countLeadingZerosEv(i64 *%t) nounwind {
         %tmp89 = add i32 %tmp23, -64          ; <i32> [#uses=1]
         %tmp90 = add i32 %tmp89, 0            ; <i32> [#uses=1]
         ret i32 %tmp90
+
+; CHECK-LABEL: @_ZNK4llvm5APInt17countLeadingZerosEv
+; CHECK: ld [[REG1:[0-9]+]], 0(3)
+; CHECK-NEXT: cntlzd [[REG2:[0-9]+]], [[REG1]]
+; CHECK-NEXT: addi 3, [[REG2]], -64
+; CHECK-NEXT: blr
 }
 
 declare i64 @llvm.ctlz.i64(i64, i1)