File: sse-42-check.c

package info (click to toggle)
haskell-hashtables 1.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 420 kB
  • sloc: haskell: 4,662; ansic: 590; makefile: 14; sh: 4
file content (38 lines) | stat: -rw-r--r-- 756 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "defs.h"

#include <smmintrin.h>
#include <stdio.h>

extern __m128i fill(small_hash_t v);

static void check_fill(small_hash_t v) {
    int i;
    char buf[256];
    small_hash_t v2;

    __m128i x = fill(v);

#define F(i) do {                                       \
        v2 = _mm_extract_epi16(x, i);                   \
        sprintf(buf, "fill-%x-%d-of-8", (int) v, i+1);  \
        CHECK(v2, v, buf);                              \
    } while(0);

    F(0);
    F(1);
    F(2);
    F(3);
    F(4);
    F(5);
    F(6);
    F(7);
#undef F
}

void check_impl_specific(int* num_tests, int* num_errors) {
    check_fill(0);
    check_fill((small_hash_t) (-1));
    check_fill((small_hash_t) (-5));
    check_fill(7);
    check_fill(0xff);
}