arch: Fix VecReg container alignement to 128bits view
authorJordi Vaquero <jordi.vaquero@metempsy.com>
Tue, 21 Apr 2020 13:37:33 +0000 (15:37 +0200)
committerJordi Vaquero <jordi.vaquero@metempsy.com>
Thu, 23 Apr 2020 11:07:49 +0000 (11:07 +0000)
This Patch will fix the alignment problem that appears sometimes
when we try to create a view of 128 bits over the VecRegContainer
object.

That container is initially created as std::array<uint8_t, SIZE>, so
there is no obligation to be aligned to 16 bytes. This patches forces
all containers to be aligned to 16 bytes.

The problem has been observed in the Jira Issue:
https://gem5.atlassian.net/browse/GEM5-320

Change-Id: Id9fdd427bd7a4dc904edd519f31cc29c5b29c5e6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27968
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/arch/generic/vec_reg.hh

index 4156ac5efdfdafd0b59536d127487412ce645385..e26cf8b2c1112e230d8d218f287ba0aefba998ad 100644 (file)
@@ -279,7 +279,8 @@ class VecRegContainer
     static constexpr inline size_t size() { return SIZE; };
     using Container = std::array<uint8_t, SIZE>;
   private:
-    Container container;
+    // 16-byte aligned to support 128bit element view
+    alignas(16) Container container;
     using MyClass = VecRegContainer<SIZE>;
 
   public: