riscv: Optimize compares
[tinycc.git] / conftest.c
blob14babf04cce02deb3475cb8c4a2a62d8291dc604
1 #include <stdio.h>
3 #if defined(_WIN32)
4 #include <fcntl.h>
5 #endif
7 /* Define architecture */
8 #if defined(__i386__) || defined _M_IX86
9 # define TRIPLET_ARCH "i386"
10 #elif defined(__x86_64__) || defined _M_AMD64
11 # define TRIPLET_ARCH "x86_64"
12 #elif defined(__arm__)
13 # define TRIPLET_ARCH "arm"
14 #elif defined(__aarch64__)
15 # define TRIPLET_ARCH "aarch64"
16 #elif defined(__riscv) && defined(__LP64__)
17 # define TRIPLET_ARCH "riscv64"
18 #else
19 # define TRIPLET_ARCH "unknown"
20 #endif
22 /* Define OS */
23 #if defined (__linux__)
24 # define TRIPLET_OS "linux"
25 #elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
26 # define TRIPLET_OS "kfreebsd"
27 #elif defined _WIN32
28 # define TRIPLET_OS "win32"
29 #elif !defined (__GNU__)
30 # define TRIPLET_OS "unknown"
31 #endif
33 /* Define calling convention and ABI */
34 #if defined (__ARM_EABI__)
35 # if defined (__ARM_PCS_VFP)
36 # define TRIPLET_ABI "gnueabihf"
37 # else
38 # define TRIPLET_ABI "gnueabi"
39 # endif
40 #else
41 # define TRIPLET_ABI "gnu"
42 #endif
44 #if defined _WIN32
45 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS
46 #elif defined __GNU__
47 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_ABI
48 #else
49 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS "-" TRIPLET_ABI
50 #endif
52 #if defined(_WIN32)
53 int _CRT_glob = 0;
54 #endif
56 int main(int argc, char *argv[])
58 #if defined(_WIN32)
59 _setmode(_fileno(stdout), _O_BINARY); /* don't translate \n to \r\n */
60 #endif
61 switch(argc == 2 ? argv[1][0] : 0) {
62 case 'b':
64 volatile unsigned foo = 0x01234567;
65 puts(*(unsigned char*)&foo == 0x67 ? "no" : "yes");
66 break;
68 #ifdef __GNUC__
69 case 'm':
70 printf("%d\n", __GNUC_MINOR__);
71 break;
72 case 'v':
73 printf("%d\n", __GNUC__);
74 break;
75 #elif defined __TINYC__
76 case 'v':
77 puts("0");
78 break;
79 case 'm':
80 printf("%d\n", __TINYC__);
81 break;
82 #else
83 case 'm':
84 case 'v':
85 puts("0");
86 break;
87 #endif
88 case 't':
89 puts(TRIPLET);
90 break;
92 default:
93 break;
95 return 0;