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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [powerpc/] [recip-5.c] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
/* { dg-do compile { target { powerpc*-*-* } } } */
2
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
3
/* { dg-require-effective-target powerpc_vsx_ok } */
4
/* { dg-options "-O3 -ftree-vectorize -mrecip=all -ffast-math -mcpu=power7 -fno-unroll-loops" } */
5
/* { dg-final { scan-assembler-times "xvredp" 4 } } */
6
/* { dg-final { scan-assembler-times "xvresp" 5 } } */
7
/* { dg-final { scan-assembler-times "xsredp" 2 } } */
8
/* { dg-final { scan-assembler-times "fres" 2 } } */
9
 
10
#include <altivec.h>
11
 
12
float f_recip (float a, float b) { return __builtin_recipdivf (a, b); }
13
double d_recip (double a, double b) { return __builtin_recipdiv (a, b); }
14
 
15
float f_div (float a, float b) { return a / b; }
16
double d_div (double a, double b) { return a / b; }
17
 
18
#define SIZE 1024
19
 
20
double d_a[SIZE] __attribute__((__aligned__(32)));
21
double d_b[SIZE] __attribute__((__aligned__(32)));
22
double d_c[SIZE] __attribute__((__aligned__(32)));
23
 
24
float f_a[SIZE] __attribute__((__aligned__(32)));
25
float f_b[SIZE] __attribute__((__aligned__(32)));
26
float f_c[SIZE] __attribute__((__aligned__(32)));
27
 
28
void vec_f_recip (void)
29
{
30
  int i;
31
 
32
  for (i = 0; i < SIZE; i++)
33
    f_a[i] = __builtin_recipdivf (f_b[i], f_c[i]);
34
}
35
 
36
void vec_d_recip (void)
37
{
38
  int i;
39
 
40
  for (i = 0; i < SIZE; i++)
41
    d_a[i] = __builtin_recipdiv (d_b[i], d_c[i]);
42
}
43
 
44
void vec_f_div (void)
45
{
46
  int i;
47
 
48
  for (i = 0; i < SIZE; i++)
49
    f_a[i] = f_b[i] / f_c[i];
50
}
51
 
52
void vec_f_div2 (void)
53
{
54
  int i;
55
 
56
  for (i = 0; i < SIZE; i++)
57
    f_a[i] = f_b[i] / 2.0f;
58
}
59
 
60
void vec_f_div53 (void)
61
{
62
  int i;
63
 
64
  for (i = 0; i < SIZE; i++)
65
    f_a[i] = f_b[i] / 53.0f;
66
}
67
 
68
void vec_d_div (void)
69
{
70
  int i;
71
 
72
  for (i = 0; i < SIZE; i++)
73
    d_a[i] = d_b[i] / d_c[i];
74
}
75
 
76
void vec_d_div2 (void)
77
{
78
  int i;
79
 
80
  for (i = 0; i < SIZE; i++)
81
    d_a[i] = d_b[i] / 2.0;
82
}
83
 
84
void vec_d_div53 (void)
85
{
86
  int i;
87
 
88
  for (i = 0; i < SIZE; i++)
89
    d_a[i] = d_b[i] / 53.0;
90
}
91
 
92
vector float v4sf_recip1 (vector float a, vector float b) { return vec_recipdiv (a, b); }
93
vector float v4sf_recip2 (vector float a, vector float b) { return __builtin_altivec_vrecipdivfp (a, b); }
94
vector double v2df_recip1 (vector double a, vector double b) { return vec_recipdiv (a, b); }
95
vector float v4sf_recip3 (vector float a, vector float b) { return __builtin_vsx_xvrecipdivsp (a, b); }
96
vector double v2df_recip2 (vector double a, vector double b) { return __builtin_vsx_xvrecipdivdp (a, b); }

powered by: WebSVN 2.1.0

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