OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [i386/] [sse-cmpss-1.c] - Blame information for rev 318

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 318 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O2 -msse -std=c99" } */
3
/* { dg-require-effective-target sse } */
4
/* { dg-require-effective-target c99_runtime } */
5
 
6
#ifndef CHECK_H
7
#define CHECK_H "sse-check.h"
8
#endif
9
 
10
#ifndef TEST
11
#define TEST sse_test
12
#endif
13
 
14
#include CHECK_H
15
 
16
#include <math.h>
17
 
18
float s1[]={2134.3343, 6678.346, 453.345635, 54646.464356};
19
float s2[]={41124.234, 6678.346, 8653.65635, 856.43576};
20
int dd[] = {1, 2, 3, 4};
21
float d[4];
22
union{int i[4]; float f[4];} e;
23
 
24
void check(char *id)
25
{
26
    if(checkVi((int*)d, e.i, 4)){
27
        printf("mm_cmp%s_ss FAILED\n", id);
28
    }
29
}
30
 
31
static void
32
TEST ()
33
{
34
    __m128 source1, source2, dest;
35
    int i;
36
 
37
#define CMP(cmp, rel)                                   \
38
    e.i[0] = rel ? -1 : 0;                                \
39
    dest = _mm_loadu_ps((float*)dd);                    \
40
    source1 = _mm_loadu_ps(s1);                         \
41
    source2 = _mm_loadu_ps(s2);                         \
42
    dest = _mm_cmp##cmp##_ss(source1, source2);         \
43
    _mm_storeu_ps(d, dest);                             \
44
    check("" #cmp "");
45
 
46
    for(i = 1; i < 4; i++) e.f[i] = s1[i];
47
 
48
    CMP(eq, !isunordered(s1[0], s2[0]) && s1[0] == s2[0]);
49
    CMP(lt, !isunordered(s1[0], s2[0]) && s1[0] < s2[0]);
50
    CMP(le, !isunordered(s1[0], s2[0]) && s1[0] <= s2[0]);
51
    CMP(unord, isunordered(s1[0], s2[0]));
52
    CMP(neq, isunordered(s1[0], s2[0]) || s1[0] != s2[0]);
53
    CMP(nlt, isunordered(s1[0], s2[0]) || s1[0] >= s2[0]);
54
    CMP(nle, isunordered(s1[0], s2[0]) || s1[0] > s2[0]);
55
    CMP(ord, !isunordered(s1[0], s2[0]));
56
 
57
    CMP(ge, isunordered(s1[0], s2[0]) || s1[0] >= s2[0]);
58
    CMP(gt, isunordered(s1[0], s2[0]) || s1[0] > s2[0]);
59
    CMP(nge, !isunordered(s1[0], s2[0]) && s1[0] < s2[0]);
60
    CMP(ngt, !isunordered(s1[0], s2[0]) && s1[0] <= s2[0]);
61
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.