blob: 0045ea03d49d5ec3b7d8c52d62b0067fed4f33de [file] [log] [blame]
Daniel Dunbar8fbe78f2009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only %s -verify -pedantic
Daniel Dunbardc2ab172008-10-02 23:30:31 +00002
3// Math stuff
4
5float g0 = __builtin_huge_val();
6double g1 = __builtin_huge_valf();
7long double g2 = __builtin_huge_vall();
8float g3 = __builtin_inf();
9double g4 = __builtin_inff();
10long double g5 = __builtin_infl();
11
12// GCC misc stuff
13
14extern int f();
15
Eli Friedman2b680b42009-04-28 03:13:54 +000016int h0 = __builtin_types_compatible_p(int,float);
Daniel Dunbardc2ab172008-10-02 23:30:31 +000017//int h1 = __builtin_choose_expr(1, 10, f());
18//int h2 = __builtin_expect(0, 0);
Benjamin Kramera801f4a2012-10-06 14:42:22 +000019int h3 = __builtin_bswap16(0x1234) == 0x3412 ? 1 : f();
20int h4 = __builtin_bswap32(0x1234) == 0x34120000 ? 1 : f();
21int h5 = __builtin_bswap64(0x1234) == 0x3412000000000000 ? 1 : f();
Chris Lattnerc4346752008-10-06 05:42:39 +000022
23short somefunc();
24
Anders Carlsson1e495d92008-12-05 05:09:56 +000025short t = __builtin_constant_p(5353) ? 42 : somefunc();
26
Chris Lattnerc4346752008-10-06 05:42:39 +000027