Changeset 58 for trunk/lib


Ignore:
Timestamp:
Feb 22, 2008, 6:49:38 AM (12 years ago)
Author:
cameron
Message:

simd_splat_16/32

Location:
trunk/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/altivec_simd.h

    r42 r58  
    376376#define simd_pack_8_hh(a, b) simd_pack_8(simd_srli_8(a, 4), simd_srli_8(b, 4))
    377377
    378 
     378// Splat the first 16-bit int into all positions.
     379static inline SIMD_type simd_splat_16(SIMD_type x) {
     380  return (SIMD_type) vec_splat((vUInt16) x, 0);
     381}
     382
     383// Splat the first 32-bit int into all positions.
     384static inline SIMD_type simd_splat_32(SIMD_type x) {
     385  return (SIMD_type) vec_splat((vUInt32) x, 0);
     386}
     387
     388static inline SIMD_type sisd_load_unaligned(SIMD_type * p) {
     389  SIMD_type input_shiftl = vec_lvsl(p,0);
     390  return vec_perm(vec_ld(0, p), vec_ld(15, p), input_shiftl);
     391}
    379392#endif
  • trunk/lib/lib_simd.h

    r55 r58  
    1313#ifndef LIB_SIMD_H
    1414#define LIB_SIMD_H
    15 
     15#include <sys/types.h>
     16#include <limits.h>
    1617
    1718#if (defined(__i386) || defined(__x86_64))
  • trunk/lib/sse_simd.h

    r42 r58  
    99
    1010/*------------------------------------------------------------*/
     11#include <stdint.h>
    1112#include <limits.h>
    1213#ifndef LONG_BIT
     
    625626#endif
    626627
     628
     629// Splat the first 16-bit int into all positions.
     630static inline SIMD_type simd_splat_16(SIMD_type x) {
     631  SIMD_type t = _mm_shufflelo_epi16(x,0);
     632  return _mm_shuffle_epi32(t,0);
     633}
     634
     635// Splat the first 32-bit int into all positions.
     636static inline SIMD_type simd_splat_32(SIMD_type x) {
     637  return _mm_shuffle_epi32(x,0);
     638}
     639
     640
     641
     642
    627643void print_bit_block(char * var_name, SIMD_type v) {
    628644  union {SIMD_type vec; unsigned char elems[8];} x;
Note: See TracChangeset for help on using the changeset viewer.