[llvm-commits] [PATCH] Respect sign-/zeroext attributes on i32 return values on ppc64

Hal Finkel hfinkel at anl.gov
Mon Nov 5 11:35:01 PST 2012


----- Original Message -----
> From: "Ulrich Weigand" <Ulrich.Weigand at de.ibm.com>
> To: llvm-commits at cs.uiuc.edu
> Sent: Monday, November 5, 2012 12:17:56 PM
> Subject: [llvm-commits] [PATCH] Respect sign-/zeroext attributes on i32	return values on ppc64
> 
> 
> Hello,
> 
> on PowerPC64, integer return values (as well as arguments) are
> supposed to
> be extended to a full register.   This is modeled in the LLVM IR by
> marking
> the return value (or argument) with a signext or zeroext attribute.
> (Actually, this is not in fact currently done by clang, but I've
> proposed a
> patch to do that on cfe-commits.)
> 
> However, while these attributes are respected for function arguments,
> they
> are currently ignored for function return values by the PowerPC
> back-end.
> The attached patch updates PPCCallingConv.td to ask for the promotion
> to
> i64, and fixes LowerReturn and LowerCallResult to implement it.
> 
> The test case verifies that both arguments and return values are
> properly
> extended when passing them; and also that the optimizers understand
> incoming argument and return values are in fact guaranteed by the ABI
> to be
> extended.  (Note that for arguments, those tests would have already
> passed
> without this patch.)
> 
> The patch caused a spurious breakage in
> CodeGen/PowerPC/coalesce-ext.ll,
> since the test case used a "ret" instruction to create a use of an
> i32
> value at the end of the function (to set up data flow as required for
> what
> the test is intended to test).  Since there's now an implicit
> promotion to
> i64, that data flow no longer works as expected.  To fix this, my
> patch now
> adds an extra "add" to ensure we have an appropriate use of the i32
> value ...
> 
> OK to commit?

LGTM.

Thanks again,
Hal

> 
> Bye,
> Ulrich
> 
> (See attached file: diff-llvm-ppc64-extendret)
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 

-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-commits mailing list