select-constant.mir
4.2 KB
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=x86_64-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=CHECK
--- |
define i8 @const_i8() {
ret i8 2
}
define i16 @const_i16() {
ret i16 3
}
define i32 @const_i32() {
ret i32 4
}
define i32 @const_i32_0() {
ret i32 0
}
define i64 @const_i64() {
ret i64 68719476720
}
define i64 @const_i64_u32() {
ret i64 1879048192
}
define i64 @const_i64_i32() {
ret i64 -1
}
define void @main(i32** %data) {
store i32* null, i32** %data, align 8
ret void
}
...
---
name: const_i8
legalized: true
regBankSelected: true
selected: false
registers:
- { id: 0, class: gpr }
body: |
bb.1 (%ir-block.0):
; CHECK-LABEL: name: const_i8
; CHECK: [[MOV8ri:%[0-9]+]]:gr8 = MOV8ri 2
; CHECK: $al = COPY [[MOV8ri]]
; CHECK: RET 0, implicit $al
%0(s8) = G_CONSTANT i8 2
$al = COPY %0(s8)
RET 0, implicit $al
...
---
name: const_i16
legalized: true
regBankSelected: true
selected: false
registers:
- { id: 0, class: gpr }
body: |
bb.1 (%ir-block.0):
; CHECK-LABEL: name: const_i16
; CHECK: [[MOV16ri:%[0-9]+]]:gr16 = MOV16ri 3
; CHECK: $ax = COPY [[MOV16ri]]
; CHECK: RET 0, implicit $ax
%0(s16) = G_CONSTANT i16 3
$ax = COPY %0(s16)
RET 0, implicit $ax
...
---
name: const_i32
legalized: true
regBankSelected: true
selected: false
registers:
- { id: 0, class: gpr }
body: |
bb.1 (%ir-block.0):
; CHECK-LABEL: name: const_i32
; CHECK: [[MOV32ri:%[0-9]+]]:gr32 = MOV32ri 4
; CHECK: $eax = COPY [[MOV32ri]]
; CHECK: RET 0, implicit $eax
%0(s32) = G_CONSTANT i32 4
$eax = COPY %0(s32)
RET 0, implicit $eax
...
---
name: const_i32_0
legalized: true
regBankSelected: true
registers:
- { id: 0, class: gpr }
body: |
bb.1 (%ir-block.0):
; CHECK-LABEL: name: const_i32_0
; CHECK: [[MOV32r0_:%[0-9]+]]:gr32 = MOV32r0 implicit-def $eflags
; CHECK: $eax = COPY [[MOV32r0_]]
; CHECK: RET 0, implicit $eax
%0(s32) = G_CONSTANT i32 0
$eax = COPY %0(s32)
RET 0, implicit $eax
...
---
name: const_i64
legalized: true
regBankSelected: true
selected: false
registers:
- { id: 0, class: gpr }
body: |
bb.1 (%ir-block.0):
; CHECK-LABEL: name: const_i64
; CHECK: [[MOV64ri:%[0-9]+]]:gr64 = MOV64ri 68719476720
; CHECK: $rax = COPY [[MOV64ri]]
; CHECK: RET 0, implicit $rax
%0(s64) = G_CONSTANT i64 68719476720
$rax = COPY %0(s64)
RET 0, implicit $rax
...
---
name: const_i64_u32
alignment: 16
legalized: true
regBankSelected: true
selected: false
registers:
- { id: 0, class: gpr }
body: |
bb.1 (%ir-block.0):
; CHECK-LABEL: name: const_i64_u32
; CHECK: [[MOV32ri64_:%[0-9]+]]:gr64 = MOV32ri64 1879048192
; CHECK: $rax = COPY [[MOV32ri64_]]
; CHECK: RET 0, implicit $rax
%0(s64) = G_CONSTANT i64 1879048192
$rax = COPY %0(s64)
RET 0, implicit $rax
...
---
name: const_i64_i32
legalized: true
regBankSelected: true
selected: false
registers:
- { id: 0, class: gpr }
body: |
bb.1 (%ir-block.0):
; CHECK-LABEL: name: const_i64_i32
; CHECK: [[MOV64ri32_:%[0-9]+]]:gr64 = MOV64ri32 -1
; CHECK: $rax = COPY [[MOV64ri32_]]
; CHECK: RET 0, implicit $rax
%0(s64) = G_CONSTANT i64 -1
$rax = COPY %0(s64)
RET 0, implicit $rax
...
---
name: main
alignment: 16
legalized: true
regBankSelected: true
registers:
- { id: 0, class: gpr, preferred-register: '' }
- { id: 1, class: gpr, preferred-register: '' }
body: |
bb.1 (%ir-block.0):
liveins: $rdi
; CHECK-LABEL: name: main
; CHECK: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
; CHECK: [[MOV64ri32_:%[0-9]+]]:gr64 = MOV64ri32 0
; CHECK: MOV64mr [[COPY]], 1, $noreg, 0, $noreg, [[MOV64ri32_]] :: (store 8 into %ir.data)
; CHECK: RET 0
%0(p0) = COPY $rdi
%1(p0) = G_CONSTANT i64 0
G_STORE %1(p0), %0(p0) :: (store 8 into %ir.data)
RET 0
...