xref: /illumos-gate/usr/src/tools/smatch/src/validation/builtin-bswap-constant.c (revision 66582b606a8194f7f3ba5b3a3a6dca5b0d346361)
1 unsigned short bswap16(void);
2 unsigned short bswap16(void)
3 {
4 	return __builtin_bswap16(0x1234);
5 }
6 
7 unsigned int bswap32(void);
8 unsigned int bswap32(void)
9 {
10 	return __builtin_bswap32(0x12345678);
11 }
12 
13 unsigned long long bswap64(void);
14 unsigned long long bswap64(void)
15 {
16 	return __builtin_bswap64(0x123456789abcdef0ULL);
17 }
18 
19 unsigned int half_constant(void);
20 unsigned int half_constant(void)
21 {
22 	int v = 0x12345678;
23 	return __builtin_bswap32(v);
24 }
25 /*
26  * check-name: builtin-bswap-constant
27  * check-command: test-linearize $file
28  *
29  * check-output-ignore
30  * check-output-excludes: __builtin_bswap
31  * check-output-contains:ret.16 *.0x3412
32  * check-output-contains:ret.32 *.0x78563412
33  * check-output-contains:ret.64 *.0xf0debc9a78563412
34  */
35