Ensure simd types are aligned to what we assume

Turns out Clang is sensitive to the location of the alignment attribute.
This commit is contained in:
Matthew Barr
2017-04-07 16:40:11 +10:00
parent c0d7960954
commit 0b8f25a036
2 changed files with 9 additions and 1 deletions

View File

@@ -542,6 +542,7 @@ TYPED_TEST(SimdUtilsTest, load_store) {
auto mem_ptr = make_bytecode_ptr<char>(sizeof(a), alignof(TypeParam));
char *mem = mem_ptr.get();
ASSERT_EQ(0, (size_t)mem % 16U);
memset(mem, 0, sizeof(a));
@@ -585,6 +586,13 @@ TYPED_TEST(SimdUtilsTest, loadbytes_storebytes) {
}
}
TEST(SimdUtilsTest, alignment) {
ASSERT_EQ(16, alignof(m128));
ASSERT_EQ(32, alignof(m256));
ASSERT_EQ(16, alignof(m384));
ASSERT_EQ(32, alignof(m512));
}
TEST(SimdUtilsTest, movq) {
m128 simd;