PIPS
shuffle.c File Reference
#include <stdint.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "SIMD.h"
#include "SIMD_types.h"
+ Include dependency graph for shuffle.c:

Go to the source code of this file.

Functions

void shuffle (int n, float r[n], float r3[n], float r2[n], float a[n], float b[n])
 
int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 31 of file shuffle.c.

32 {
33  int n = (argc>1)?atoi(argv[0]):10;
34  float* r = (float*)malloc(sizeof(float)*n);
35  float* r2 = (float*)malloc(sizeof(float)*n);
36  float* r3 = (float*)malloc(sizeof(float)*n);
37  float* a = (float*)malloc(sizeof(float)*n);
38  float* b = (float*)malloc(sizeof(float)*n);
39  int i;
40 
41  for (i=0;i<n;i++)
42  {
43  a[i] = i;
44  b[i] = i;
45  }
46  shuffle(n, r, r2, r3, a, b);
47 
48  for (i=0;i<n;i++)
49  printf("%f %f\n", r[i], r2[i]);
50  return 0;
51 }
void * malloc(YYSIZE_T)
int printf()
void shuffle(int n, float r[n], float r3[n], float r2[n], float a[n], float b[n])
Definition: shuffle.c:9

References malloc(), printf(), and shuffle().

+ Here is the call graph for this function:

◆ shuffle()

void shuffle ( int  n,
float  r[n],
float  r3[n],
float  r2[n],
float  a[n],
float  b[n] 
)

Definition at line 9 of file shuffle.c.

10 {
11  int i;
12  for (i=0; i<n; i += 4)
13  {
14  r[i] = a[i]+b[i];
15  r[i+1] = a[i+1]+b[i+1];
16  r[i+2] = a[i+2]+b[i+2];
17  r[i+3] = a[i+3]+b[i+3];
18 
19  r2[i] = a[i]+b[i+2];
20  r2[i+1] = a[i+1]+b[i+1];
21  r2[i+2] = a[i+2]+b[i+3];
22  r2[i+3] = a[i+3]+b[i];
23 
24  r3[i] = a[i]+b[i];
25  r3[i+1] = a[i+1]+b[i+3];
26  r3[i+2] = a[i+2]+b[i+2];
27  r3[i+3] = a[i+3]+b[i+1];
28  }
29 }

Referenced by expressions_to_vector(), generate_load_statement(), main(), make_shuffle_statement(), and try_all_permutations().

+ Here is the caller graph for this function: