xref: /netbsd-src/external/gpl3/gdb.old/dist/cpu/lm32.cpu (revision 82650ea59673ac1511a0f5b008a97de18ced4707)
1bb16d227Schristos; Lattice Mico32 CPU description.  -*- Scheme -*-
2bb16d227Schristos; Copyright 2008-2013  Free Software Foundation, Inc.
3bb16d227Schristos; Contributed by Jon Beniston <jon@beniston.com>
4bb16d227Schristos;
5bb16d227Schristos; This file is part of the GNU Binutils.
6bb16d227Schristos;
7bb16d227Schristos; This program is free software; you can redistribute it and/or modify
8bb16d227Schristos; it under the terms of the GNU General Public License as published by
9bb16d227Schristos; the Free Software Foundation; either version 3 of the License, or
10bb16d227Schristos; (at your option) any later version.
11bb16d227Schristos;
12bb16d227Schristos; This program is distributed in the hope that it will be useful,
13bb16d227Schristos; but WITHOUT ANY WARRANTY; without even the implied warranty of
14bb16d227Schristos; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15bb16d227Schristos; GNU General Public License for more details.
16bb16d227Schristos;
17bb16d227Schristos; You should have received a copy of the GNU General Public License
18bb16d227Schristos; along with this program; if not, write to the Free Software
19bb16d227Schristos; Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20bb16d227Schristos; MA 02110-1301, USA.
21bb16d227Schristos
22bb16d227Schristos(include "simplify.inc")
23bb16d227Schristos
24bb16d227Schristos(define-arch
25bb16d227Schristos  (name lm32) ; name of cpu family
26bb16d227Schristos  (comment "Lattice Mico32")
27bb16d227Schristos  (default-alignment aligned)
28bb16d227Schristos  (insn-lsb0? #t)
29bb16d227Schristos  (machs lm32)
30bb16d227Schristos  (isas lm32)
31bb16d227Schristos)
32bb16d227Schristos
33bb16d227Schristos
34bb16d227Schristos; Instruction sets.
35bb16d227Schristos
36bb16d227Schristos(define-isa
37bb16d227Schristos  (name lm32)
38bb16d227Schristos  (comment "Lattice Mico32 ISA")
39bb16d227Schristos  (default-insn-word-bitsize 32)
40bb16d227Schristos  (default-insn-bitsize 32)
41bb16d227Schristos  (base-insn-bitsize 32)
42bb16d227Schristos  (decode-assist (31 30 29 28 27 26))
43bb16d227Schristos)
44bb16d227Schristos
45bb16d227Schristos
46bb16d227Schristos; Cpu family definitions.
47bb16d227Schristos
48bb16d227Schristos(define-cpu
49bb16d227Schristos  ; cpu names must be distinct from the architecture name and machine name
50bb16d227Schristos  (name lm32bf)
51bb16d227Schristos  (comment "Lattice Mico32 CPU")
52bb16d227Schristos  (endian big)
53bb16d227Schristos  (word-bitsize 32)
54bb16d227Schristos)
55bb16d227Schristos
56bb16d227Schristos(define-mach
57bb16d227Schristos  (name lm32)
58bb16d227Schristos  (comment "Lattice Mico32 MACH")
59bb16d227Schristos  (cpu lm32bf)
60bb16d227Schristos)
61bb16d227Schristos
62bb16d227Schristos(define-model
63bb16d227Schristos  (name lm32)
64bb16d227Schristos  (comment "Lattice Mico32 reference implementation")
65bb16d227Schristos  (mach lm32)
66bb16d227Schristos  (unit u-exec "Execution unit" ()
67bb16d227Schristos    1 1 () () () ())
68bb16d227Schristos)
69bb16d227Schristos
70bb16d227Schristos
71bb16d227Schristos; Hardware elements.
72bb16d227Schristos
73bb16d227Schristos(dnh h-pc "Program counter" (PC) (pc) () () ())
74bb16d227Schristos
75bb16d227Schristos(dnh h-gr "General purpose registers"
76bb16d227Schristos  ()
77bb16d227Schristos  (register SI (32))
78bb16d227Schristos  (keyword "" (
79bb16d227Schristos               (gp 26) (fp 27) (sp 28) (ra 29) (ea 30) (ba 31)
80bb16d227Schristos               (r0 0) (r1 1) (r2 2) (r3 3)
81bb16d227Schristos               (r4 4) (r5 5) (r6 6) (r7 7)
82bb16d227Schristos               (r8 8) (r9 9) (r10 10) (r11 11)
83bb16d227Schristos               (r12 12) (r13 13) (r14 14) (r15 15)
84bb16d227Schristos               (r16 16) (r17 17) (r18 18) (r19 19)
85bb16d227Schristos               (r20 20) (r21 21) (r22 22) (r23 23)
86bb16d227Schristos               (r24 24) (r25 25) (r26 26) (r27 27)
87bb16d227Schristos               (r28 28) (r29 29) (r30 30) (r31 31)
88bb16d227Schristos              )
89bb16d227Schristos  )
90bb16d227Schristos  () ()
91bb16d227Schristos)
92bb16d227Schristos
93bb16d227Schristos(dnh h-csr "Control and status registers"
94bb16d227Schristos  ()
95bb16d227Schristos  (register SI (32))
96bb16d227Schristos  (keyword "" (
97bb16d227Schristos               (IE 0) (IM 1) (IP 2)
98bb16d227Schristos               (ICC 3) (DCC 4)
99bb16d227Schristos               (CC 5)
100bb16d227Schristos               (CFG 6)
101bb16d227Schristos               (EBA 7)
102bb16d227Schristos               (DC 8)
103bb16d227Schristos               (DEBA 9)
104bb16d227Schristos	       (CFG2 10)
105bb16d227Schristos               (JTX 14) (JRX 15)
106bb16d227Schristos               (BP0 16) (BP1 17) (BP2 18) (BP3 19)
107bb16d227Schristos               (WP0 24) (WP1 25) (WP2 26) (WP3 27)
108bb16d227Schristos               (PSW 29) (TLBVADDR 30) (TLBPADDR 31) (TLBBADVADDR 31)
109bb16d227Schristos              )
110bb16d227Schristos  )
111bb16d227Schristos  () ()
112bb16d227Schristos)
113bb16d227Schristos
114bb16d227Schristos
115bb16d227Schristos; Instruction fields.
116bb16d227Schristos
117bb16d227Schristos(dnf f-opcode   "opcode field"                () 31  6)
118bb16d227Schristos(dnf f-r0       "register index 0 field"      () 25  5)
119bb16d227Schristos(dnf f-r1       "register index 1 field"      () 20  5)
120bb16d227Schristos(dnf f-r2       "register index 2 field"      () 15  5)
121bb16d227Schristos(dnf f-resv0    "reserved"                    (RESERVED) 10 11)
122bb16d227Schristos(dnf f-shift    "shift amount field"          ()  4  5)
123bb16d227Schristos(df  f-imm      "signed immediate field"      () 15 16 INT #f #f)
124bb16d227Schristos(dnf f-uimm     "unsigned immediate field"    () 15 16)
125bb16d227Schristos(dnf f-csr      "csr field"                   () 25  5)
126bb16d227Schristos(dnf f-user     "user defined field"          () 10 11)
127bb16d227Schristos(dnf f-exception "exception field"            () 25 26)
128bb16d227Schristos
129bb16d227Schristos(df f-branch "branch offset field" (PCREL-ADDR) 15 16 INT
130bb16d227Schristos        ((value pc) (sra SI (sub SI value pc) 2))
131*82650ea5Schristos	((value pc) (add SI pc (sub (xor (sll (and value #xffff) 2)
132*82650ea5Schristos					 #x20000)
133*82650ea5Schristos				    #x20000)))
134bb16d227Schristos)
135bb16d227Schristos(df f-call "call offset field" (PCREL-ADDR) 25 26 INT
136bb16d227Schristos        ((value pc) (sra SI (sub SI value pc) 2))
137*82650ea5Schristos	((value pc) (add SI pc (sub (xor (sll (and value #x3ffffff) 2)
138*82650ea5Schristos					 #x8000000)
139*82650ea5Schristos				    #x8000000)))
140bb16d227Schristos)
141bb16d227Schristos
142bb16d227Schristos
143bb16d227Schristos; Operands.
144bb16d227Schristos
145bb16d227Schristos(dnop r0        "register 0"            () h-gr         f-r0)
146bb16d227Schristos(dnop r1        "register 1"            () h-gr         f-r1)
147bb16d227Schristos(dnop r2        "register 2"            () h-gr         f-r2)
148bb16d227Schristos(dnop shift     "shift amout"           () h-uint       f-shift)
149bb16d227Schristos(dnop imm       "signed immediate"      () h-sint       f-imm)
150bb16d227Schristos(dnop uimm      "unsigned immediate"    () h-uint       f-uimm)
151bb16d227Schristos(dnop branch    "branch offset"         () h-iaddr      f-branch)
152bb16d227Schristos(dnop call      "call offset"           () h-iaddr      f-call)
153bb16d227Schristos(dnop csr       "csr"                   () h-csr        f-csr)
154bb16d227Schristos(dnop user      "user"                  () h-uint       f-user)
155bb16d227Schristos(dnop exception "exception"             () h-uint       f-exception)
156bb16d227Schristos
157bb16d227Schristos(define-operand
158bb16d227Schristos  (name hi16)
159bb16d227Schristos  (comment "high 16-bit immediate")
160bb16d227Schristos  (attrs)
161bb16d227Schristos  (type h-uint)
162bb16d227Schristos  (index f-uimm)
163bb16d227Schristos  (handlers (parse "hi16"))
164bb16d227Schristos)
165bb16d227Schristos
166bb16d227Schristos(define-operand
167bb16d227Schristos  (name lo16)
168bb16d227Schristos  (comment "low 16-bit immediate")
169bb16d227Schristos  (attrs)
170bb16d227Schristos  (type h-uint)
171bb16d227Schristos  (index f-uimm)
172bb16d227Schristos  (handlers (parse "lo16"))
173bb16d227Schristos)
174bb16d227Schristos
175bb16d227Schristos(define-operand
176bb16d227Schristos  (name gp16)
177bb16d227Schristos  (comment "gp relative 16-bit immediate")
178bb16d227Schristos  (attrs)
179bb16d227Schristos  (type h-sint)
180bb16d227Schristos  (index f-imm)
181bb16d227Schristos  (handlers (parse "gp16"))
182bb16d227Schristos)
183bb16d227Schristos
184bb16d227Schristos(define-operand
185bb16d227Schristos  (name got16)
186bb16d227Schristos  (comment "got 16-bit immediate")
187bb16d227Schristos  (attrs)
188bb16d227Schristos  (type h-sint)
189bb16d227Schristos  (index f-imm)
190bb16d227Schristos  (handlers (parse "got16"))
191bb16d227Schristos)
192bb16d227Schristos
193bb16d227Schristos(define-operand
194bb16d227Schristos  (name gotoffhi16)
195bb16d227Schristos  (comment "got offset high 16-bit immediate")
196bb16d227Schristos  (attrs)
197bb16d227Schristos  (type h-sint)
198bb16d227Schristos  (index f-imm)
199bb16d227Schristos  (handlers (parse "gotoff_hi16"))
200bb16d227Schristos)
201bb16d227Schristos
202bb16d227Schristos(define-operand
203bb16d227Schristos  (name gotofflo16)
204bb16d227Schristos  (comment "got offset low 16-bit immediate")
205bb16d227Schristos  (attrs)
206bb16d227Schristos  (type h-sint)
207bb16d227Schristos  (index f-imm)
208bb16d227Schristos  (handlers (parse "gotoff_lo16"))
209bb16d227Schristos)
210bb16d227Schristos
211bb16d227Schristos
212bb16d227Schristos; Enumerations.
213bb16d227Schristos
214bb16d227Schristos(define-normal-insn-enum
215bb16d227Schristos  opcodes "opcodes" () OP_ f-opcode
216bb16d227Schristos  (("ADD"       45)
217bb16d227Schristos   ("ADDI"      13)
218bb16d227Schristos   ("AND"       40)
219bb16d227Schristos   ("ANDI"      8)
220bb16d227Schristos   ("ANDHI"     24)
221bb16d227Schristos   ("B"         48)
222bb16d227Schristos   ("BI"        56)
223bb16d227Schristos   ("BE"        17)
224bb16d227Schristos   ("BG"        18)
225bb16d227Schristos   ("BGE"       19)
226bb16d227Schristos   ("BGEU"      20)
227bb16d227Schristos   ("BGU"       21)
228bb16d227Schristos   ("BNE"       23)
229bb16d227Schristos   ("CALL"      54)
230bb16d227Schristos   ("CALLI"     62)
231bb16d227Schristos   ("CMPE"      57)
232bb16d227Schristos   ("CMPEI"     25)
233bb16d227Schristos   ("CMPG"      58)
234bb16d227Schristos   ("CMPGI"     26)
235bb16d227Schristos   ("CMPGE"     59)
236bb16d227Schristos   ("CMPGEI"    27)
237bb16d227Schristos   ("CMPGEU"    60)
238bb16d227Schristos   ("CMPGEUI"   28)
239bb16d227Schristos   ("CMPGU"     61)
240bb16d227Schristos   ("CMPGUI"    29)
241bb16d227Schristos   ("CMPNE"     63)
242bb16d227Schristos   ("CMPNEI"    31)
243bb16d227Schristos   ("DIVU"      35)
244bb16d227Schristos   ("LB"        4)
245bb16d227Schristos   ("LBU"       16)
246bb16d227Schristos   ("LH"        7)
247bb16d227Schristos   ("LHU"       11)
248bb16d227Schristos   ("LW"        10)
249bb16d227Schristos   ("MODU"      49)
250bb16d227Schristos   ("MUL"       34)
251bb16d227Schristos   ("MULI"      2)
252bb16d227Schristos   ("NOR"       33)
253bb16d227Schristos   ("NORI"      1)
254bb16d227Schristos   ("OR"        46)
255bb16d227Schristos   ("ORI"       14)
256bb16d227Schristos   ("ORHI"      30)
257bb16d227Schristos   ("RAISE"     43)
258bb16d227Schristos   ("RCSR"      36)
259bb16d227Schristos   ("SB"        12)
260bb16d227Schristos   ("SEXTB"     44)
261bb16d227Schristos   ("SEXTH"     55)
262bb16d227Schristos   ("SH"        3)
263bb16d227Schristos   ("SL"        47)
264bb16d227Schristos   ("SLI"       15)
265bb16d227Schristos   ("SR"        37)
266bb16d227Schristos   ("SRI"       5)
267bb16d227Schristos   ("SRU"       32)
268bb16d227Schristos   ("SRUI"      0)
269bb16d227Schristos   ("SUB"       50)
270bb16d227Schristos   ("SW"        22)
271bb16d227Schristos   ("USER"      51)
272bb16d227Schristos   ("WCSR"      52)
273bb16d227Schristos   ("XNOR"      41)
274bb16d227Schristos   ("XNORI"     9)
275bb16d227Schristos   ("XOR"       38)
276bb16d227Schristos   ("XORI"      6)
277bb16d227Schristos  )
278bb16d227Schristos)
279bb16d227Schristos
280bb16d227Schristos
281bb16d227Schristos; Instructions. Note: Reg-reg must come before reg-imm.
282bb16d227Schristos
283bb16d227Schristos(dni add "add" ()
284bb16d227Schristos        "add $r2,$r0,$r1"
285bb16d227Schristos        (+ OP_ADD r0 r1 r2 (f-resv0 0))
286bb16d227Schristos        (set r2 (add r0 r1))
287bb16d227Schristos        ()
288bb16d227Schristos)
289bb16d227Schristos
290bb16d227Schristos(dni addi "add immediate" ()
291bb16d227Schristos        "addi $r1,$r0,$imm"
292bb16d227Schristos        (+ OP_ADDI r0 r1 imm)
293bb16d227Schristos        (set r1 (add r0 (ext SI (trunc HI imm))))
294bb16d227Schristos        ()
295bb16d227Schristos)
296bb16d227Schristos
297bb16d227Schristos(dni and "and" ()
298bb16d227Schristos        "and $r2,$r0,$r1"
299bb16d227Schristos        (+ OP_AND r0 r1 r2 (f-resv0 0))
300bb16d227Schristos        (set r2 (and r0 r1))
301bb16d227Schristos        ()
302bb16d227Schristos)
303bb16d227Schristos
304bb16d227Schristos(dni andi "and immediate" ()
305bb16d227Schristos        "andi $r1,$r0,$uimm"
306bb16d227Schristos        (+ OP_ANDI r0 r1 uimm)
307bb16d227Schristos        (set r1 (and r0 (zext SI uimm)))
308bb16d227Schristos        ()
309bb16d227Schristos)
310bb16d227Schristos
311bb16d227Schristos(dni andhii "and high immediate" ()
312bb16d227Schristos        "andhi $r1,$r0,$hi16"
313bb16d227Schristos        (+ OP_ANDHI r0 r1 hi16)
314bb16d227Schristos        (set r1 (and r0 (sll SI hi16 16)))
315bb16d227Schristos        ()
316bb16d227Schristos)
317bb16d227Schristos
318bb16d227Schristos(dni b "branch" ()
319bb16d227Schristos        "b $r0"
320bb16d227Schristos        (+ OP_B r0 (f-r1 0) (f-r2 0) (f-resv0 0))
321bb16d227Schristos        (set pc (c-call USI "@cpu@_b_insn" r0 f-r0))
322bb16d227Schristos        ()
323bb16d227Schristos)
324bb16d227Schristos
325bb16d227Schristos(dni bi "branch immediate" ()
326bb16d227Schristos        "bi $call"
327bb16d227Schristos        (+ OP_BI call)
328bb16d227Schristos        (set pc (ext SI call))
329bb16d227Schristos        ()
330bb16d227Schristos)
331bb16d227Schristos
332bb16d227Schristos(dni be "branch equal" ()
333bb16d227Schristos        "be $r0,$r1,$branch"
334bb16d227Schristos        (+ OP_BE r0 r1 branch)
335bb16d227Schristos        (if (eq r0 r1)
336bb16d227Schristos            (set pc branch)
337bb16d227Schristos        )
338bb16d227Schristos        ()
339bb16d227Schristos)
340bb16d227Schristos
341bb16d227Schristos(dni bg "branch greater" ()
342bb16d227Schristos        "bg $r0,$r1,$branch"
343bb16d227Schristos        (+ OP_BG r0 r1 branch)
344bb16d227Schristos        (if (gt r0 r1)
345bb16d227Schristos            (set pc branch)
346bb16d227Schristos        )
347bb16d227Schristos        ()
348bb16d227Schristos)
349bb16d227Schristos
350bb16d227Schristos(dni bge "branch greater or equal" ()
351bb16d227Schristos        "bge $r0,$r1,$branch"
352bb16d227Schristos        (+ OP_BGE r0 r1 branch)
353bb16d227Schristos        (if (ge r0 r1)
354bb16d227Schristos            (set pc branch)
355bb16d227Schristos        )
356bb16d227Schristos        ()
357bb16d227Schristos)
358bb16d227Schristos
359bb16d227Schristos(dni bgeu "branch greater or equal unsigned" ()
360bb16d227Schristos        "bgeu $r0,$r1,$branch"
361bb16d227Schristos        (+ OP_BGEU r0 r1 branch)
362bb16d227Schristos        (if (geu r0 r1)
363bb16d227Schristos            (set pc branch)
364bb16d227Schristos        )
365bb16d227Schristos        ()
366bb16d227Schristos)
367bb16d227Schristos
368bb16d227Schristos(dni bgu "branch greater unsigned" ()
369bb16d227Schristos        "bgu $r0,$r1,$branch"
370bb16d227Schristos        (+ OP_BGU r0 r1 branch)
371bb16d227Schristos        (if (gtu r0 r1)
372bb16d227Schristos            (set pc branch)
373bb16d227Schristos        )
374bb16d227Schristos        ()
375bb16d227Schristos)
376bb16d227Schristos
377bb16d227Schristos(dni bne "branch not equal" ()
378bb16d227Schristos        "bne $r0,$r1,$branch"
379bb16d227Schristos        (+ OP_BNE r0 r1 branch)
380bb16d227Schristos        (if (ne r0 r1)
381bb16d227Schristos            (set pc branch)
382bb16d227Schristos        )
383bb16d227Schristos        ()
384bb16d227Schristos)
385bb16d227Schristos
386bb16d227Schristos(dni call "call" ()
387bb16d227Schristos        "call $r0"
388bb16d227Schristos        (+ OP_CALL r0 (f-r1 0) (f-r2 0) (f-resv0 0))
389bb16d227Schristos        (sequence ()
390bb16d227Schristos                (set (reg h-gr 29) (add pc 4))
391bb16d227Schristos                (set pc r0)
392bb16d227Schristos        )
393bb16d227Schristos        ()
394bb16d227Schristos)
395bb16d227Schristos
396bb16d227Schristos(dni calli "call immediate" ()
397bb16d227Schristos        "calli $call"
398bb16d227Schristos        (+ OP_CALLI call)
399bb16d227Schristos        (sequence ()
400bb16d227Schristos                (set (reg h-gr 29) (add pc 4))
401bb16d227Schristos                (set pc (ext SI call))
402bb16d227Schristos        )
403bb16d227Schristos        ()
404bb16d227Schristos)
405bb16d227Schristos
406bb16d227Schristos(dni cmpe "compare equal" ()
407bb16d227Schristos        "cmpe $r2,$r0,$r1"
408bb16d227Schristos        (+ OP_CMPE r0 r1 r2 (f-resv0 0))
409bb16d227Schristos        (set r2 (eq SI r0 r1))
410bb16d227Schristos        ()
411bb16d227Schristos)
412bb16d227Schristos
413bb16d227Schristos(dni cmpei "compare equal immediate" ()
414bb16d227Schristos        "cmpei $r1,$r0,$imm"
415bb16d227Schristos        (+ OP_CMPEI r0 r1 imm)
416bb16d227Schristos        (set r1 (eq SI r0 (ext SI (trunc HI imm))))
417bb16d227Schristos        ()
418bb16d227Schristos)
419bb16d227Schristos
420bb16d227Schristos(dni cmpg "compare greater than" ()
421bb16d227Schristos        "cmpg $r2,$r0,$r1"
422bb16d227Schristos        (+ OP_CMPG r0 r1 r2 (f-resv0 0))
423bb16d227Schristos        (set r2 (gt SI r0 r1))
424bb16d227Schristos        ()
425bb16d227Schristos)
426bb16d227Schristos
427bb16d227Schristos(dni cmpgi "compare greater than immediate" ()
428bb16d227Schristos        "cmpgi $r1,$r0,$imm"
429bb16d227Schristos        (+ OP_CMPGI r0 r1 imm)
430bb16d227Schristos        (set r1 (gt SI r0 (ext SI (trunc HI imm))))
431bb16d227Schristos        ()
432bb16d227Schristos)
433bb16d227Schristos
434bb16d227Schristos(dni cmpge "compare greater or equal" ()
435bb16d227Schristos        "cmpge $r2,$r0,$r1"
436bb16d227Schristos        (+ OP_CMPGE r0 r1 r2 (f-resv0 0))
437bb16d227Schristos        (set r2 (ge SI r0 r1))
438bb16d227Schristos        ()
439bb16d227Schristos)
440bb16d227Schristos
441bb16d227Schristos(dni cmpgei "compare greater or equal immediate" ()
442bb16d227Schristos        "cmpgei $r1,$r0,$imm"
443bb16d227Schristos        (+ OP_CMPGEI r0 r1 imm)
444bb16d227Schristos        (set r1 (ge SI r0 (ext SI (trunc HI imm))))
445bb16d227Schristos        ()
446bb16d227Schristos)
447bb16d227Schristos
448bb16d227Schristos(dni cmpgeu "compare greater or equal unsigned" ()
449bb16d227Schristos        "cmpgeu $r2,$r0,$r1"
450bb16d227Schristos        (+ OP_CMPGEU r0 r1 r2 (f-resv0 0))
451bb16d227Schristos        (set r2 (geu SI r0 r1))
452bb16d227Schristos        ()
453bb16d227Schristos)
454bb16d227Schristos
455bb16d227Schristos(dni cmpgeui "compare greater or equal unsigned immediate" ()
456bb16d227Schristos        "cmpgeui $r1,$r0,$uimm"
457bb16d227Schristos        (+ OP_CMPGEUI r0 r1 uimm)
458bb16d227Schristos        (set r1 (geu SI r0 (zext SI uimm)))
459bb16d227Schristos        ()
460bb16d227Schristos)
461bb16d227Schristos
462bb16d227Schristos(dni cmpgu "compare greater than unsigned" ()
463bb16d227Schristos        "cmpgu $r2,$r0,$r1"
464bb16d227Schristos        (+ OP_CMPGU r0 r1 r2 (f-resv0 0))
465bb16d227Schristos        (set r2 (gtu SI r0 r1))
466bb16d227Schristos        ()
467bb16d227Schristos)
468bb16d227Schristos
469bb16d227Schristos(dni cmpgui "compare greater than unsigned immediate" ()
470bb16d227Schristos        "cmpgui $r1,$r0,$uimm"
471bb16d227Schristos        (+ OP_CMPGUI r0 r1 uimm)
472bb16d227Schristos        (set r1 (gtu SI r0 (zext SI uimm)))
473bb16d227Schristos        ()
474bb16d227Schristos)
475bb16d227Schristos
476bb16d227Schristos(dni cmpne "compare not equal" ()
477bb16d227Schristos        "cmpne $r2,$r0,$r1"
478bb16d227Schristos        (+ OP_CMPNE r0 r1 r2 (f-resv0 0))
479bb16d227Schristos        (set r2 (ne SI r0 r1))
480bb16d227Schristos        ()
481bb16d227Schristos)
482bb16d227Schristos
483bb16d227Schristos(dni cmpnei "compare not equal immediate" ()
484bb16d227Schristos        "cmpnei $r1,$r0,$imm"
485bb16d227Schristos        (+ OP_CMPNEI r0 r1 imm)
486bb16d227Schristos        (set r1 (ne SI r0 (ext SI (trunc HI imm))))
487bb16d227Schristos        ()
488bb16d227Schristos)
489bb16d227Schristos
490bb16d227Schristos(dni divu "unsigned divide" ()
491bb16d227Schristos        "divu $r2,$r0,$r1"
492bb16d227Schristos        (+ OP_DIVU r0 r1 r2 (f-resv0 0))
493bb16d227Schristos        (set pc (c-call USI "@cpu@_divu_insn" pc f-r0 f-r1 f-r2))
494bb16d227Schristos        ()
495bb16d227Schristos)
496bb16d227Schristos
497bb16d227Schristos(dni lb "load byte" ()
498bb16d227Schristos        "lb $r1,($r0+$imm)"
499bb16d227Schristos        (+ OP_LB r0 r1 imm)
500bb16d227Schristos        (set r1 (ext SI (mem QI (add r0 (ext SI (trunc HI imm))))))
501bb16d227Schristos        ()
502bb16d227Schristos)
503bb16d227Schristos
504bb16d227Schristos(dni lbu "load byte unsigned" ()
505bb16d227Schristos        "lbu $r1,($r0+$imm)"
506bb16d227Schristos        (+ OP_LBU r0 r1 imm)
507bb16d227Schristos        (set r1 (zext SI (mem QI (add r0 (ext SI (trunc HI imm))))))
508bb16d227Schristos        ()
509bb16d227Schristos)
510bb16d227Schristos
511bb16d227Schristos(dni lh "load halfword" ()
512bb16d227Schristos        "lh $r1,($r0+$imm)"
513bb16d227Schristos        (+ OP_LH r0 r1 imm)
514bb16d227Schristos        (set r1 (ext SI (mem HI (add r0 (ext SI (trunc HI imm))))))
515bb16d227Schristos        ()
516bb16d227Schristos)
517bb16d227Schristos
518bb16d227Schristos(dni lhu "load halfword unsigned" ()
519bb16d227Schristos        "lhu $r1,($r0+$imm)"
520bb16d227Schristos        (+ OP_LHU r0 r1 imm)
521bb16d227Schristos        (set r1 (zext SI (mem HI (add r0 (ext SI (trunc HI imm))))))
522bb16d227Schristos        ()
523bb16d227Schristos)
524bb16d227Schristos
525bb16d227Schristos(dni lw "load word" ()
526bb16d227Schristos        "lw $r1,($r0+$imm)"
527bb16d227Schristos        (+ OP_LW r0 r1 imm)
528bb16d227Schristos        (set r1 (mem SI (add r0 (ext SI (trunc HI imm)))))
529bb16d227Schristos        ()
530bb16d227Schristos)
531bb16d227Schristos
532bb16d227Schristos(dni modu "unsigned modulus" ()
533bb16d227Schristos        "modu $r2,$r0,$r1"
534bb16d227Schristos        (+ OP_MODU r0 r1 r2 (f-resv0 0))
535bb16d227Schristos        (set pc (c-call USI "@cpu@_modu_insn" pc f-r0 f-r1 f-r2))
536bb16d227Schristos        ()
537bb16d227Schristos)
538bb16d227Schristos
539bb16d227Schristos(dni mul "mulitply" ()
540bb16d227Schristos        "mul $r2,$r0,$r1"
541bb16d227Schristos        (+ OP_MUL r0 r1 r2 (f-resv0 0))
542bb16d227Schristos        (set r2 (mul r0 r1))
543bb16d227Schristos        ()
544bb16d227Schristos)
545bb16d227Schristos
546bb16d227Schristos(dni muli "multiply immediate" ()
547bb16d227Schristos        "muli $r1,$r0,$imm"
548bb16d227Schristos        (+ OP_MULI r0 r1 imm)
549bb16d227Schristos        (set r1 (mul r0 (ext SI (trunc HI imm))))
550bb16d227Schristos        ()
551bb16d227Schristos)
552bb16d227Schristos
553bb16d227Schristos(dni nor "nor" ()
554bb16d227Schristos        "nor $r2,$r0,$r1"
555bb16d227Schristos        (+ OP_NOR r0 r1 r2 (f-resv0 0))
556bb16d227Schristos        (set r2 (inv (or r0 r1)))
557bb16d227Schristos        ()
558bb16d227Schristos)
559bb16d227Schristos
560bb16d227Schristos(dni nori "nor immediate" ()
561bb16d227Schristos        "nori $r1,$r0,$uimm"
562bb16d227Schristos        (+ OP_NORI r0 r1 uimm)
563bb16d227Schristos        (set r1 (inv (or r0 (zext SI uimm))))
564bb16d227Schristos        ()
565bb16d227Schristos)
566bb16d227Schristos
567bb16d227Schristos(dni or "or" ()
568bb16d227Schristos        "or $r2,$r0,$r1"
569bb16d227Schristos        (+ OP_OR r0 r1 r2 (f-resv0 0))
570bb16d227Schristos        (set r2 (or r0 r1))
571bb16d227Schristos        ()
572bb16d227Schristos)
573bb16d227Schristos
574bb16d227Schristos(dni ori "or immediate" ()
575bb16d227Schristos        "ori $r1,$r0,$lo16"
576bb16d227Schristos        (+ OP_ORI r0 r1 lo16)
577bb16d227Schristos        (set r1 (or r0 (zext SI lo16)))
578bb16d227Schristos        ()
579bb16d227Schristos)
580bb16d227Schristos
581bb16d227Schristos(dni orhii "or high immediate" ()
582bb16d227Schristos        "orhi $r1,$r0,$hi16"
583bb16d227Schristos        (+ OP_ORHI r0 r1 hi16)
584bb16d227Schristos        (set r1 (or r0 (sll SI hi16 16)))
585bb16d227Schristos        ()
586bb16d227Schristos)
587bb16d227Schristos
588bb16d227Schristos(dni rcsr "read control or status register" ()
589bb16d227Schristos        "rcsr $r2,$csr"
590bb16d227Schristos        (+ OP_RCSR csr (f-r1 0) r2 (f-resv0 0))
591bb16d227Schristos        (set r2 csr)
592bb16d227Schristos        ()
593bb16d227Schristos)
594bb16d227Schristos
595bb16d227Schristos(dni sb "store byte" ()
596bb16d227Schristos        "sb ($r0+$imm),$r1"
597bb16d227Schristos        (+ OP_SB r0 r1 imm)
598bb16d227Schristos        (set (mem QI (add r0 (ext SI (trunc HI imm)))) r1)
599bb16d227Schristos        ()
600bb16d227Schristos)
601bb16d227Schristos
602bb16d227Schristos(dni sextb "sign extend byte" ()
603bb16d227Schristos        "sextb $r2,$r0"
604bb16d227Schristos        (+ OP_SEXTB r0 (f-r1 0) r2 (f-resv0 0))
605bb16d227Schristos        (set r2 (ext SI (trunc QI r0)))
606bb16d227Schristos        ()
607bb16d227Schristos)
608bb16d227Schristos
609bb16d227Schristos(dni sexth "sign extend half-word" ()
610bb16d227Schristos        "sexth $r2,$r0"
611bb16d227Schristos        (+ OP_SEXTH r0 (f-r1 0) r2 (f-resv0 0))
612bb16d227Schristos        (set r2 (ext SI (trunc HI r0)))
613bb16d227Schristos        ()
614bb16d227Schristos)
615bb16d227Schristos
616bb16d227Schristos(dni sh "store halfword" ()
617bb16d227Schristos        "sh ($r0+$imm),$r1"
618bb16d227Schristos        (+ OP_SH r0 r1 imm)
619bb16d227Schristos        (set (mem HI (add r0 (ext SI (trunc HI imm)))) r1)
620bb16d227Schristos        ()
621bb16d227Schristos)
622bb16d227Schristos
623bb16d227Schristos(dni sl "shift left" ()
624bb16d227Schristos        "sl $r2,$r0,$r1"
625bb16d227Schristos        (+ OP_SL r0 r1 r2 (f-resv0 0))
626bb16d227Schristos        (set r2 (sll SI r0 r1))
627bb16d227Schristos        ()
628bb16d227Schristos)
629bb16d227Schristos
630bb16d227Schristos(dni sli "shift left immediate" ()
631bb16d227Schristos        "sli $r1,$r0,$imm"
632bb16d227Schristos        (+ OP_SLI r0 r1 imm)
633bb16d227Schristos        (set r1 (sll SI r0 imm))
634bb16d227Schristos        ()
635bb16d227Schristos)
636bb16d227Schristos
637bb16d227Schristos(dni sr "shift right" ()
638bb16d227Schristos        "sr $r2,$r0,$r1"
639bb16d227Schristos        (+ OP_SR r0 r1 r2 (f-resv0 0))
640bb16d227Schristos        (set r2 (sra SI r0 r1))
641bb16d227Schristos        ()
642bb16d227Schristos)
643bb16d227Schristos
644bb16d227Schristos(dni sri "shift right immediate" ()
645bb16d227Schristos        "sri $r1,$r0,$imm"
646bb16d227Schristos        (+ OP_SRI r0 r1 imm)
647bb16d227Schristos        (set r1 (sra SI r0 imm))
648bb16d227Schristos        ()
649bb16d227Schristos)
650bb16d227Schristos
651bb16d227Schristos(dni sru "shift right unsigned" ()
652bb16d227Schristos        "sru $r2,$r0,$r1"
653bb16d227Schristos        (+ OP_SRU r0 r1 r2 (f-resv0 0))
654bb16d227Schristos        (set r2 (srl SI r0 r1))
655bb16d227Schristos        ()
656bb16d227Schristos)
657bb16d227Schristos
658bb16d227Schristos(dni srui "shift right unsigned immediate" ()
659bb16d227Schristos        "srui $r1,$r0,$imm"
660bb16d227Schristos        (+ OP_SRUI r0 r1 imm)
661bb16d227Schristos        (set r1 (srl SI r0 imm))
662bb16d227Schristos        ()
663bb16d227Schristos)
664bb16d227Schristos
665bb16d227Schristos(dni sub "subtract" ()
666bb16d227Schristos        "sub $r2,$r0,$r1"
667bb16d227Schristos        (+ OP_SUB r0 r1 r2 (f-resv0 0))
668bb16d227Schristos        (set r2 (sub r0 r1))
669bb16d227Schristos        ()
670bb16d227Schristos)
671bb16d227Schristos
672bb16d227Schristos(dni sw "store word" ()
673bb16d227Schristos        "sw ($r0+$imm),$r1"
674bb16d227Schristos        (+ OP_SW r0 r1 imm)
675bb16d227Schristos        (set (mem SI (add r0 (ext SI (trunc HI imm)))) r1)
676bb16d227Schristos        ()
677bb16d227Schristos)
678bb16d227Schristos
679bb16d227Schristos(dni user "user defined instruction" ()
680bb16d227Schristos        "user $r2,$r0,$r1,$user"
681bb16d227Schristos        (+ OP_USER r0 r1 r2 user)
682bb16d227Schristos        (set r2 (c-call SI "@cpu@_user_insn" r0 r1 user))
683bb16d227Schristos        ()
684bb16d227Schristos)
685bb16d227Schristos
686bb16d227Schristos(dni wcsr "write control or status register" ()
687bb16d227Schristos        "wcsr $csr,$r1"
688bb16d227Schristos        (+ OP_WCSR csr r1 (f-r2 0) (f-resv0 0))
689bb16d227Schristos        (c-call VOID "@cpu@_wcsr_insn" f-csr r1)
690bb16d227Schristos        ()
691bb16d227Schristos)
692bb16d227Schristos
693bb16d227Schristos(dni xor "xor" ()
694bb16d227Schristos        "xor $r2,$r0,$r1"
695bb16d227Schristos        (+ OP_XOR r0 r1 r2 (f-resv0 0))
696bb16d227Schristos        (set r2 (xor r0 r1))
697bb16d227Schristos        ()
698bb16d227Schristos)
699bb16d227Schristos
700bb16d227Schristos(dni xori "xor immediate" ()
701bb16d227Schristos        "xori $r1,$r0,$uimm"
702bb16d227Schristos        (+ OP_XORI r0 r1 uimm)
703bb16d227Schristos        (set r1 (xor r0 (zext SI uimm)))
704bb16d227Schristos        ()
705bb16d227Schristos)
706bb16d227Schristos
707bb16d227Schristos(dni xnor "xnor" ()
708bb16d227Schristos        "xnor $r2,$r0,$r1"
709bb16d227Schristos        (+ OP_XNOR r0 r1 r2 (f-resv0 0))
710bb16d227Schristos        (set r2 (inv (xor r0 r1)))
711bb16d227Schristos        ()
712bb16d227Schristos)
713bb16d227Schristos
714bb16d227Schristos(dni xnori "xnor immediate" ()
715bb16d227Schristos        "xnori $r1,$r0,$uimm"
716bb16d227Schristos        (+ OP_XNORI r0 r1 uimm)
717bb16d227Schristos        (set r1 (inv (xor r0 (zext SI uimm))))
718bb16d227Schristos        ()
719bb16d227Schristos)
720bb16d227Schristos
721bb16d227Schristos; Pseudo instructions
722bb16d227Schristos
723bb16d227Schristos(dni break "breakpoint" ()
724bb16d227Schristos        "break"
725bb16d227Schristos        (+ OP_RAISE (f-exception 2))
726bb16d227Schristos        (set pc (c-call USI "@cpu@_break_insn" pc))
727bb16d227Schristos        ()
728bb16d227Schristos)
729bb16d227Schristos
730bb16d227Schristos(dni scall "system call" ()
731bb16d227Schristos        "scall"
732bb16d227Schristos        (+ OP_RAISE (f-exception 7))
733bb16d227Schristos        (set pc (c-call USI "@cpu@_scall_insn" pc))
734bb16d227Schristos        ()
735bb16d227Schristos)
736bb16d227Schristos
737bb16d227Schristos(dni bret "return from breakpoint" (ALIAS)
738bb16d227Schristos        "bret"
739bb16d227Schristos        (+ OP_B (f-r0 31) (f-r1 0) (f-r2 0) (f-resv0 0))
740bb16d227Schristos        (set pc (c-call USI "@cpu@_bret_insn" r0))
741bb16d227Schristos        ()
742bb16d227Schristos)
743bb16d227Schristos
744bb16d227Schristos(dni eret "return from exception" (ALIAS)
745bb16d227Schristos        "eret"
746bb16d227Schristos        (+ OP_B (f-r0 30) (f-r1 0) (f-r2 0) (f-resv0 0))
747bb16d227Schristos        (set pc (c-call USI "@cpu@_eret_insn" r0))
748bb16d227Schristos        ()
749bb16d227Schristos)
750bb16d227Schristos
751bb16d227Schristos(dni ret "return" (ALIAS)
752bb16d227Schristos        "ret"
753bb16d227Schristos        (+ OP_B (f-r0 29) (f-r1 0) (f-r2 0) (f-resv0 0))
754bb16d227Schristos        (set pc r0)
755bb16d227Schristos        ()
756bb16d227Schristos)
757bb16d227Schristos
758bb16d227Schristos(dni mv "move" (ALIAS)
759bb16d227Schristos        "mv $r2,$r0"
760bb16d227Schristos        (+ OP_OR r0 (f-r1 0) r2 (f-resv0 0))
761bb16d227Schristos        (set r2 r0)
762bb16d227Schristos        ()
763bb16d227Schristos)
764bb16d227Schristos
765bb16d227Schristos(dni mvi "move immediate" (ALIAS)
766bb16d227Schristos        "mvi $r1,$imm"
767bb16d227Schristos        (+ OP_ADDI (f-r0 0) r1 imm)
768bb16d227Schristos        (set r1 (add r0 (ext SI (trunc HI imm))))
769bb16d227Schristos        ()
770bb16d227Schristos)
771bb16d227Schristos
772bb16d227Schristos(dni mvui "move unsigned immediate" (ALIAS)
773bb16d227Schristos        "mvu $r1,$lo16"
774bb16d227Schristos        (+ OP_ORI (f-r0 0) r1 lo16)
775bb16d227Schristos        (set r1 (zext SI lo16))
776bb16d227Schristos        ()
777bb16d227Schristos)
778bb16d227Schristos
779bb16d227Schristos(dni mvhi "move high immediate" (ALIAS)
780bb16d227Schristos        "mvhi $r1,$hi16"
781bb16d227Schristos        (+ OP_ORHI (f-r0 0) r1 hi16)
782bb16d227Schristos        (set r1 (or r0 (sll SI hi16 16)))
783bb16d227Schristos        ()
784bb16d227Schristos)
785bb16d227Schristos
786bb16d227Schristos(dni mva "move address" (ALIAS)
787bb16d227Schristos        "mva $r1,$gp16"
788bb16d227Schristos        (+ OP_ADDI (f-r0 26) r1 gp16)
789bb16d227Schristos        (set r1 (add r0 (ext SI (trunc HI gp16))))
790bb16d227Schristos        ()
791bb16d227Schristos)
792bb16d227Schristos
793bb16d227Schristos(dni not "not" (ALIAS)
794bb16d227Schristos        "not $r2,$r0"
795bb16d227Schristos        (+ OP_XNOR r0 (f-r1 0) r2 (f-resv0 0))
796bb16d227Schristos        (set r2 (inv r0))
797bb16d227Schristos        ()
798bb16d227Schristos)
799bb16d227Schristos
800bb16d227Schristos(dni nop "nop" (ALIAS)
801bb16d227Schristos        "nop"
802bb16d227Schristos        (+ OP_ADDI (f-r0 0) (f-r1 0) (f-imm 0))
803bb16d227Schristos        (set r0 r0)
804bb16d227Schristos        ()
805bb16d227Schristos)
806bb16d227Schristos
807bb16d227Schristos(dni lbgprel "load byte gp relative" (ALIAS)
808bb16d227Schristos        "lb $r1,$gp16"
809bb16d227Schristos        (+ OP_LB (f-r0 26) r1 gp16)
810bb16d227Schristos        (set r1 (ext SI (mem QI (add r0 (ext SI (trunc HI gp16))))))
811bb16d227Schristos        ()
812bb16d227Schristos)
813bb16d227Schristos
814bb16d227Schristos(dni lbugprel "load byte unsigned gp relative" (ALIAS)
815bb16d227Schristos        "lbu $r1,$gp16"
816bb16d227Schristos        (+ OP_LBU (f-r0 26) r1 gp16)
817bb16d227Schristos        (set r1 (zext SI (mem QI (add r0 (ext SI (trunc HI gp16))))))
818bb16d227Schristos        ()
819bb16d227Schristos)
820bb16d227Schristos
821bb16d227Schristos(dni lhgprel "load halfword gp relative" (ALIAS)
822bb16d227Schristos        "lh $r1,$gp16"
823bb16d227Schristos        (+ OP_LH (f-r0 26) r1 gp16)
824bb16d227Schristos        (set r1 (ext SI (mem HI (add r0 (ext SI (trunc HI gp16))))))
825bb16d227Schristos        ()
826bb16d227Schristos)
827bb16d227Schristos
828bb16d227Schristos(dni lhugprel "load halfword unsigned gp relative" (ALIAS)
829bb16d227Schristos        "lhu $r1,$gp16"
830bb16d227Schristos        (+ OP_LHU (f-r0 26) r1 gp16)
831bb16d227Schristos        (set r1 (zext SI (mem HI (add r0 (ext SI (trunc HI gp16))))))
832bb16d227Schristos        ()
833bb16d227Schristos)
834bb16d227Schristos
835bb16d227Schristos(dni lwgprel "load word gp relative" (ALIAS)
836bb16d227Schristos        "lw $r1,$gp16"
837bb16d227Schristos        (+ OP_LW (f-r0 26) r1 gp16)
838bb16d227Schristos        (set r1 (mem SI (add r0 (ext SI (trunc HI gp16)))))
839bb16d227Schristos        ()
840bb16d227Schristos)
841bb16d227Schristos
842bb16d227Schristos(dni sbgprel "store byte gp relative" (ALIAS)
843bb16d227Schristos        "sb $gp16,$r1"
844bb16d227Schristos        (+ OP_SB (f-r0 26) r1 gp16)
845bb16d227Schristos        (set (mem QI (add r0 (ext SI (trunc HI gp16)))) r1)
846bb16d227Schristos        ()
847bb16d227Schristos)
848bb16d227Schristos
849bb16d227Schristos(dni shgprel "store halfword gp relative" (ALIAS)
850bb16d227Schristos        "sh $gp16,$r1"
851bb16d227Schristos        (+ OP_SH (f-r0 26) r1 gp16)
852bb16d227Schristos        (set (mem HI (add r0 (ext SI (trunc HI gp16)))) r1)
853bb16d227Schristos        ()
854bb16d227Schristos)
855bb16d227Schristos
856bb16d227Schristos(dni swgprel "store word gp relative" (ALIAS)
857bb16d227Schristos        "sw $gp16,$r1"
858bb16d227Schristos        (+ OP_SW (f-r0 26) r1 gp16)
859bb16d227Schristos        (set (mem SI (add r0 (ext SI (trunc HI gp16)))) r1)
860bb16d227Schristos        ()
861bb16d227Schristos)
862bb16d227Schristos
863bb16d227Schristos(dni lwgotrel "load word got relative" (ALIAS)
864bb16d227Schristos        "lw $r1,(gp+$got16)"
865bb16d227Schristos        (+ OP_LW (f-r0 26) r1 got16)
866bb16d227Schristos        (set r1 (mem SI (add r0 (ext SI (trunc HI got16)))))
867bb16d227Schristos        ()
868bb16d227Schristos)
869bb16d227Schristos
870bb16d227Schristos(dni orhigotoffi "or high got offset immediate" (ALIAS)
871bb16d227Schristos        "orhi $r1,$r0,$gotoffhi16"
872bb16d227Schristos        (+ OP_ORHI r0 r1 gotoffhi16)
873bb16d227Schristos        (set r1 (or r0 (sll SI gotoffhi16 16)))
874bb16d227Schristos        ()
875bb16d227Schristos)
876bb16d227Schristos
877bb16d227Schristos(dni addgotoff "add got offset" (ALIAS)
878bb16d227Schristos        "addi $r1,$r0,$gotofflo16"
879bb16d227Schristos        (+ OP_ADDI r0 r1 gotofflo16)
880bb16d227Schristos        (set r1 (add r0 (ext SI (trunc HI gotofflo16))))
881bb16d227Schristos        ()
882bb16d227Schristos)
883bb16d227Schristos
884bb16d227Schristos(dni swgotoff "store word got offset" (ALIAS)
885bb16d227Schristos        "sw ($r0+$gotofflo16),$r1"
886bb16d227Schristos        (+ OP_SW r0 r1 gotofflo16)
887bb16d227Schristos        (set (mem SI (add r0 (ext SI (trunc HI gotofflo16)))) r1)
888bb16d227Schristos        ()
889bb16d227Schristos)
890bb16d227Schristos
891bb16d227Schristos(dni lwgotoff "load word got offset" (ALIAS)
892bb16d227Schristos        "lw $r1,($r0+$gotofflo16)"
893bb16d227Schristos        (+ OP_LW r0 r1 gotofflo16)
894bb16d227Schristos        (set r1 (mem SI (add r0 (ext SI (trunc HI gotofflo16)))))
895bb16d227Schristos        ()
896bb16d227Schristos)
897bb16d227Schristos
898bb16d227Schristos(dni shgotoff "store half word got offset" (ALIAS)
899bb16d227Schristos        "sh ($r0+$gotofflo16),$r1"
900bb16d227Schristos        (+ OP_SH r0 r1 gotofflo16)
901bb16d227Schristos        (set (mem HI (add r0 (ext SI (trunc HI gotofflo16)))) r1)
902bb16d227Schristos        ()
903bb16d227Schristos)
904bb16d227Schristos
905bb16d227Schristos(dni lhgotoff "load half word got offset" (ALIAS)
906bb16d227Schristos        "lh $r1,($r0+$gotofflo16)"
907bb16d227Schristos        (+ OP_LH r0 r1 gotofflo16)
908bb16d227Schristos        (set r1 (ext SI (mem HI (add r0 (ext SI (trunc HI gotofflo16))))))
909bb16d227Schristos        ()
910bb16d227Schristos)
911bb16d227Schristos
912bb16d227Schristos(dni lhugotoff "load half word got offset unsigned" (ALIAS)
913bb16d227Schristos        "lhu $r1,($r0+$gotofflo16)"
914bb16d227Schristos        (+ OP_LHU r0 r1 gotofflo16)
915bb16d227Schristos        (set r1 (zext SI (mem HI (add r0 (ext SI (trunc HI gotofflo16))))))
916bb16d227Schristos        ()
917bb16d227Schristos)
918bb16d227Schristos
919bb16d227Schristos(dni sbgotoff "store byte got offset" (ALIAS)
920bb16d227Schristos        "sb ($r0+$gotofflo16),$r1"
921bb16d227Schristos        (+ OP_SB r0 r1 gotofflo16)
922bb16d227Schristos        (set (mem QI (add r0 (ext SI (trunc HI gotofflo16)))) r1)
923bb16d227Schristos        ()
924bb16d227Schristos)
925bb16d227Schristos
926bb16d227Schristos(dni lbgotoff "load byte got offset" (ALIAS)
927bb16d227Schristos        "lb $r1,($r0+$gotofflo16)"
928bb16d227Schristos        (+ OP_LB r0 r1 gotofflo16)
929bb16d227Schristos        (set r1 (ext SI (mem QI (add r0 (ext SI (trunc HI gotofflo16))))))
930bb16d227Schristos        ()
931bb16d227Schristos)
932bb16d227Schristos
933bb16d227Schristos(dni lbugotoff "load byte got offset unsigned" (ALIAS)
934bb16d227Schristos        "lbu $r1,($r0+$gotofflo16)"
935bb16d227Schristos        (+ OP_LBU r0 r1 gotofflo16)
936bb16d227Schristos        (set r1 (zext SI (mem QI (add r0 (ext SI (trunc HI gotofflo16))))))
937bb16d227Schristos        ()
938bb16d227Schristos)
939