swar-setkind.c 649 Bytes
//A: --has-swar
//C: -daiteq-swar-type=alu -daiteq-swar-enable

// option set directly type of SWAR unit (types are: audio,video,alu, bytype or option is not used)

#include <stdio.h>

typedef unsigned int s4x8b __attribute__((subword(8)));

#define LEN 10

unsigned int data_a[LEN] = {1,2,3,4,5,6,7,8,9,10};
unsigned int data_b[LEN] = {10,20,30,40,50,60,70,80,90,100};
unsigned int data_z[LEN] = {0,0,0,0,0,0,0,0,0,0};


void do_4x8b_add(void)
{
  s4x8b *a = (s4x8b *)data_a;
  s4x8b *b = (s4x8b *)data_b;
  s4x8b *z = (s4x8b *)data_z;

  for (int i=0;i<LEN;++i)
  {
    z[i] = a[i] + b[i];
  }
}


int main(void)
{
  do_4x8b_add();

  return 0;
}