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/] [xop-vpermil2pd-256-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-require-effective-target xop } */
3
/* { dg-options "-O2 -mxop" } */
4
 
5
#include "xop-check.h"
6
 
7
#include <x86intrin.h>
8
 
9
#ifndef ZERO_MATCH
10
#define ZERO_MATCH 1
11
#endif
12
 
13
static double
14
select2dp(double *src1, double *src2, long long  sel)
15
{
16
    double tmp = 3.414;
17
 
18
    if ((sel & 0x3) == 0) tmp = src1[0];
19
    if ((sel & 0x3) == 1) tmp = src1[1];
20
    if ((sel & 0x3) == 2) tmp = src2[0];
21
    if ((sel & 0x3) == 3) tmp = src2[1];
22
 
23
    return tmp;
24
}
25
 
26
static double
27
sel_and_condzerodp(double *src1, double *src2, long long  sel, int imm8)
28
{
29
    double tmp;
30
 
31
    tmp = select2dp(src1, src2, sel);
32
 
33
    if (((imm8 & 0x3) == 2) && ((sel & 0x4) == 0x4)) tmp = 0;
34
    if (((imm8 & 0x3) == 3) && ((sel & 0x4) == 0x0)) tmp = 0;
35
 
36
    return tmp;
37
}
38
 
39
void static
40
xop_test ()
41
{
42
    union256d u, s1, s2;
43
    double   e[4] = {0.0};
44
    union256i_q s3;
45
 
46
    s1.x = _mm256_set_pd (1, 2, 3, 4);
47
    s2.x = _mm256_set_pd (5, 6, 7, 8);
48
    s3.x = _mm256_set_epi64x (0, 1, 2, 3);
49
    u.x = _mm256_permute2_pd(s1.x, s2.x, s3.x, ZERO_MATCH);
50
 
51
    e[0] = sel_and_condzerodp (s1.a, s2.a, (s3.a[0] & 0xe)>>1, ZERO_MATCH);
52
    e[1] = sel_and_condzerodp (s1.a, s2.a, (s3.a[1] & 0xe)>>1, ZERO_MATCH);
53
    e[2] = sel_and_condzerodp (s1.a + 2, s2.a + 2, (s3.a[2] & 0xe)>>1, ZERO_MATCH);
54
    e[3] = sel_and_condzerodp (s1.a + 2, s2.a + 2, (s3.a[3] & 0xe)>>1, ZERO_MATCH);
55
 
56
    if (check_union256d (u, e))
57
      abort ();
58
}

powered by: WebSVN 2.1.0

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