[PATCH] D21739: [TTI] Add functions determining if int parameters/returns should be zeroext/signext.

Marcin Koƛcielnicki via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 28 03:05:28 PDT 2016


koriakin added inline comments.

================
Comment at: lib/Target/Mips/MipsTargetTransformInfo.h:42
@@ +41,3 @@
+
+  bool shouldExtI32Param() const { return ST->isABI_N64(); }
+};
----------------
dsanders wrote:
> This doesn't look correct to me. On our target we unconditionally add the signext attribute to i32 in the frontend. This only has a significant effect for the 64-bit ABI's (N32 and N64) but it's still useful for the 32-bit ABI's (O32) as a reminder of how 32-bit code operates when run on a 64-bit processor (every instruction from the 32-bit subset sign-extends the result value from 32-bit to register width).
> 
> Returns also behave the same way as parameters.
So, for Mips, we'd need a third predicate that forces a signext even for unsigned parameters, right?

Returns don't seem to get any ext attribute, though:

unsigned f(unsigned x) {
        return x;
}

gets compiled by clang to:

define i32 @f(i32 signext) #0 { ... }


Repository:
  rL LLVM

http://reviews.llvm.org/D21739





More information about the llvm-commits mailing list