diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-03-27 10:09:17 +0100 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-03-27 10:09:17 +0100 |
commit | 61639db3a2b958240d764befbb22213cb77284af (patch) | |
tree | e81541c5257e8ca1a857b670bdb2893e4cdb1265 | |
parent | f5beb55d283078afc2ce782201aef464c10b2e8f (diff) | |
download | compcert-kvx-61639db3a2b958240d764befbb22213cb77284af.tar.gz compcert-kvx-61639db3a2b958240d764befbb22213cb77284af.zip |
put both compilers in their best mood
-rw-r--r-- | test/monniaux/bitsliced-aes/bs.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/test/monniaux/bitsliced-aes/bs.c b/test/monniaux/bitsliced-aes/bs.c index 46dee525..5928cce5 100644 --- a/test/monniaux/bitsliced-aes/bs.c +++ b/test/monniaux/bitsliced-aes/bs.c @@ -403,19 +403,24 @@ void bs_transpose_dst(word_t * transpose, word_t * blocks) int offset = i << MUL_SHIFT; #ifndef UNROLL_TRANSPOSE - int j; - /* DM use autoincrement */ + int j; +#ifdef __COMPCERT__ word_t *transptr = transpose+offset; word_t bitmask = ONE; for(j=0; j < WORD_SIZE; j++) { - // TODO make const time - word_t old = *transptr; - /* *(transptr++) = old | TERNARY0((w & bitmask), bitpos); */ + word_t old = *transptr; *(transptr++) = TERNARY(w & bitmask, old, old|bitpos); bitmask <<= 1; } #else + for(j=0; j < WORD_SIZE; j++) + { + // TODO make const time + transpose[offset + j] |= (w & (ONE << j)) ? bitpos : 0; + } +#endif +#else transpose[(offset)+ 0 ] |= (w & (ONE << 0 )) ? (bitpos) : 0; transpose[(offset)+ 1 ] |= (w & (ONE << 1 )) ? (bitpos) : 0; @@ -507,6 +512,7 @@ void bs_transpose_rev(word_t * blocks) word_t offset = k / WORD_SIZE; #ifndef UNROLL_TRANSPOSE int j; +#ifdef __COMPCERT__ word_t *transptr = transpose + offset; word_t bitmask = ONE; for(j=0; j < WORD_SIZE; j++) @@ -517,6 +523,13 @@ void bs_transpose_rev(word_t * blocks) bitmask <<= 1; } #else + for(j=0; j < WORD_SIZE; j++) + { + word_t bit = (w & (ONE << j)) ? (ONE << (k % WORD_SIZE)) : 0; + transpose[j * WORDS_PER_BLOCK + (offset)] |= bit; + } +#endif +#else transpose[0 * WORDS_PER_BLOCK + (offset )] |= (w & (ONE << 0 )) ? bitpos : 0; transpose[1 * WORDS_PER_BLOCK + (offset )] |= (w & (ONE << 1 )) ? bitpos : 0; transpose[2 * WORDS_PER_BLOCK + (offset )] |= (w & (ONE << 2 )) ? bitpos : 0; |