1 ! RUN
: llvm-mc
%s
-arch
=sparc
-show-encoding | FileCheck
%s
2 ! RUN
: llvm-mc
%s
-arch
=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]
167 ! The following tests exercise
'set' in such
a way that its output differs
168 ! depending on whether targeting V8
or V9.
170 ! RUN
: llvm-mc
%s
-arch
=sparc
-show-encoding | FileCheck
%s
--check-prefix
=V8
171 ! RUN
: llvm-mc
%s
-arch
=sparcv9
-show-encoding | FileCheck
%s
--check-prefix
=V9
173 ! V8
: mov
-1, %o1
! encoding
: [0x92,0x10,0x3f,0xff]
174 ! V9
: sethi
%hi
(-1), %o1
! encoding
: [0x13,0b00AAAAAA
,A,A]
175 ! V9
: ! fixup
A - offset
: 0, value
: %hi
(-1), kind
: fixup_sparc_hi22
176 ! V9
: or %o1
, %lo
(-1), %o1
! encoding
: [0x92,0x12,0b011000AA
,A]
177 ! V9
: ! fixup
A - offset
: 0, value
: %lo
(-1), kind
: fixup_sparc_lo10
180 ! V8
: mov
-2, %o1
! encoding
: [0x92,0x10,0x3f,0xfe]
181 ! V9
: sethi
%hi
(-2), %o1
! encoding
: [0x13,0b00AAAAAA
,A,A]
182 ! V9
: ! fixup
A - offset
: 0, value
: %hi
(-2), kind
: fixup_sparc_hi22
183 ! V9
: or %o1
, %lo
(-2), %o1
! encoding
: [0x92,0x12,0b011000AA
,A]
184 ! V9
: ! fixup
A - offset
: 0, value
: %lo
(-2), kind
: fixup_sparc_lo10
187 ! V8
: mov
-16, %o1
! encoding
: [0x92,0x10,0x3f,0xf0]
188 ! V9
: sethi
%hi
(-16), %o1
! encoding
: [0x13,0b00AAAAAA
,A,A]
189 ! V9
: ! fixup
A - offset
: 0, value
: %hi
(-16), kind
: fixup_sparc_hi22
190 ! V9
: or %o1
, %lo
(-16), %o1
! encoding
: [0x92,0x12,0b011000AA
,A]
191 ! V9
: ! fixup
A - offset
: 0, value
: %lo
(-16), kind
: fixup_sparc_lo10
194 ! V8
: mov
-256, %o1
! encoding
: [0x92,0x10,0x3f,0x00]
195 ! V9
: sethi
%hi
(-256), %o1
! encoding
: [0x13,0b00AAAAAA
,A,A]
196 ! V9
: ! fixup
A - offset
: 0, value
: %hi
(-256), kind
: fixup_sparc_hi22
197 ! V9
: or %o1
, %lo
(-256), %o1
! encoding
: [0x92,0x12,0b011000AA
,A]
198 ! V9
: ! fixup
A - offset
: 0, value
: %lo
(-256), kind
: fixup_sparc_lo10
201 ! V8
: mov
-4096, %o1
! encoding
: [0x92,0x10,0x30,0x00]
202 ! V9
: sethi
%hi
(-4096), %o1
! encoding
: [0x13,0b00AAAAAA
,A,A]
203 ! V9
: ! fixup
A - offset
: 0, value
: %hi
(-4096), kind
: fixup_sparc_hi22
206 ! These results are the same for V8
and V9
, so this test could have
207 ! been with the others that weren
't segregated by architecture,
208 ! but logically it belongs here as a boundary case.
209 ! V8: sethi %hi(-8192), %o1 ! encoding: [0x13,0b00AAAAAA,A,A]
210 ! V8: ! fixup A - offset: 0, value: %hi(-8192), kind: fixup_sparc_hi22
211 ! V9: sethi %hi(-8192), %o1 ! encoding: [0x13,0b00AAAAAA,A,A]
212 ! V9: ! fixup A - offset: 0, value: %hi(-8192), kind: fixup_sparc_hi22