1int flia(long a)
2{
3	return __builtin_expect(a, 1);
4}
5
6int flic(void)
7{
8	return __builtin_expect(1L << 32 | 1, 1);
9}
10
11long fila(int a)
12{
13	return __builtin_expect(a, 1);
14}
15
16long filc(void)
17{
18	return __builtin_expect(1L << 32 | 1, 1);
19}
20
21long filu(void)
22{
23	return __builtin_expect(0x80000000U, 1);
24}
25
26long fils(void)
27{
28	return __builtin_expect((int)0x80000000, 1);
29}
30
31void *fptr(void *a)
32{
33	return __builtin_expect(a, a);
34}
35
36/*
37 * check-name: builtin-expect
38 * check-command: test-linearize -m64 -Wno-decl $file
39 * check-assert: sizeof(long) == 8
40 *
41 * check-output-start
42flia:
43.L0:
44	<entry-point>
45	trunc.32    %r2 <- (64) %arg1
46	ret.32      %r2
47
48
49flic:
50.L2:
51	<entry-point>
52	ret.32      $1
53
54
55fila:
56.L4:
57	<entry-point>
58	sext.64     %r6 <- (32) %arg1
59	ret.64      %r6
60
61
62filc:
63.L6:
64	<entry-point>
65	ret.64      $0x100000001
66
67
68filu:
69.L8:
70	<entry-point>
71	ret.64      $0x80000000
72
73
74fils:
75.L10:
76	<entry-point>
77	ret.64      $0xffffffff80000000
78
79
80fptr:
81.L12:
82	<entry-point>
83	ret.64      %arg1
84
85
86 * check-output-end
87 *
88 * check-error-start
89expand/builtin-expect.c:33:33: warning: incorrect type in argument 1 (different base types)
90expand/builtin-expect.c:33:33:    expected long
91expand/builtin-expect.c:33:33:    got void *a
92expand/builtin-expect.c:33:36: warning: incorrect type in argument 2 (different base types)
93expand/builtin-expect.c:33:36:    expected long
94expand/builtin-expect.c:33:36:    got void *a
95expand/builtin-expect.c:33:32: warning: incorrect type in return expression (different base types)
96expand/builtin-expect.c:33:32:    expected void *
97expand/builtin-expect.c:33:32:    got long
98expand/builtin-expect.c:8:42: warning: cast truncates bits from constant value (100000001 becomes 1)
99 * check-error-end
100 */
101