[llvm] r195272 - PPC popcnt[dw] do not have record forms

Hal Finkel hfinkel at anl.gov
Wed Nov 20 13:20:11 PST 2013


Bill,

Please pull this into the release branch.

Thanks,
Hal

----- Original Message -----
> From: "Hal Finkel" <hfinkel at anl.gov>
> To: llvm-commits at cs.uiuc.edu
> Sent: Wednesday, November 20, 2013 2:54:55 PM
> Subject: [llvm] r195272 - PPC popcnt[dw] do not have record forms
> 
> Author: hfinkel
> Date: Wed Nov 20 14:54:55 2013
> New Revision: 195272
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=195272&view=rev
> Log:
> PPC popcnt[dw] do not have record forms
> 
> The instruction definitions incorrectly specified that popcntd and
> popcntw have
> record forms; they do not. This mistake was causing invalid code
> generation.
> 
> Modified:
>     llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td
>     llvm/trunk/test/CodeGen/PowerPC/optcmp.ll
> 
> Modified: llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td?rev=195272&r1=195271&r2=195272&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td (original)
> +++ llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td Wed Nov 20
> 14:54:55 2013
> @@ -529,16 +529,16 @@ defm SRADI  : XSForm_1rc<31, 413, (outs
>  defm CNTLZD : XForm_11r<31, 58, (outs g8rc:$rA), (ins g8rc:$rS),
>                          "cntlzd", "$rA, $rS", IntGeneral,
>                          [(set i64:$rA, (ctlz i64:$rS))]>;
> -defm POPCNTD : XForm_11r<31, 506, (outs g8rc:$rA), (ins g8rc:$rS),
> -                         "popcntd", "$rA, $rS", IntGeneral,
> -                         [(set i64:$rA, (ctpop i64:$rS))]>;
> +def POPCNTD : XForm_11<31, 506, (outs g8rc:$rA), (ins g8rc:$rS),
> +                       "popcntd $rA, $rS", IntGeneral,
> +                       [(set i64:$rA, (ctpop i64:$rS))]>;
>  
>  // popcntw also does a population count on the high 32 bits (storing
>  the
>  // results in the high 32-bits of the output). We'll ignore that
>  here (which is
>  // safe because we never separately use the high part of the 64-bit
>  registers).
> -defm POPCNTW : XForm_11r<31, 378, (outs gprc:$rA), (ins gprc:$rS),
> -                         "popcntw", "$rA, $rS", IntGeneral,
> -                         [(set i32:$rA, (ctpop i32:$rS))]>;
> +def POPCNTW : XForm_11<31, 378, (outs gprc:$rA), (ins gprc:$rS),
> +                       "popcntw $rA, $rS", IntGeneral,
> +                       [(set i32:$rA, (ctpop i32:$rS))]>;
>  
>  defm DIVD  : XOForm_1r<31, 489, 0, (outs g8rc:$rT), (ins g8rc:$rA,
>  g8rc:$rB),
>                         "divd", "$rT, $rA, $rB", IntDivD,
> 
> Modified: llvm/trunk/test/CodeGen/PowerPC/optcmp.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/optcmp.ll?rev=195272&r1=195271&r2=195272&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/PowerPC/optcmp.ll (original)
> +++ llvm/trunk/test/CodeGen/PowerPC/optcmp.ll Wed Nov 20 14:54:55
> 2013
> @@ -134,3 +134,19 @@ entry:
>  ; CHECK-NOT: fsubs. 0, 1, 2
>  ; CHECK: stfs 0, 0(5)
>  }
> +
> +declare i64 @llvm.ctpop.i64(i64);
> +
> +define signext i64 @fooct(i64 signext %a, i64 signext %b, i64*
> nocapture %c) #0 {
> +entry:
> +  %sub = sub nsw i64 %a, %b
> +  %subc = call i64 @llvm.ctpop.i64(i64 %sub)
> +  store i64 %subc, i64* %c, align 4
> +  %cmp = icmp sgt i64 %subc, 0
> +  %cond = select i1 %cmp, i64 %a, i64 %b
> +  ret i64 %cond
> +
> +; CHECK: @fooct
> +; CHECK-NOT: popcntd.
> +}
> +
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-commits mailing list