1 ! RUN
: llvm-mc
%s
-triple
=sparc
-show-encoding | FileCheck
%s
2 ! RUN
: llvm-mc
%s
-triple
=sparcv9
-show-encoding | FileCheck
%s
4 ! Section
A.3 Synthetic Instructions
5 ! CHECK
: cmp %g1
, %g2
! encoding
: [0x80,0xa0,0x40,0x02]
7 ! CHECK
: cmp %g1
, 5 ! encoding
: [0x80,0xa0,0x60,0x05]
10 ! jmp
and call are tested in sparc-ctrl-instructions.
12 ! CHECK
: tst
%g1
! encoding
: [0x80,0x90,0x40,0x00]
15 ! CHECK
: ret
! encoding
: [0x81,0xc7,0xe0,0x08]
17 ! CHECK
: retl
! encoding
: [0x81,0xc3,0xe0,0x08]
20 ! CHECK
: restore
! encoding
: [0x81,0xe8,0x00,0x00]
22 ! CHECK
: save
! encoding
: [0x81,0xe0,0x00,0x00]
25 ! CHECK
: sethi
%hi
(40000), %g1
! encoding
: [0x03,0b00AAAAAA
,A,A]
26 ! CHECK
: ! fixup
A - offset
: 0, value
: %hi
(40000), kind
: fixup_sparc_hi22
27 ! CHECK
: or %g1
, %lo
(40000), %g1
! encoding
: [0x82,0x10,0b011000AA
,A]
28 ! CHECK
: ! fixup
A - offset
: 0, value
: %lo
(40000), kind
: fixup_sparc_lo10
30 ! CHECK
: mov
1, %g1
! encoding
: [0x82,0x10,0x20,0x01]
32 ! CHECK
: sethi
%hi
(32768), %g1
! encoding
: [0x03,0b00AAAAAA
,A,A]
33 ! CHECK
: ! fixup
A - offset
: 0, value
: %hi
(32768), kind
: fixup_sparc_hi22
36 ! Expect
a 'sethi' without an
'or'.
37 ! CHECK
: sethi
%hi
(268431360), %o1
! encoding
: [0x13,0b00AAAAAA
,A,A]
38 ! CHECK
: ! fixup
A - offset
: 0, value
: %hi
(268431360), kind
: fixup_sparc_hi22
41 ! CHECK
: sethi
%hi
(268433408), %o1
! encoding
: [0x13,0b00AAAAAA
,A,A]
42 ! CHECK
: ! fixup
A - offset
: 0, value
: %hi
(268433408), kind
: fixup_sparc_hi22
45 ! This is the boundary case that uses the lowest of the
22 bits in sethi.
46 ! CHECK
: sethi
%hi
(268434432), %o1
! encoding
: [0x13,0b00AAAAAA
,A,A]
47 ! CHECK
: ! fixup
A - offset
: 0, value
: %hi
(268434432), kind
: fixup_sparc_hi22
50 ! Now the synthetic instruction becomes two instructions.
51 ! CHECK
: sethi
%hi
(2147483647), %o1
! encoding
: [0x13,0b00AAAAAA
,A,A]
52 ! CHECK
: ! fixup
A - offset
: 0, value
: %hi
(2147483647), kind
: fixup_sparc_hi22
53 ! CHECK
: or %o1
, %lo
(2147483647), %o1
! encoding
: [0x92,0x12,0b011000AA
,A]
54 ! CHECK
: ! fixup
A - offset
: 0, value
: %lo
(2147483647), kind
: fixup_sparc_lo10
57 ! CHECK
: xnor
%g1
, %g0
, %g2
! encoding
: [0x84,0x38,0x40,0x00]
59 ! CHECK
: xnor
%g1
, %g0
, %g1
! encoding
: [0x82,0x38,0x40,0x00]
62 ! CHECK
: sub %g0
, %g1
, %g2
! encoding
: [0x84,0x20,0x00,0x01]
64 ! CHECK
: sub %g0
, %g1
, %g1
! encoding
: [0x82,0x20,0x00,0x01]
67 ! CHECK
: add %g1
, 1, %g1
! encoding
: [0x82,0x00,0x60,0x01]
69 ! CHECK
: add %g1
, 55, %g1
! encoding
: [0x82,0x00,0x60,0x37]
71 ! CHECK
: addcc
%g1
, 1, %g1
! encoding
: [0x82,0x80,0x60,0x01]
73 ! CHECK
: addcc
%g1
, 55, %g1
! encoding
: [0x82,0x80,0x60,0x37]
76 ! CHECK
: sub %g1
, 1, %g1
! encoding
: [0x82,0x20,0x60,0x01]
78 ! CHECK
: sub %g1
, 55, %g1
! encoding
: [0x82,0x20,0x60,0x37]
80 ! CHECK
: subcc
%g1
, 1, %g1
! encoding
: [0x82,0xa0,0x60,0x01]
82 ! CHECK
: subcc
%g1
, 55, %g1
! encoding
: [0x82,0xa0,0x60,0x37]
85 ! CHECK
: andcc
%g2
, %g1
, %g0
! encoding
: [0x80,0x88,0x80,0x01]
87 ! CHECK
: andcc
%g2
, 4, %g0
! encoding
: [0x80,0x88,0xa0,0x04]
89 ! CHECK
: or %g2
, %g1
, %g2
! encoding
: [0x84,0x10,0x80,0x01]
91 ! CHECK
: or %g2
, 4, %g2
! encoding
: [0x84,0x10,0xa0,0x04]
93 ! CHECK
: andn
%g2
, %g1
, %g2
! encoding
: [0x84,0x28,0x80,0x01]
95 ! CHECK
: andn
%g2
, 4, %g2
! encoding
: [0x84,0x28,0xa0,0x04]
97 ! CHECK
: xor %g2
, %g1
, %g2
! encoding
: [0x84,0x18,0x80,0x01]
99 ! CHECK
: xor %g2
, 4, %g2
! encoding
: [0x84,0x18,0xa0,0x04]
102 ! CHECK
: mov
%g0
, %g1
! encoding
: [0x82,0x10,0x00,0x00]
104 ! CHECK
: stb %g0
, [%g1+
%g2
] ! encoding
: [0xc0,0x28,0x40,0x02]
106 ! CHECK
: sth %g0
, [%g1+
%g2
] ! encoding
: [0xc0,0x30,0x40,0x02]
108 ! CHECK
: st %g0
, [%g1+
%g2
] ! encoding
: [0xc0,0x20,0x40,0x02]
111 ! mov reg_or_imm
,reg tested in sparc-alu-instructions.s
113 ! CHECK
: rd
%y
, %i0
! encoding
: [0xb1,0x40,0x00,0x00]
115 ! CHECK
: rd
%asr1
, %i0
! encoding
: [0xb1,0x40,0x40,0x00]
117 ! CHECK
: rd
%psr
, %i0
! encoding
: [0xb1,0x48,0x00,0x00]
119 ! CHECK
: rd
%wim
, %i0
! encoding
: [0xb1,0x50,0x00,0x00]
121 ! CHECK
: rd
%tbr
, %i0
! encoding
: [0xb1,0x58,0x00,0x00]
124 ! CHECK
: wr
%g0
, %i0
, %y
! encoding
: [0x81,0x80,0x00,0x18]
126 ! CHECK
: wr
%g0
, 5, %y
! encoding
: [0x81,0x80,0x20,0x05]
128 ! CHECK
: wr
%g0
, %i0
, %asr15
! encoding
: [0x9f,0x80,0x00,0x18]
130 ! CHECK
: wr
%g0
, 5, %asr15
! encoding
: [0x9f,0x80,0x20,0x05]
132 ! CHECK
: wr
%g0
, %i0
, %psr
! encoding
: [0x81,0x88,0x00,0x18]
134 ! CHECK
: wr
%g0
, 5, %psr
! encoding
: [0x81,0x88,0x20,0x05]
136 ! CHECK
: wr
%g0
, %i0
, %wim
! encoding
: [0x81,0x90,0x00,0x18]
138 ! CHECK
: wr
%g0
, 5, %wim
! encoding
: [0x81,0x90,0x20,0x05]
140 ! CHECK
: wr
%g0
, %i0
, %tbr
! encoding
: [0x81,0x98,0x00,0x18]
142 ! CHECK
: wr
%g0
, 5, %tbr
! encoding
: [0x81,0x98,0x20,0x05]
146 ! CHECK
: wr
%g0
, %i0
, %y
! encoding
: [0x81,0x80,0x00,0x18]
148 ! CHECK
: wr
%g0
, 5, %y
! encoding
: [0x81,0x80,0x20,0x05]
150 ! CHECK
: wr
%g0
, %i0
, %asr15
! encoding
: [0x9f,0x80,0x00,0x18]
152 ! CHECK
: wr
%g0
, 5, %asr15
! encoding
: [0x9f,0x80,0x20,0x05]
154 ! CHECK
: wr
%g0
, %i0
, %psr
! encoding
: [0x81,0x88,0x00,0x18]
156 ! CHECK
: wr
%g0
, 5, %psr
! encoding
: [0x81,0x88,0x20,0x05]
158 ! CHECK
: wr
%g0
, %i0
, %wim
! encoding
: [0x81,0x90,0x00,0x18]
160 ! CHECK
: wr
%g0
, 5, %wim
! encoding
: [0x81,0x90,0x20,0x05]
162 ! CHECK
: wr
%g0
, %i0
, %tbr
! encoding
: [0x81,0x98,0x00,0x18]
164 ! CHECK
: wr
%g0
, 5, %tbr
! encoding
: [0x81,0x98,0x20,0x05]
166 ! CHECK
: or %g2
, 4, %g2
! encoding
: [0x84,0x10,0xa0,0x04]
169 ! The following tests exercise
'set' in such
a way that its output differs
170 ! depending on whether targeting V8
or V9.
172 ! RUN
: llvm-mc
%s
-triple
=sparc
-show-encoding | FileCheck
%s
--check-prefix
=V8
173 ! RUN
: llvm-mc
%s
-triple
=sparcv9
-show-encoding | FileCheck
%s
--check-prefix
=V9
175 ! V8
: mov
-1, %o1
! encoding
: [0x92,0x10,0x3f,0xff]
176 ! V9
: sethi
%hi
(-1), %o1
! encoding
: [0x13,0b00AAAAAA
,A,A]
177 ! V9
: ! fixup
A - offset
: 0, value
: %hi
(-1), kind
: fixup_sparc_hi22
178 ! V9
: or %o1
, %lo
(-1), %o1
! encoding
: [0x92,0x12,0b011000AA
,A]
179 ! V9
: ! fixup
A - offset
: 0, value
: %lo
(-1), kind
: fixup_sparc_lo10
182 ! V8
: mov
-2, %o1
! encoding
: [0x92,0x10,0x3f,0xfe]
183 ! V9
: sethi
%hi
(-2), %o1
! encoding
: [0x13,0b00AAAAAA
,A,A]
184 ! V9
: ! fixup
A - offset
: 0, value
: %hi
(-2), kind
: fixup_sparc_hi22
185 ! V9
: or %o1
, %lo
(-2), %o1
! encoding
: [0x92,0x12,0b011000AA
,A]
186 ! V9
: ! fixup
A - offset
: 0, value
: %lo
(-2), kind
: fixup_sparc_lo10
189 ! V8
: mov
-16, %o1
! encoding
: [0x92,0x10,0x3f,0xf0]
190 ! V9
: sethi
%hi
(-16), %o1
! encoding
: [0x13,0b00AAAAAA
,A,A]
191 ! V9
: ! fixup
A - offset
: 0, value
: %hi
(-16), kind
: fixup_sparc_hi22
192 ! V9
: or %o1
, %lo
(-16), %o1
! encoding
: [0x92,0x12,0b011000AA
,A]
193 ! V9
: ! fixup
A - offset
: 0, value
: %lo
(-16), kind
: fixup_sparc_lo10
196 ! V8
: mov
-256, %o1
! encoding
: [0x92,0x10,0x3f,0x00]
197 ! V9
: sethi
%hi
(-256), %o1
! encoding
: [0x13,0b00AAAAAA
,A,A]
198 ! V9
: ! fixup
A - offset
: 0, value
: %hi
(-256), kind
: fixup_sparc_hi22
199 ! V9
: or %o1
, %lo
(-256), %o1
! encoding
: [0x92,0x12,0b011000AA
,A]
200 ! V9
: ! fixup
A - offset
: 0, value
: %lo
(-256), kind
: fixup_sparc_lo10
203 ! V8
: mov
-4096, %o1
! encoding
: [0x92,0x10,0x30,0x00]
204 ! V9
: sethi
%hi
(-4096), %o1
! encoding
: [0x13,0b00AAAAAA
,A,A]
205 ! V9
: ! fixup
A - offset
: 0, value
: %hi
(-4096), kind
: fixup_sparc_hi22
208 ! These results are the same for V8
and V9
, so this test could have
209 ! been with the others that weren
't segregated by architecture,
210 ! but logically it belongs here as a boundary case.
211 ! V8: sethi %hi(-8192), %o1 ! encoding: [0x13,0b00AAAAAA,A,A]
212 ! V8: ! fixup A - offset: 0, value: %hi(-8192), kind: fixup_sparc_hi22
213 ! V9: sethi %hi(-8192), %o1 ! encoding: [0x13,0b00AAAAAA,A,A]
214 ! V9: ! fixup A - offset: 0, value: %hi(-8192), kind: fixup_sparc_hi22