[flang-commits] [flang] [Flang][LoongArch] Add sign extension for i32 arguments and returns in function signatures. (PR #116146)

Zhaoxin Yang via flang-commits flang-commits at lists.llvm.org
Thu Nov 14 17:18:14 PST 2024


================
@@ -1127,6 +1127,30 @@ struct TargetLoongArch64 : public GenericTarget<TargetLoongArch64> {
     }
     return marshal;
   }
+
+  CodeGenSpecifics::Marshalling
+  integerArgumentType(mlir::Location loc,
+                      mlir::IntegerType argTy) const override {
+    if (argTy.getWidth() == 32) {
+      // LA64 LP64D ABI requires unsigned 32 bit integers to be sign extended.
----------------
ylzsx wrote:

Firstly, thanks for your review.
However, I think the check is not necessary. For "signed" argTy, sign extension is natural, and for "unsigned" argTy, sign extension is also required according to LoongArch64 ABI. Therefore, under this ABI, sign extension is always needed for i32 types.

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


More information about the flang-commits mailing list