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-1.c] - Blame information for rev 826

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
 
12
vector int a1 = { 100, 200, 300, 400 };
13
vector int a2 = { 500, 600, 700, 800 };
14
vector int addi = { 600, 800, 1000, 1200 };
15
vector int avgi = { 300, 400, 500, 600 };
16
 
17
vector float f1 = { 1.0, 2.0, 3.0, 4.0 };
18
vector float f2 = { 5.0, 6.0, 7.0, 8.0 };
19
vector float f3;
20
vector float addf = { 6.0, 8.0, 10.0, 12.0 };
21
 
22
vector int k;
23
vector float f, g, h;
24
 
25
int main ()
26
{
27
  k = vec_add (a1, a2);
28
  if (!vec_all_eq (addi, k))
29
    abort ();
30
 
31
  k = vec_avg (a1, a2);
32
  if (!vec_all_eq (k, avgi))
33
    abort ();
34
 
35
  h = vec_add (f1, f2);
36
  if (!vec_all_eq (h, addf))
37
    abort ();
38
 
39
  return 0;
40
}

powered by: WebSVN 2.1.0

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