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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [gcc.target/] [i386/] [xop-vpermil2ps-256-1.c] - Blame information for rev 338

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  3
11
#endif
12
 
13
static float
14
select2sp(float *src1, float *src2, int sel)
15
{
16
    float tmp;
17
 
18
    if ((sel & 0x7) == 0) tmp = src1[0];
19
    if ((sel & 0x7) == 1) tmp = src1[1];
20
    if ((sel & 0x7) == 2) tmp = src1[2];
21
    if ((sel & 0x7) == 3) tmp = src1[3];
22
    if ((sel & 0x7) == 4) tmp = src2[0];
23
    if ((sel & 0x7) == 5) tmp = src2[1];
24
    if ((sel & 0x7) == 6) tmp = src2[2];
25
    if ((sel & 0x7) == 7) tmp = src2[3];
26
 
27
    return tmp;
28
}
29
static float
30
sel_and_condzerosp(float *src1, float *src2, int sel, int imm8)
31
{
32
    float tmp;
33
 
34
    tmp = select2sp(src1, src2, sel & 0x7);
35
 
36
    if (((imm8 & 0x3) == 2) && ((sel & 0x8) == 0x8)) tmp = 0;
37
    if (((imm8 & 0x3) == 3) && ((sel & 0x8) == 0x0)) tmp = 0;
38
 
39
    return tmp;
40
}
41
 
42
void static
43
xop_test ()
44
{
45
    int i;
46
    union256  source1, source2, u;
47
    union256i_d source3;
48
    float s1[8]={1, 2, 3, 4, 5, 6, 7, 8};
49
    float s2[8]={9, 10, 11, 12, 13, 14, 15, 16};
50
    int   s3[8]={11, 2, 3, 15, 5, 12, 7, 8};
51
    float  e[8];
52
 
53
    source1.x = _mm256_loadu_ps(s1);
54
    source2.x = _mm256_loadu_ps(s2);
55
    source3.x = _mm256_loadu_si256((__m256i*) s3);
56
    u.x = _mm256_permute2_ps(source1.x, source2.x, source3.x, ZERO_MATCH);
57
 
58
    for (i = 0; i < 8; ++i) {
59
        e[i] = sel_and_condzerosp(&s1[i & 0x4], &s2[i & 0x4], s3[i] & 0xf, ZERO_MATCH & 0x3);
60
    }
61
 
62
   if (check_union256(u, e))
63
     abort ();
64
}

powered by: WebSVN 2.1.0

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