[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
----------------
kiranchandramohan wrote:

Does it talk only about arguments and not return values?

https://github.com/llvm/llvm-project/pull/137105


More information about the flang-commits mailing list