Skip to content

Commit

Permalink
Merge pull request #22 from pinterior/fix-ci
Browse files Browse the repository at this point in the history
Fix CI broken on #21 (Thx pinterior)
  • Loading branch information
stz2012 authored Feb 2, 2019
2 parents 8c26095 + 91e3750 commit e05daaf
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sudo: false
language: c
language: cpp

matrix:
include:
Expand Down
2 changes: 1 addition & 1 deletion src/multi2_cipher.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "multi2_ymm.h"
#include "multi2_xmm.h"

#if defined(__GNUC__)
#if defined(__GNUC__) || defined(__clang__)
# define MULTI2_ALWAYS_INLINE __attribute__((always_inline))
# define MULTI2_LIKELY(x) __builtin_expect(!!(x), 1)
#else
Expand Down
10 changes: 7 additions & 3 deletions src/multi2_xmm.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ class xmm {
__m128i v;

public:
inline xmm() { v = _mm_undefined_si128(); }
inline xmm() {
#if !defined(NO_MM_UNDEFINED)
v = _mm_undefined_si128();
#endif
}
inline xmm(uint32_t n) { v = _mm_set1_epi32(n); }
inline xmm(const __m128i &r) { v = r; }

Expand Down Expand Up @@ -166,9 +170,9 @@ inline std::pair<block<x86::xmm>, cbc_state> block<x86::xmm>::cbc_post_decrypt(c
__m128i c1 = c.right.value();

#if defined(__SSSE3__)
int s = _MM_SHUFFLE(1, 0, 2, 3);
const int s = _MM_SHUFFLE(1, 0, 2, 3);
#else
int s = _MM_SHUFFLE(2, 1, 0, 3);
const int s = _MM_SHUFFLE(2, 1, 0, 3);
#endif
__m128i b0 = _mm_shuffle_epi32(c0, s); // 2 0 1 3 / 2 1 0 3
__m128i b1 = _mm_shuffle_epi32(c1, s);
Expand Down
6 changes: 5 additions & 1 deletion src/multi2_ymm.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ class ymm {
__m256i v;

public:
inline ymm() { v = _mm256_undefined_si256(); }
inline ymm() {
#if !defined(NO_MM_UNDEFINED)
v = _mm256_undefined_si256();
#endif
}
inline ymm(uint32_t n) { v = _mm256_set1_epi32(n); }
inline ymm(const __m256i &r) { v = r; }

Expand Down
6 changes: 5 additions & 1 deletion src/multi2_ymm2.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ class ymm2 {
__m256i v1;

public:
inline ymm2() { v0 = v1 = _mm256_undefined_si256(); }
inline ymm2() {
#if !defined(NO_MM_UNDEFINED)
v0 = v1 = _mm256_undefined_si256();
#endif
}
inline ymm2(uint32_t n) { v0 = v1 = _mm256_set1_epi32(n); }
inline ymm2(const __m256i &r0, const __m256i &r1) {
v0 = r0;
Expand Down
7 changes: 7 additions & 0 deletions src/portable.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,11 @@ typedef signed __int64 int64_t;
#define _S_IWRITE (S_IWUSR|S_IWGRP|S_IWOTH)
#endif

#if defined(__GNUC__) && (__GNUC__ < 5 && !(__GNUC__ == 4 && 9 <= __GNUC_MINOR__))
#define NO_MM_UNDEFINED
#endif
#if defined(__clang__) && (__clang_major__ < 4 && !(__clang_major__ == 3 && 8 <= __clang_minor__))
#define NO_MM_UNDEFINED
#endif

#endif /* PORTABLE_H */

0 comments on commit e05daaf

Please sign in to comment.