Changeset 336 for trunk


Ignore:
Timestamp:
Nov 17, 2009, 5:43:37 PM (10 years ago)
Author:
ksherdy
Message:

Widened name field in print_bit_block to 30 characters. Added 64 bit field SIMD equal function with SSE 41 support.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/sse_simd_t.h

    r335 r336  
    3838
    3939#if defined (__SSE4_2__) || defined (__SSE4_1__)
     40
    4041#include <smmintrin.h>
    4142#endif
     
    142143        template <HOM_t m1, HOM_t m2> static inline SIMD_type mergeh(SIMD_type r1, SIMD_type r2);
    143144        template <HOM_t m1, HOM_t m2> static inline SIMD_type mergel(SIMD_type r1, SIMD_type r2);
     145
    144146};
    145147
     
    409411template<> inline SIMD_type simd<32>::eq(SIMD_type r1, SIMD_type r2) {return _mm_cmpeq_epi32(r1, r2);}
    410412
    411 
    412 
     413template<> inline SIMD_type simd<64>::eq(SIMD_type r1, SIMD_type r2) {
     414
     415#ifdef __SSE4_1__
     416  return _mm_cmpeq_epi64(r1, r2);
     417#else
     418  SIMD_type t = _mm_cmpeq_epi32(r1, r2);
     419  return simd_and(t, _mm_shuffle_epi32(t,_MM_SHUFFLE(2,3,0,1)));
     420#endif
     421
     422}
    413423
    414424/*simd_pack
     
    458468
    459469
    460 
    461 
    462 
    463470#define simd_all_eq_8(v1, v2) simd_all_true<8>(_mm_cmpeq_epi8(v1, v2))
    464471#define simd_mask_eq_8(v1, v2, hex_mask) simd_mask_true<8>(_mm_cmpeq_epi8(v1, v2), hex_mask)
     
    675682
    676683#if (BYTE_ORDER == BIG_ENDIAN)
    677 void print_bit_block(char * var_name, SIMD_type v) {
     684void print_bit_block(const char * var_name, SIMD_type v) {
    678685  union {SIMD_type vec; unsigned char elems[8];} x;
    679686  x.vec = v;
    680687  unsigned char c, bit_reversed;
    681688  int i;
    682   printf("%20s = ", var_name);
     689  printf("%30s = ", var_name);
    683690  for (i = 0; i < sizeof(SIMD_type); i++) {
    684691    c = x.elems[i];
     
    690697
    691698#if (BYTE_ORDER == LITTLE_ENDIAN)
    692 void print_bit_block(char * var_name, SIMD_type v) {
     699void print_bit_block(const char * var_name, SIMD_type v) {
    693700  union {SIMD_type vec; unsigned char elems[8];} x;
    694701  x.vec = v;
    695702  unsigned char c, bit_reversed;
    696703  int i;
    697   printf("%20s = ", var_name);
     704  printf("%30s = ", var_name);
    698705  for (i = sizeof(SIMD_type)-1; i >= 0; i--) {
    699706    c = x.elems[i];
Note: See TracChangeset for help on using the changeset viewer.