Home | History | Annotate | Download | only in PowerPC
      1 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu  < %s | FileCheck %s
      2 
      3 ; Test that we recognize that an 'and' instruction that feeds a comparison
      4 ; to zero can be simplifed by using the record form when one of its operands
      5 ; is known to be zero extended.
      6 
      7 @k = common local_unnamed_addr global i32 0, align 4
      8 
      9 ; Function Attrs: norecurse nounwind
     10 define signext i32 @cmplwi(i32* nocapture readonly %p, i32* nocapture readonly %q, i32 signext %j, i32 signext %r10) {
     11 entry:
     12   %0 = load i32, i32* %q, align 4
     13   %shl = shl i32 %0, %j
     14   %1 = load i32, i32* %p, align 4
     15   %and = and i32 %shl, %r10
     16   %and1 = and i32 %and, %1
     17   %tobool = icmp eq i32 %and1, 0
     18   br i1 %tobool, label %cleanup, label %if.then
     19 
     20 if.then:
     21   store i32 %j, i32* @k, align 4
     22   br label %cleanup
     23 
     24 cleanup:
     25   %retval.0 = phi i32 [ 0, %if.then ], [ 1, %entry ]
     26   ret i32 %retval.0
     27 }
     28 
     29 ; CHECK-LABEL: cmplwi:
     30 ; CHECK:      lwz [[T1:[0-9]+]], 0(3)
     31 ; CHECK:      and. {{[0-9]+}}, {{[0-9]+}}, [[T1]]
     32 ; CHECK-NOT:  cmplwi
     33 ; CHECK-NEXT: beq      0,
     34