[llvm] r177296 - Fix 80-col. violations in PPCCTRLoops

Hal Finkel hfinkel at anl.gov
Mon Mar 18 17:04:02 PDT 2013


----- Original Message -----
> From: "Sean Silva" <silvas at purdue.edu>
> To: "Hal Finkel" <hfinkel at anl.gov>
> Cc: llvm-commits at cs.uiuc.edu
> Sent: Monday, March 18, 2013 6:41:39 PM
> Subject: Re: [llvm] r177296 - Fix 80-col. violations in PPCCTRLoops
> 
> 
> 
> 
> 
> 
> 
> + int64_t count = ImmVal -
> + int64_t(short(DefInstr->getOperand(1).getImm()));
> 
> 
> 
> This piece of code is confusing. Why is it casting to `short`? If it
> just doing it to mask to 16-bit, I'd rather see that done explicitly
> with `& 0xFFFF` instead of assuming that the host's `short` is 16
> bits.

It is doing that so that the immediate value is explicitly sign-extended (as a signed short to a signed int64_t). Is there a better way? Otherwise, I can certainly add a comment.

Thanks again,
Hal

> 
> 
> -- Sean Silva



More information about the llvm-commits mailing list