[PATCH] [MIPS] fix extension of integer types (function calls)

Daniel Sanders daniel.sanders at imgtec.com
Tue Apr 28 03:14:42 PDT 2015


In http://reviews.llvm.org/D9198#162493, @spetrovic wrote:

> There are two solutions for i32 signext problem. First,  i32 argument pass directly (in that case i32 will be sign extended) this fix is in MIPS part.
>
>   Second solution is fix in common code as I mentioned (CGCall.cpp file, ConstructAttributeList function). This would required new hook in TargetInfo. I think first solution is better for this problem. 


I agree that the first solution is the better approach but it shouldn't be passed direct. That would cause the backend to sign-extend on the callee side as well as the caller side. This happens because directly passed arguments have undefined upper bits and the operations sometimes (e.g. comparisons, shifts, etc.) require a sign/zero extension. It should be passed signext.


http://reviews.llvm.org/D9198

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list