[clang] eb49b86 - [Clang][LoongArch] Add ABI implementation of passing vectors

Weining Lu via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 31 00:54:02 PDT 2023


Author: licongtian
Date: 2023-10-31T15:52:05+08:00
New Revision: eb49b86f5a9b54b0e3c37024334a3c6f6ca88e14

URL: https://github.com/llvm/llvm-project/commit/eb49b86f5a9b54b0e3c37024334a3c6f6ca88e14
DIFF: https://github.com/llvm/llvm-project/commit/eb49b86f5a9b54b0e3c37024334a3c6f6ca88e14.diff

LOG: [Clang][LoongArch] Add ABI implementation of passing vectors

Added: 
    

Modified: 
    clang/lib/CodeGen/Targets/LoongArch.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/Targets/LoongArch.cpp b/clang/lib/CodeGen/Targets/LoongArch.cpp
index 7483bf6d6d1e8e2..26c68c3583b2a19 100644
--- a/clang/lib/CodeGen/Targets/LoongArch.cpp
+++ b/clang/lib/CodeGen/Targets/LoongArch.cpp
@@ -321,6 +321,13 @@ ABIArgInfo LoongArchABIInfo::classifyArgumentType(QualType Ty, bool IsFixed,
     return ABIArgInfo::getDirect();
   }
 
+  // Pass 128-bit/256-bit vector values via vector registers directly.
+  if (Ty->isVectorType() && (((getContext().getTypeSize(Ty) == 128) &&
+                              (getTarget().hasFeature("lsx"))) ||
+                             ((getContext().getTypeSize(Ty) == 256) &&
+                              getTarget().hasFeature("lasx"))))
+    return ABIArgInfo::getDirect();
+
   // Complex types for the *f or *d ABI must be passed directly rather than
   // using CoerceAndExpand.
   if (IsFixed && Ty->isComplexType() && FRLen && FARsLeft >= 2) {


        


More information about the cfe-commits mailing list