swar-sizeof.c 1.18 KB
//A: --has-swar
//C: -daiteq-swar-enable

typedef unsigned int s32x1b __attribute__((subword(1)));
typedef unsigned int s16x2b __attribute__((subword(2)));
typedef unsigned int s10x3b __attribute__((subword(3)));
typedef unsigned int s8x4b __attribute__((subword(4)));
typedef unsigned int s4x8b __attribute__((subword(8)));
typedef unsigned int s2x16b __attribute__((subword(16)));


void getsz_1b(int *so, int *sos)
{
  if (so) *so = sizeof(s32x1b);
  if (sos) *sos = sizeofswar(s32x1b);
}

void getsz_2b(int *so, int *sos)
{
  if (so) *so = sizeof(s16x2b);
  if (sos) *sos = sizeofswar(s16x2b);
}

void getsz_3b(int *so, int *sos)
{
  if (so) *so = sizeof(s10x3b);
  if (sos) *sos = sizeofswar(s10x3b);
}

void getsz_4b(int *so, int *sos)
{
  if (so) *so = sizeof(s8x4b);
  if (sos) *sos = sizeofswar(s8x4b);
}

void getsz_8b(int *so, int *sos)
{
  if (so) *so = sizeof(s4x8b);
  if (sos) *sos = sizeofswar(s4x8b);
}

void getsz_16b(int *so, int *sos)
{
  if (so) *so = sizeof(s2x16b);
  if (sos) *sos = sizeofswar(s2x16b);
}


int main(void)
{
  int s, ss;

  getsz_1b(&s, &ss);

  getsz_2b(&s, &ss);
  
  getsz_3b(&s, &ss);

  getsz_4b(&s, &ss);

  getsz_8b(&s, &ss);

  getsz_16b(&s, &ss);

  return 0;
}