You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.5 KiB
66 lines
1.5 KiB
#ifndef _TM_TYPES_H
|
|
#define _TM_TYPES_H
|
|
|
|
#include <stdint.h>
|
|
|
|
// 128-bit vector types
|
|
#ifndef _TM_NO_VECTORS
|
|
#include <mmintrin.h>
|
|
#include <xmmintrin.h>
|
|
#include <emmintrin.h>
|
|
|
|
#define _VECTOR_SIZE 16
|
|
|
|
// Vector128 int 8
|
|
typedef uint8_t v8_u128n __attribute__((vector_size(_VECTOR_SIZE)));
|
|
typedef int8_t v8_i128n __attribute__((vector_size(_VECTOR_SIZE)));
|
|
|
|
// Vector128 int 16
|
|
typedef uint16_t v16_u128n __attribute__((vector_size(_VECTOR_SIZE)));
|
|
typedef int16_t v16_i128n __attribute__((vector_size(_VECTOR_SIZE)));
|
|
|
|
// Vector128 int 32
|
|
typedef uint32_t v32_u128n __attribute__((vector_size(_VECTOR_SIZE)));
|
|
typedef int32_t v32_i128n __attribute__((vector_size(_VECTOR_SIZE)));
|
|
|
|
// Vector128 int 64
|
|
typedef uint64_t v64_u128n __attribute__((vector_size(_VECTOR_SIZE)));
|
|
typedef int64_t v64_i128n __attribute__((vector_size(_VECTOR_SIZE)));
|
|
|
|
typedef union v128 {
|
|
// Intrinsics
|
|
__m128i mm; // long int
|
|
__m128d mmd; // double
|
|
__m128 mmf; // float //XXX: Should we have the halfs
|
|
|
|
// Vectorised integers
|
|
union {
|
|
v8_u128n u8;
|
|
v8_i128n i8;
|
|
|
|
v16_u128n u16;
|
|
v16_i128n i16;
|
|
|
|
v32_u128n u32;
|
|
v32_i128n i32;
|
|
|
|
v64_u128n u64;
|
|
v64_i128n i64;
|
|
} as;
|
|
|
|
// Native 128 bit integers
|
|
unsigned __int128 u128;
|
|
__int128 i128;
|
|
|
|
// Raw bytes
|
|
uint8_t bytes[_VECTOR_SIZE];
|
|
} v128_t;
|
|
|
|
_Static_assert(sizeof(union v128)==_VECTOR_SIZE, "invalid vector size");
|
|
_Static_assert(_Alignof(union v128)==_Alignof(__m128i), "invalid vector alignment");
|
|
#endif
|
|
|
|
#include "ints.h"
|
|
|
|
#endif /* _TM_TYPES_H */
|