#include #include extern "C" { extern unsigned short llvm_bswap_i16(unsigned short x); extern unsigned int llvm_bswap_i32(unsigned int x); extern int32_t llvm_ctlz_i32(int32_t x); extern int64_t llvm_ctlz_i64(int64_t x); extern int32_t llvm_cttz_i32(int32_t x); extern int64_t llvm_cttz_i64(int64_t x); extern int32_t llvm_ctpop_i32(int32_t x); extern int64_t llvm_ctpop_i64(int64_t x); extern int llvm_expect_i32(int x, int y); } int main(void) { unsigned short x = 0xc8ef; printf("%x,%x\n", x & 0xff, x >> 8); x = llvm_bswap_i16(x); printf("%x,%x\n", x & 0xff, x >> 8); unsigned int y = 0xc5de158a; printf("%x,%x,%x,%x\n", y & 0xff, (y >> 8) & 0xff, (y >> 16) & 0xff, (y >> 24) & 0xff); y = llvm_bswap_i32(y); printf("%x,%x,%x,%x\n", y & 0xff, (y >> 8) & 0xff, (y >> 16) & 0xff, (y >> 24) & 0xff); printf("%d,%d\n", (int)llvm_ctlz_i64(((int64_t)1) << 40), llvm_ctlz_i32(1 << 10)); printf("%d,%d\n", (int)llvm_cttz_i64(((int64_t)1) << 40), llvm_cttz_i32(1 << 10)); printf("%d,%d\n", (int)llvm_ctpop_i64((0x3101ULL << 32) | 1), llvm_ctpop_i32(0x3101)); printf("%d\n", (int)llvm_ctpop_i32(-594093059)); printf("%d\n", llvm_expect_i32(x % 27, 3)); int64_t a = 1; a = __builtin_bswap64(a); printf("%lld\n", a); return 0; }