[llvm] r225214 - [PowerPC] Convert a README.txt entry into a better test

Hal Finkel hfinkel at anl.gov
Mon Jan 5 13:53:52 PST 2015


Author: hfinkel
Date: Mon Jan  5 15:53:52 2015
New Revision: 225214

URL: http://llvm.org/viewvc/llvm-project?rev=225214&view=rev
Log:
[PowerPC] Convert a README.txt entry into a better test

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.

Modified:
    llvm/trunk/lib/Target/PowerPC/README.txt
    llvm/trunk/test/CodeGen/PowerPC/2007-03-24-cntlzd.ll

Modified: llvm/trunk/lib/Target/PowerPC/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/README.txt?rev=225214&r1=225213&r2=225214&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/README.txt (original)
+++ llvm/trunk/lib/Target/PowerPC/README.txt Mon Jan  5 15:53:52 2015
@@ -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

Modified: llvm/trunk/test/CodeGen/PowerPC/2007-03-24-cntlzd.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2007-03-24-cntlzd.ll?rev=225214&r1=225213&r2=225214&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/2007-03-24-cntlzd.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/2007-03-24-cntlzd.ll Mon Jan  5 15:53:52 2015
@@ -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 @_ZNK4llvm5APInt17countLeadin
         %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)





More information about the llvm-commits mailing list