|
2 | 2 |
|
3 | 3 | target triple = "x86_64-unknown-linux-gnu" |
4 | 4 |
|
| 5 | +; CHECK-LABEL: func_no_abs_sym |
| 6 | +define i64 @func_no_abs_sym() nounwind { |
| 7 | + ; CHECK: movq $no_abs_sym, %rax |
| 8 | + %1 = ptrtoint ptr @no_abs_sym to i64 |
| 9 | + ret i64 %1 |
| 10 | +} |
| 11 | + |
5 | 12 | ; CHECK-LABEL: func_abs_sym |
6 | 13 | define i64 @func_abs_sym() nounwind { |
7 | 14 | ; CHECK: movabsq $abs_sym, %rax |
8 | 15 | %1 = ptrtoint ptr @abs_sym to i64 |
9 | 16 | ret i64 %1 |
10 | 17 | } |
11 | 18 |
|
12 | | -; CHECK-LABEL: func_no_abs_sym |
13 | | -define i64 @func_no_abs_sym() nounwind { |
14 | | - ; CHECK: movq $no_abs_sym, %rax |
15 | | - %1 = ptrtoint ptr @no_abs_sym to i64 |
| 19 | +; CHECK-LABEL: func_abs_sym_in_range |
| 20 | +define i64 @func_abs_sym_in_range() nounwind { |
| 21 | + ; CHECK: movq $abs_sym_in_range, %rax |
| 22 | + %1 = ptrtoint ptr @abs_sym_in_range to i64 |
| 23 | + ret i64 %1 |
| 24 | +} |
| 25 | + |
| 26 | +; CHECK-LABEL: func_abs_sym_min_out_of_range |
| 27 | +define i64 @func_abs_sym_min_out_of_range() nounwind { |
| 28 | + ; CHECK: movabsq $abs_sym_min_out_of_range, %rax |
| 29 | + %1 = ptrtoint ptr @abs_sym_min_out_of_range to i64 |
| 30 | + ret i64 %1 |
| 31 | +} |
| 32 | + |
| 33 | +; CHECK-LABEL: func_abs_sym_max_out_of_range |
| 34 | +define i64 @func_abs_sym_max_out_of_range() nounwind { |
| 35 | + ; CHECK: movabsq $abs_sym_max_out_of_range, %rax |
| 36 | + %1 = ptrtoint ptr @abs_sym_max_out_of_range to i64 |
16 | 37 | ret i64 %1 |
17 | 38 | } |
18 | 39 |
|
19 | | -@abs_sym = external hidden global [0 x i8], !absolute_symbol !0 |
20 | 40 | @no_abs_sym = external hidden global [0 x i8] |
| 41 | +@abs_sym = external hidden global [0 x i8], !absolute_symbol !0 |
| 42 | +@abs_sym_in_range = external hidden global [0 x i8], !absolute_symbol !1 |
| 43 | +@abs_sym_min_out_of_range = external hidden global [0 x i8], !absolute_symbol !2 |
| 44 | +@abs_sym_max_out_of_range = external hidden global [0 x i8], !absolute_symbol !3 |
21 | 45 |
|
22 | | -!0 = !{i64 -1, i64 -1} |
| 46 | +!0 = !{i64 -1, i64 -1} ;; Full range |
| 47 | +!1 = !{i64 -2147483648, i64 2147483648} ;; Note the upper bound is exclusive. |
| 48 | +!2 = !{i64 -2147483649, i64 2147483648} ;; Min is one below -2^31 |
| 49 | +!3 = !{i64 -2147483648, i64 2147483649} ;; Max is one above 2^31-1 |
0 commit comments