File: ppc64-test-altivec-utils.c

package info (click to toggle)
libunwind 0.99-0.2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 4,932 kB
  • ctags: 4,079
  • sloc: ansic: 23,131; sh: 18,577; asm: 1,637; makefile: 694; cpp: 70
file content (32 lines) | stat: -rw-r--r-- 617 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdio.h>
#include <altivec.h>

union si_overlay
{
  vector signed int v;
  int ints[4];
};

vector signed int
vec_init ()
{
  vector signed int v;
  static int count = 1;

  ((union si_overlay *) &v)->ints[0] = count++;
  ((union si_overlay *) &v)->ints[1] = count++;
  ((union si_overlay *) &v)->ints[2] = count++;
  ((union si_overlay *) &v)->ints[3] = count++;
  return v;
}

void
vec_print (vector signed int v)
{
  printf ("%08x %08x %08x %08x",
	 ((union si_overlay *) &v)->ints[0],
	 ((union si_overlay *) &v)->ints[1],
	 ((union si_overlay *) &v)->ints[2],
	 ((union si_overlay *) &v)->ints[3]);
}