Debian Codegraph @

src/impl_sse/sse_util.c

raw symbols SCIP
1 /* SSE utility routines
2 *
3 * Depending on how extensively these are used,
4 * might want to roll them in to esl_sse.[h/c]
5 */
6
7 #include "impl_sse.h"
8
9 /* Function: alt_rightshift_ps()
10 * Synopsis: Shift vector elements to the right.
11 * Incept: SRE, Thu Jul 31 17:13:59 2008 [Janelia]
12 * Alt: DLK, Thu Feb 26 2009
13 *
14 * Purpose: Returns a vector containing
15 * <{ b[3] a[0] a[1] a[2] }>:
16 * i.e. shift the values in <a> to the
17 * right, and load the LAST value of
18 * <b> into the first slot.
19 */
20 inline __m128
21 alt_rightshift_ps(__m128 a, __m128 b)
22 {
23 return _mm_move_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 1, 0, 0)), _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 3, 3, 3)));
24 }
25
26 void vecprint_ps(__m128 a)
27 {
28 union {
29 __m128 vec;
30 float f[4];
31 } x;
32
33 x.vec = a;
34 fprintf(stderr,"%10.2e %10.2e %10.2e %10.2e",x.f[0],x.f[1],x.f[2],x.f[3]);
35
36 return;
37 }
38
39
40 #if 0
41 /* Function: sse_leftshift_epi16()
42 * Date: DLK, Fri May 1 2009
43 *
44 * Purpose: Returns a vector containing
45 * <{ a[1] a[2] a[3] a[4] a[5] a[6] a[7] b[0] }>:
46 * i.e., shift the values in <a> to the
47 * left, and load in the first value of
48 * <b> into the last slot.
49 */
50 inline __m128i
51 sse_leftshift_epi16(__m128i a, __m128i b)
52 {
53 register __m128i v = _mm_srli_si128(a, 2); /* now a[1] a[2] a[3] a[4] a[5] a[6] a[7] 0 */
54 return _mm_insert_epi16(v,_mm_extract_epi16(b,0),7);
55 }
56
57 /* Function: sse_rightshift_epi16()
58 * Date: DLK, Fri May 1 2009
59 *
60 * Purpose: Returns a vector containing
61 * <{ b[7] a[0] a[1] a[2] a[3] a[4] a[5] a[6] }>:
62 * i.e., shift the values in <a> to the
63 * right, and load in the LAST value of
64 * <b> into the first slot.
65 */
66 inline __m128i
67 sse_rightshift_epi16(__m128i a, __m128i b)
68 {
69 register __m128i v = _mm_slli_si128(a, 2); /* now 0 a[0] a[1] a[2] a[3] a[4] a[5] a[6] */
70 return _mm_insert_epi16(v,_mm_extract_epi16(b,7),0);
71 }
72 #endif