summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Targets.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-02-12 14:48:34 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-02-12 14:48:34 +0000
commit8e57697cfd75ec590307267128456a30707156af (patch)
treea553b66b7ebb4fa9cc25c02eca3f0672c7a729d3 /clang/lib/Basic/Targets.cpp
parent2f1025d68a2214ea704bf29a9d5ac7e6cc8d2bf0 (diff)
downloadbcm5719-llvm-8e57697cfd75ec590307267128456a30707156af.tar.gz
bcm5719-llvm-8e57697cfd75ec590307267128456a30707156af.zip
[Hexagon] Specify vector alignment in DataLayout string
The DataLayout can calculate alignment of vectors based on the alignment of the element type and the number of elements. In fact, it is the product of these two values. The problem is that for vectors of N x i1, this will return the alignment of N bytes, since the alignment of i1 is 8 bits. The vector types of vNi1 should be aligned to N bits instead. Provide explicit alignment for HVX vectors to avoid such complications. llvm-svn: 260680
Diffstat (limited to 'clang/lib/Basic/Targets.cpp')
-rw-r--r--clang/lib/Basic/Targets.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index 2651cfe4ef4..aea14306c77 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -5697,9 +5697,12 @@ class HexagonTargetInfo : public TargetInfo {
public:
HexagonTargetInfo(const llvm::Triple &Triple) : TargetInfo(Triple) {
BigEndian = false;
- DataLayoutString = "e-m:e-p:32:32:32-"
- "i64:64:64-i32:32:32-i16:16:16-i1:8:8-"
- "f64:64:64-f32:32:32-v64:64:64-v32:32:32-a:0-n16:32";
+ // Specify the vector alignment explicitly. For v512x1, the calculated
+ // alignment would be 512*alignment(i1), which is 512 bytes, instead of
+ // the required minimum of 64 bytes.
+ DataLayoutString = "e-m:e-p:32:32:32-a:0-n16:32-"
+ "i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-"
+ "v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048";
SizeType = UnsignedInt;
PtrDiffType = SignedInt;
IntPtrType = SignedInt;
OpenPOWER on IntegriCloud