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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [powerpc/] [altivec-12.c] - Blame information for rev 859

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

Line No. Rev Author Line
1 322 jeremybenn
/* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
2
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
3
/* { dg-require-effective-target powerpc_altivec_ok } */
4
/* { dg-options "-maltivec" } */
5
 
6
/* Program to test PowerPC AltiVec instructions.  */
7
 
8
#include <altivec.h>
9
 
10
extern void abort (void);
11
#define CHECK_IF(E) if(!(E)) abort()
12
 
13
vector int a1 = (vector int){ 100, 200, 300, 400 };
14
vector int a2 = (vector int){ 500, 600, 700, 800 };
15
vector int addi = (vector int){ 600, 800, 1000, 1200 };
16
vector int avgi = (vector int){ 300, 400, 500, 600 };
17
 
18
vector float f1 = (vector float){ 1.0, 2.0, 3.0, 4.0 };
19
vector float f2 = (vector float){ 5.0, 6.0, 7.0, 8.0 };
20
vector float f3;
21
vector float addf1 = (vector float){ 6.0, 8.0, 10.0, 12.0 };
22
vector float addf2 = (vector float){ 6.1, 8.1, 10.1, 12.1 };
23
vector float addf3 = (vector float){ 6.0, 8.0, 9.9, 12.1 };
24
vector int k;
25
vector float f, g, h;
26
 
27
int main ()
28
{
29
  k = vec_add (a1, a2);
30
  CHECK_IF (vec_all_eq (addi, k));
31
  CHECK_IF (vec_all_ge (addi, k));
32
  CHECK_IF (vec_all_le (addi, k));
33
  CHECK_IF (vec_any_eq (addi, k));
34
  CHECK_IF (vec_any_ge (addi, k));
35
  CHECK_IF (vec_any_le (addi, k));
36
  CHECK_IF (!vec_any_ne (addi, k));
37
  CHECK_IF (!vec_any_lt (addi, k));
38
  CHECK_IF (!vec_any_gt (addi, k));
39
  CHECK_IF (!vec_any_ne (addi, k));
40
  CHECK_IF (!vec_any_lt (addi, k));
41
  CHECK_IF (!vec_any_gt (addi, k));
42
 
43
  k = vec_avg (a1, a2);
44
  CHECK_IF (vec_all_eq (k, avgi));
45
 
46
  h = vec_add (f1, f2);
47
  CHECK_IF (vec_all_eq (h, addf1));
48
  CHECK_IF (vec_all_ge (h, addf1));
49
  CHECK_IF (vec_all_le (h, addf1));
50
  CHECK_IF (vec_any_eq (h, addf1));
51
  CHECK_IF (vec_any_ge (h, addf1));
52
  CHECK_IF (vec_any_le (h, addf1));
53
  CHECK_IF (!vec_any_ne (h, addf1));
54
  CHECK_IF (!vec_any_lt (h, addf1));
55
  CHECK_IF (!vec_any_gt (h, addf1));
56
  CHECK_IF (!vec_any_ne (h, addf1));
57
  CHECK_IF (!vec_any_lt (h, addf1));
58
  CHECK_IF (!vec_any_gt (h, addf1));
59
 
60
  CHECK_IF (vec_all_gt (addf2, addf1));
61
  CHECK_IF (vec_any_gt (addf2, addf1));
62
  CHECK_IF (vec_all_ge (addf2, addf1));
63
  CHECK_IF (vec_any_ge (addf2, addf1));
64
  CHECK_IF (vec_all_ne (addf2, addf1));
65
  CHECK_IF (vec_any_ne (addf2, addf1));
66
  CHECK_IF (!vec_all_lt (addf2, addf1));
67
  CHECK_IF (!vec_any_lt (addf2, addf1));
68
  CHECK_IF (!vec_all_le (addf2, addf1));
69
  CHECK_IF (!vec_any_le (addf2, addf1));
70
  CHECK_IF (!vec_all_eq (addf2, addf1));
71
  CHECK_IF (!vec_any_eq (addf2, addf1));
72
 
73
  CHECK_IF (vec_any_eq (addf3, addf1));
74
  CHECK_IF (vec_any_ne (addf3, addf1));
75
  CHECK_IF (vec_any_lt (addf3, addf1));
76
  CHECK_IF (vec_any_le (addf3, addf1));
77
  CHECK_IF (vec_any_gt (addf3, addf1));
78
  CHECK_IF (vec_any_ge (addf3, addf1));
79
  CHECK_IF (!vec_all_eq (addf3, addf1));
80
  CHECK_IF (!vec_all_ne (addf3, addf1));
81
  CHECK_IF (!vec_all_lt (addf3, addf1));
82
  CHECK_IF (!vec_all_le (addf3, addf1));
83
  CHECK_IF (!vec_all_gt (addf3, addf1));
84
  CHECK_IF (!vec_all_ge (addf3, addf1));
85
 
86
  CHECK_IF (vec_all_numeric (addf3));
87
  CHECK_IF (vec_all_in (addf1, addf2));
88
 
89
  CHECK_IF (vec_step (vector bool char) == 16);
90
  CHECK_IF (vec_step (addf3) == 4);
91
 
92
  return 0;
93
}

powered by: WebSVN 2.1.0

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