swar-c99-6.4-keywords.c 1.35 KB
/* -----------------------------------------------------------------------------
 *  Copyright (C) 2018-2020 daiteq s.r.o.                http://www.daiteq.com
 *
 *  This program is distributed WITHOUT ANY WARRANTY; without even
 *  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 *  PURPOSE.
 *
 * -----------------------------------------------------------------------------
 *  Filename    : swar-c99-6.4-keywords.c
 *  Authors     : Roman Bartosinski
 *  Description : simple test of clang/LLVM compiler with SWAR extension
 *  Release     :
 *  Version     :
 *  Date        :
 * -----------------------------------------------------------------------------
 */

// try to use keywords: auto, const, extern, register, sizeof, static, struct, union, volatile
// new keyword: sizeofswar

//A: --has-swar
//C: -daiteq-swar-enable

#define SWAR_USE_UNSIGNED_TYPES
#define SWAR_USE_SIGNED_TYPES
#include "swar-c99.h"

int foo(void)
{
  auto su10x3b av3u;
  const su10x3b cv3u;
  extern su10x3b ev3u;
  register su10x3b rv3u;
  static su10x3b sv3u;
  volatile su10x3b vv3u;
  
#if 0
  cv3u = av3u;
#endif
  vv3u = sv3u;
  ev3u = rv3u;
  av3u = ev3u;
  rv3u = vv3u;
  
  return 0;
}

su32x1b var32x1u;
ss32x1b var32x1s;

unsigned int varUInt;
int varInt;

int main(void)
{
  int sz = sizeof(var32x1u);
  int ssz = sizeofswar(var32x1s);

  return sz + ssz;
}