[flang-commits] [flang] [Flang][LoongArch] Add support for complex16 params/returns. (PR #114732)

Zhaoxin Yang via flang-commits flang-commits at lists.llvm.org
Sun Nov 3 20:43:00 PST 2024


https://github.com/ylzsx created https://github.com/llvm/llvm-project/pull/114732

This patch fixes the failure in flang test `Integration/debug-complex-1.f90`:
```
llvm-project/flang/lib/Optimizer/codeGen/Target.cpp:56:
not yet implemented: complex for this precision for return type
```

>From 29dfc18dcc36ee4b604075ff02b9eae55d26d2f8 Mon Sep 17 00:00:00 2001
From: yangzhaoxin <yangzhaoxin at loongson.cn>
Date: Tue, 29 Oct 2024 09:15:07 +0800
Subject: [PATCH] [Flang][LoongArch] Add support for complex16 params/returns.

This patch fixes the failure in flang test `Integration/debug-complex-1.f90`:
```
llvm-project/flang/lib/Optimizer/codeGen/Target.cpp:56:
not yet implemented: complex for this precision for return type
```
---
 flang/lib/Optimizer/CodeGen/Target.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/flang/lib/Optimizer/CodeGen/Target.cpp b/flang/lib/Optimizer/CodeGen/Target.cpp
index 6c148dffb0e55a..43a039e46d143d 100644
--- a/flang/lib/Optimizer/CodeGen/Target.cpp
+++ b/flang/lib/Optimizer/CodeGen/Target.cpp
@@ -1087,7 +1087,8 @@ struct TargetLoongArch64 : public GenericTarget<TargetLoongArch64> {
     CodeGenSpecifics::Marshalling marshal;
     const auto *sem = &floatToSemantics(kindMap, eleTy);
     if (sem == &llvm::APFloat::IEEEsingle() ||
-        sem == &llvm::APFloat::IEEEdouble()) {
+        sem == &llvm::APFloat::IEEEdouble() ||
+        sem == &llvm::APFloat::IEEEquad()) {
       // Two distinct element type arguments (re, im)
       marshal.emplace_back(eleTy, AT{});
       marshal.emplace_back(eleTy, AT{});
@@ -1102,7 +1103,8 @@ struct TargetLoongArch64 : public GenericTarget<TargetLoongArch64> {
     CodeGenSpecifics::Marshalling marshal;
     const auto *sem = &floatToSemantics(kindMap, eleTy);
     if (sem == &llvm::APFloat::IEEEsingle() ||
-        sem == &llvm::APFloat::IEEEdouble()) {
+        sem == &llvm::APFloat::IEEEdouble() ||
+        sem == &llvm::APFloat::IEEEquad()) {
       // Use a type that will be translated into LLVM as:
       // { t, t }   struct of 2 eleTy, byVal
       marshal.emplace_back(mlir::TupleType::get(eleTy.getContext(),



More information about the flang-commits mailing list