swar-fcn.c 819 Bytes
//A: --has-swar
//C: -daiteq-swar-enable

#include <stdint.h>

typedef unsigned int s10x3b __attribute__((subword(3)));

#define LEN 5

uint32_t data_a[LEN] = {01234567123,01122334455,07777777777,04444444444,07654765476};
uint32_t data_b[LEN] = {07654321765,02342342342,01234567123,02323232323,00000000000};
uint32_t data_z[LEN] = {0,0,0,0,0};

/* swar functions */
#define C_COR1b 0x4
#define C_COR2b 0x5
#define C_COR3b 0x6
#define C_COR4b 0x7
#define C_DEMR2b 0x9
#define C_DEMR3b 0xa
#define C_DEMR4b 0xb
#define C_DEMC2b 0xd
#define C_DEMC3b 0xe
#define C_DEMC4b 0xf
#define C_DEMC2bG 0x1
#define C_DEMC3bG 0x2
#define C_DEMC4bG 0x3


int main(void)
{
  __builtin_swarctrl(C_COR3b);

  for(int i=0;i<LEN;++i) {
    data_z[i] = swar(data_a[i], data_b[i]);
  }

  uint32_t a = __builtin_swaraccum(0);

  return 0;
}