diff options
| author | Michael Matz <matz@suse.de> | 2016-07-13 15:11:40 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2016-12-15 17:47:08 +0100 |
| commit | 8a1a2a60336264a5f96fae4c7f02424c6928b7c3 (patch) | |
| tree | 7c33a20e1ce519db9e5ce35b63817c1875a66b38 /tests | |
| parent | 10e4db45dca082b6e936c5540d9f68156b3a8e79 (diff) | |
| download | tinycc-8a1a2a60336264a5f96fae4c7f02424c6928b7c3.tar.gz tinycc-8a1a2a60336264a5f96fae4c7f02424c6928b7c3.tar.bz2 | |
Implement __builtin_choose_expr
Follows GCC implementation.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/tcctest.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/tcctest.c b/tests/tcctest.c index 57226f7..10033a4 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -2685,6 +2685,9 @@ int constant_p_var; void builtin_test(void) { + short s; + int i; + long long ll; #if GCC_MAJOR >= 3 COMPAT_TYPE(int, int); COMPAT_TYPE(int, unsigned int); @@ -2704,6 +2707,16 @@ void builtin_test(void) printf("res = %d\n", __builtin_constant_p(1 + 2)); printf("res = %d\n", __builtin_constant_p(&constant_p_var)); printf("res = %d\n", __builtin_constant_p(constant_p_var)); + s = 1; + ll = 2; + i = __builtin_choose_expr (1 != 0, ll, s); + printf("bce: %d\n", i); + i = __builtin_choose_expr (1 != 1, ll, s); + printf("bce: %d\n", i); + i = sizeof (__builtin_choose_expr (1, ll, s)); + printf("bce: %d\n", i); + i = sizeof (__builtin_choose_expr (0, ll, s)); + printf("bce: %d\n", i); } #ifndef _WIN32 |
