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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// assembly-output: ptx-linker
// revisions: borrow_const_direct borrow_const_match borrow_static_direct borrow_static_match by_value_const_match mixed_match
// compile-flags: --crate-type bin -C opt-level=3
// Each revision compiles one standalone function so the packed rodata layout
// and the AST for const/static borrows are locked down independently.
// aux-build: loop-panic-handler.rs
extern crate loop_panic_handler;
const CONST_A: = ;
const CONST_B: = ;
static STATIC_A: = ;
static STATIC_B: = ;
pub extern "C"
pub extern "C"
pub extern "C"
pub extern "C"
pub extern "C"
pub extern "C"
// CHECK,borrow_const_direct: rodata-count: 1
// CHECK,borrow_const_direct: rodata[0]: byte 17, 1, 2, 3, 4, 5, 6, 7
// CHECK,borrow_const_direct: label borrow_const_direct
// CHECK,borrow_const_direct: lddw r1, rodata[0]
// CHECK,borrow_const_direct: ldxb r0, [r1+0x0]
// CHECK,borrow_const_direct: exit
// CHECK,borrow_const_match: rodata-count: 2
// CHECK,borrow_const_match-DAG: rodata{{\[}}[[CONST_A_OFFSET:[0-9]+]]{{\]}}: byte 17, 1, 2, 3, 4, 5, 6, 7
// CHECK,borrow_const_match-DAG: rodata{{\[}}[[CONST_B_OFFSET:[0-9]+]]{{\]}}: byte 34, 1, 2, 3, 4, 5, 6, 7
// CHECK,borrow_const_match: label borrow_const_match
// CHECK,borrow_const_match: lddw r2, rodata{{\[}}[[CONST_A_OFFSET]]{{\]}}
// CHECK,borrow_const_match: jeq r1, 0x0, +0x2
// CHECK,borrow_const_match: lddw r2, rodata{{\[}}[[CONST_B_OFFSET]]{{\]}}
// CHECK,borrow_const_match: ldxb r0, [r2+0x0]
// CHECK,borrow_const_match: exit
// CHECK,borrow_static_direct: rodata-count: 1
// CHECK,borrow_static_direct: rodata[0]: byte 51, 1, 2, 3, 4, 5, 6, 7
// CHECK,borrow_static_direct: label borrow_static_direct
// CHECK,borrow_static_direct: lddw r1, rodata[0]
// CHECK,borrow_static_direct: ldxb r0, [r1+0x0]
// CHECK,borrow_static_direct: exit
// CHECK,borrow_static_match: rodata-count: 2
// CHECK,borrow_static_match-DAG: rodata{{\[}}[[STATIC_A_OFFSET:[0-9]+]]{{\]}}: byte 51, 1, 2, 3, 4, 5, 6, 7
// CHECK,borrow_static_match-DAG: rodata{{\[}}[[STATIC_B_OFFSET:[0-9]+]]{{\]}}: byte 68, 1, 2, 3, 4, 5, 6, 7
// CHECK,borrow_static_match: label borrow_static_match
// CHECK,borrow_static_match: lddw r2, rodata{{\[}}[[STATIC_A_OFFSET]]{{\]}}
// CHECK,borrow_static_match: jeq r1, 0x0, +0x2
// CHECK,borrow_static_match: lddw r2, rodata{{\[}}[[STATIC_B_OFFSET]]{{\]}}
// CHECK,borrow_static_match: ldxb r0, [r2+0x0]
// CHECK,borrow_static_match: exit
// CHECK,by_value_const_match: rodata-count: 0
// CHECK,by_value_const_match: label by_value_const_match
// CHECK,by_value_const_match: mov64 r2, 0x11
// CHECK,by_value_const_match: jeq r1, 0x0, +0x1
// CHECK,by_value_const_match: mov64 r2, 0x22
// CHECK,by_value_const_match-NOT: lddw
// CHECK,by_value_const_match: stxb [r10-0x1], r2
// CHECK,by_value_const_match: ldxb r0, [r10-0x1]
// CHECK,by_value_const_match: exit
// CHECK,mixed_match: rodata-count: 2
// CHECK,mixed_match-DAG: rodata{{\[}}[[STATIC_A_OFFSET:[0-9]+]]{{\]}}: byte 51, 1, 2, 3, 4, 5, 6, 7
// CHECK,mixed_match-DAG: rodata{{\[}}[[CONST_B_OFFSET:[0-9]+]]{{\]}}: byte 34, 1, 2, 3, 4, 5, 6, 7
// CHECK,mixed_match: label mixed_match
// CHECK,mixed_match: lddw r2, rodata{{\[}}[[STATIC_A_OFFSET]]{{\]}}
// CHECK,mixed_match: jeq r1, 0x0, +0x2
// CHECK,mixed_match: lddw r2, rodata{{\[}}[[CONST_B_OFFSET]]{{\]}}
// CHECK,mixed_match: ldxb r0, [r2+0x0]
// CHECK,mixed_match: exit