[clang] 33eac0f - [VE] Specify vector alignments

Kazushi Marukawa via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 30 05:09:32 PST 2020


Author: Kazushi (Jam) Marukawa
Date: 2020-11-30T22:09:21+09:00
New Revision: 33eac0f2830ee3f362ec0207a3d0e5f0861de8f1

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

LOG: [VE] Specify vector alignments

Specify alignments for all vector types.  Update a regression test also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D92256

Added: 
    

Modified: 
    clang/lib/Basic/Targets/VE.h
    clang/test/CodeGen/target-data.c
    llvm/lib/Target/VE/VETargetMachine.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/Targets/VE.h b/clang/lib/Basic/Targets/VE.h
index b8143747a38d..2d9c74ac5247 100644
--- a/clang/lib/Basic/Targets/VE.h
+++ b/clang/lib/Basic/Targets/VE.h
@@ -45,7 +45,9 @@ class LLVM_LIBRARY_VISIBILITY VETargetInfo : public TargetInfo {
     WCharType = UnsignedInt;
     WIntType = UnsignedInt;
     UseZeroLengthBitfieldAlignment = true;
-    resetDataLayout("e-m:e-i64:64-n32:64-S128");
+    resetDataLayout(
+        "e-m:e-i64:64-n32:64-S128-v64:64:64-v128:64:64-v256:64:64-v512:64:64-"
+        "v1024:64:64-v2048:64:64-v4096:64:64-v8192:64:64-v16384:64:64");
   }
 
   void getTargetDefines(const LangOptions &Opts,

diff  --git a/clang/test/CodeGen/target-data.c b/clang/test/CodeGen/target-data.c
index 82a0a867526b..1d7ed500340c 100644
--- a/clang/test/CodeGen/target-data.c
+++ b/clang/test/CodeGen/target-data.c
@@ -281,4 +281,4 @@
 
 // RUN: %clang_cc1 -triple ve -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=VE
-// VE: target datalayout = "e-m:e-i64:64-n32:64-S128"
+// VE: target datalayout = "e-m:e-i64:64-n32:64-S128-v64:64:64-v128:64:64-v256:64:64-v512:64:64-v1024:64:64-v2048:64:64-v4096:64:64-v8192:64:64-v16384:64:64"

diff  --git a/llvm/lib/Target/VE/VETargetMachine.cpp b/llvm/lib/Target/VE/VETargetMachine.cpp
index 12c4f4628811..1077abc54141 100644
--- a/llvm/lib/Target/VE/VETargetMachine.cpp
+++ b/llvm/lib/Target/VE/VETargetMachine.cpp
@@ -44,6 +44,19 @@ static std::string computeDataLayout(const Triple &T) {
   // Stack alignment is 128 bits
   Ret += "-S128";
 
+  // Vector alignments are 64 bits
+  // Need to define all of them.  Otherwise, each alignment becomes
+  // the size of each data by default.
+  Ret += "-v64:64:64"; // for v2f32
+  Ret += "-v128:64:64";
+  Ret += "-v256:64:64";
+  Ret += "-v512:64:64";
+  Ret += "-v1024:64:64";
+  Ret += "-v2048:64:64";
+  Ret += "-v4096:64:64";
+  Ret += "-v8192:64:64";
+  Ret += "-v16384:64:64"; // for v256f64
+
   return Ret;
 }
 


        


More information about the cfe-commits mailing list