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