1*1f5207b7SJohn Levon typedef unsigned short __be16;
2*1f5207b7SJohn Levon typedef unsigned short __u16;
3*1f5207b7SJohn Levon typedef unsigned short u16;
4*1f5207b7SJohn Levon #define __force
5*1f5207b7SJohn Levon 
6*1f5207b7SJohn Levon #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
7*1f5207b7SJohn Levon /* the test behaves as though it's always on a little-endian machine */
8*1f5207b7SJohn Levon #define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
9*1f5207b7SJohn Levon #define ___htons(x) __cpu_to_be16(x)
10*1f5207b7SJohn Levon #define htons(x) ___htons(x)
11*1f5207b7SJohn Levon 
12*1f5207b7SJohn Levon #define ETH_P_IPV6 0x86DD
13*1f5207b7SJohn Levon 
14*1f5207b7SJohn Levon static u16 protocol;
15*1f5207b7SJohn Levon 
test(void)16*1f5207b7SJohn Levon static void test(void)
17*1f5207b7SJohn Levon {
18*1f5207b7SJohn Levon 	switch (protocol) {
19*1f5207b7SJohn Levon 	case htons(ETH_P_IPV6):
20*1f5207b7SJohn Levon 		break;
21*1f5207b7SJohn Levon 	}
22*1f5207b7SJohn Levon }
23*1f5207b7SJohn Levon 
24*1f5207b7SJohn Levon /*
25*1f5207b7SJohn Levon  * check-name: constant folding in bswap builtins
26*1f5207b7SJohn Levon  * check-error-start
27*1f5207b7SJohn Levon  * check-error-end
28*1f5207b7SJohn Levon  */
29