[flang-commits] [flang] [flang] Use correct int extension flags for C-ABI calls on aarch64 (PR #137105)
Kiran Chandramohan via flang-commits
flang-commits at lists.llvm.org
Thu Apr 24 08:58:13 PDT 2025
================
@@ -810,6 +810,33 @@ struct TargetAArch64 : public GenericTarget<TargetAArch64> {
return marshal;
}
+ CodeGenSpecifics::Marshalling
+ integerArgumentType(mlir::Location loc,
+ mlir::IntegerType argTy) const override {
+ if (argTy.getWidth() < getCIntTypeWidth() && argTy.isSignless()) {
+ AT::IntegerExtension intExt;
+ if (argTy.getWidth() == 1) {
+ // Zero extend for 'i1'.
+ intExt = AT::IntegerExtension::Zero;
+ } else {
+ if (triple.isOSDarwin())
+ // On Darwin, sign extend. The apple developer guide specifies this as
+ // a divergence from the AArch64PCS:
+ // https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms#Pass-arguments-to-functions-correctly
+ intExt = AT::IntegerExtension::Sign;
+ else
+ // On linux, pass directly and do not extend.
+ intExt = AT::IntegerExtension::None;
----------------
kiranchandramohan wrote:
Nit: braces (even if it is multi-line only due to comments)
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements
https://github.com/llvm/llvm-project/pull/137105
More information about the flang-commits
mailing list