From 6e2ce5201feaf4e429fdccc263074f2d40c1cd3a Mon Sep 17 00:00:00 2001 From: Michael Hamburg Date: Wed, 26 Apr 2017 11:37:48 -0700 Subject: [PATCH] internal VECTOR_ALIGNED instead of __attribute((aligned(32))), thanks Olivier --- src/GENERATED/c/curve25519/decaf.c | 3 +-- src/GENERATED/c/ed448goldilocks/decaf.c | 3 +-- src/p448/arch_x86_64/f_impl.c | 4 ++-- src/per_curve/decaf.tmpl.c | 3 +-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/GENERATED/c/curve25519/decaf.c b/src/GENERATED/c/curve25519/decaf.c index 9e5a3c7..afbb958 100644 --- a/src/GENERATED/c/curve25519/decaf.c +++ b/src/GENERATED/c/curve25519/decaf.c @@ -80,8 +80,7 @@ extern const point_t API_NS(point_base); /* Projective Niels coordinates */ typedef struct { gf a, b, c; } niels_s, niels_t[1]; -typedef struct { niels_t n; gf z; } __attribute__((aligned(sizeof(big_register_t)))) - pniels_s, pniels_t[1]; +typedef struct { niels_t n; gf z; } VECTOR_ALIGNED pniels_s, pniels_t[1]; /* Precomputed base */ struct precomputed_s { niels_t table [COMBS_N<<(COMBS_T-1)]; }; diff --git a/src/GENERATED/c/ed448goldilocks/decaf.c b/src/GENERATED/c/ed448goldilocks/decaf.c index 8dea34c..c159d1d 100644 --- a/src/GENERATED/c/ed448goldilocks/decaf.c +++ b/src/GENERATED/c/ed448goldilocks/decaf.c @@ -80,8 +80,7 @@ extern const point_t API_NS(point_base); /* Projective Niels coordinates */ typedef struct { gf a, b, c; } niels_s, niels_t[1]; -typedef struct { niels_t n; gf z; } __attribute__((aligned(sizeof(big_register_t)))) - pniels_s, pniels_t[1]; +typedef struct { niels_t n; gf z; } VECTOR_ALIGNED pniels_s, pniels_t[1]; /* Precomputed base */ struct precomputed_s { niels_t table [COMBS_N<<(COMBS_T-1)]; }; diff --git a/src/p448/arch_x86_64/f_impl.c b/src/p448/arch_x86_64/f_impl.c index 7bdf561..1e1d76d 100644 --- a/src/p448/arch_x86_64/f_impl.c +++ b/src/p448/arch_x86_64/f_impl.c @@ -11,7 +11,7 @@ void gf_mul (gf_s *__restrict__ cs, const gf as, const gf bs) { __uint128_t accum0 = 0, accum1 = 0, accum2; uint64_t mask = (1ull<<56) - 1; - uint64_t aa[4] __attribute__((aligned(32))), bb[4] __attribute__((aligned(32))), bbb[4] __attribute__((aligned(32))); + uint64_t aa[4] VECTOR_ALIGNED, bb[4] VECTOR_ALIGNED, bbb[4] VECTOR_ALIGNED; /* For some reason clang doesn't vectorize this without prompting? */ unsigned int i; @@ -186,7 +186,7 @@ void gf_sqr (gf_s *__restrict__ cs, const gf as) { __uint128_t accum0 = 0, accum1 = 0, accum2; uint64_t mask = (1ull<<56) - 1; - uint64_t aa[4] __attribute__((aligned(32))); + uint64_t aa[4] VECTOR_ALIGNED; /* For some reason clang doesn't vectorize this without prompting? */ unsigned int i; diff --git a/src/per_curve/decaf.tmpl.c b/src/per_curve/decaf.tmpl.c index 36ddd73..f1cac90 100644 --- a/src/per_curve/decaf.tmpl.c +++ b/src/per_curve/decaf.tmpl.c @@ -69,8 +69,7 @@ extern const point_t API_NS(point_base); /* Projective Niels coordinates */ typedef struct { gf a, b, c; } niels_s, niels_t[1]; -typedef struct { niels_t n; gf z; } __attribute__((aligned(sizeof(big_register_t)))) - pniels_s, pniels_t[1]; +typedef struct { niels_t n; gf z; } VECTOR_ALIGNED pniels_s, pniels_t[1]; /* Precomputed base */ struct precomputed_s { niels_t table [COMBS_N<<(COMBS_T-1)]; };