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