File: ppc64-test-altivec-utils.c

package info (click to toggle)
android-platform-external-libunwind 10.0.0%2Br36-4.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,280 kB
  • sloc: ansic: 34,173; sh: 6,931; asm: 1,913; makefile: 842; cpp: 137
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]);
}