OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [config/] [or32/] [or32.md] - Blame information for rev 399

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 282 jeremybenn
;; Machine description for GNU compiler, OpenRISC 1000 family, OR32 ISA
2
;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
3
;; 2009, 2010 Free Software Foundation, Inc.
4 399 jeremybenn
;; Copyright (C) 2010 Embecosm Limited
5 282 jeremybenn
 
6
;; Contributed by Damjan Lampret  in 1999.
7
;; Major optimizations by Matjaz Breskvar  in 2005.
8
;; Floating point additions by Jungsook Yang 
9
;;                             Julius Baxter  in 2010
10 399 jeremybenn
;; Updated for GCC 4.5 by Jeremy Bennett 
11
;; and Joern Rennecke  in 2010
12 282 jeremybenn
 
13
;; This file is part of GNU CC.
14
 
15
;; This program is free software; you can redistribute it and/or modify it
16
;; under the terms of the GNU General Public License as published by the Free
17
;; Software Foundation; either version 3 of the License, or (at your option)
18
;; any later version.
19
;;
20
;; This program is distributed in the hope that it will be useful, but WITHOUT
21
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
23
;; more details.
24
;;
25
;; You should have received a copy of the GNU General Public License along
26
;; with this program.  If not, see . */
27
 
28 399 jeremybenn
(define_constants [
29
  (CC_REG 34)
30
 
31
  ;; unspec_volatile values
32
  (UNSPECV_SIBCALL_EPILOGUE 0)
33
])
34
 
35 282 jeremybenn
(include "predicates.md")
36
 
37 399 jeremybenn
(include "constraints.md")
38
 
39 282 jeremybenn
(define_attr "type"
40 399 jeremybenn
  "unknown,load,store,move,extend,logic,add,mul,shift,compare,branch,jump,fp,jump_restore"
41 282 jeremybenn
  (const_string "unknown"))
42
 
43
;; Number of machine instructions required to implement an insn.
44
(define_attr "length" "" (const_int 1))
45
 
46
;; Single delay slot after branch or jump instructions, wich may contain any
47
;; instruction but another branch or jump.
48
(define_delay (eq_attr "type" "branch,jump")
49
               [(and (eq_attr "type" "!branch,jump")
50
                     (eq_attr "length" "1")) (nil) (nil)])
51
 
52
;; ALU is modelled as a single functional unit, which is reserved for varying
53
;; numbers of slots.
54
;;
55
;; I think this is all incorrect for the OR1K. The latency says when the
56
;; result will be ready, not how long the pipeline takes to execute.
57
(define_cpu_unit "or32_alu")
58
(define_insn_reservation "bit_unit" 3 (eq_attr "type" "shift") "or32_alu")
59
(define_insn_reservation "lsu_load" 3 (eq_attr "type" "load") "or32_alu*3")
60
(define_insn_reservation "lsu_store" 2 (eq_attr "type" "store") "or32_alu")
61
(define_insn_reservation "alu_unit" 2
62
                         (eq_attr "type" "add,logic,extend,move,compare")
63
                         "or32_alu")
64
(define_insn_reservation "mul_unit" 16 (eq_attr "type" "mul") "or32_alu*16")
65
 
66
 
67
;; Called after register allocation to add any instructions needed for the
68
;; prologue.  Using a prologue insn is favored compared to putting all of the
69
;; instructions in output_function_prologue(), since it allows the scheduler
70
;; to intermix instructions with the saves of the caller saved registers.  In
71
;; some cases, it might be necessary to emit a barrier instruction as the last
72
;; insn to prevent such scheduling.
73
 
74
(define_expand "prologue"
75
  [(use (const_int 1))]
76 399 jeremybenn
  "TARGET_SCHED_LOGUE"
77 282 jeremybenn
{
78
  or32_expand_prologue ();
79
  DONE;
80
})
81
 
82
;; Called after register allocation to add any instructions needed for the
83
;; epilogue.  Using an epilogue insn is favored compared to putting all of the
84
;; instructions in output_function_epilogue(), since it allows the scheduler
85
;; to intermix instructions with the restores of the caller saved registers.
86
;; In some cases, it might be necessary to emit a barrier instruction as the
87
;; first insn to prevent such scheduling.
88
(define_expand "epilogue"
89
  [(use (const_int 2))]
90 399 jeremybenn
  "TARGET_SCHED_LOGUE"
91 282 jeremybenn
{
92 399 jeremybenn
  or32_expand_epilogue (NULL_RTX);
93 282 jeremybenn
  DONE;
94
})
95
 
96 399 jeremybenn
(define_insn_and_split "sibcall_epilogue"
97
  [(unspec_volatile [(const_int 2)] UNSPECV_SIBCALL_EPILOGUE)]
98
  "TARGET_SCHED_LOGUE"
99
  "#"
100
  ""
101
  [(pc)]
102 282 jeremybenn
{
103 399 jeremybenn
  or32_expand_epilogue (curr_insn);
104 282 jeremybenn
  DONE;
105
})
106
 
107
(define_insn "return_internal"
108
  [(return)
109
   (use (match_operand 0 "pmode_register_operand" ""))]
110 399 jeremybenn
  "TARGET_SCHED_LOGUE"
111 282 jeremybenn
  "l.jr    \t%0%("
112
  [(set_attr "type" "jump")
113
   (set_attr "length" "1")])
114
 
115
;;
116
;; Sibcalls
117
;;
118
 
119
(define_expand "sibcall"
120
  [(parallel [(call (match_operand 0 "" "")
121
                    (match_operand 1 "" ""))
122
              (use (match_operand 2 "" ""))     ;; next_arg_reg
123
              (use (match_operand 3 "" ""))])]  ;; struct_value_size_rtx
124 399 jeremybenn
  ""
125 282 jeremybenn
  "
126
{
127
  or32_expand_sibcall (0, XEXP (operands[0], 0), operands[1]);
128
  DONE;
129
}")
130
 
131
(define_expand "sibcall_value"
132
  [(set (match_operand 0 "" "")
133
                   (call (match_operand:SI 1 "" "")
134
                         (match_operand 2 "" "")))]
135 399 jeremybenn
  ""
136 282 jeremybenn
  "
137
{
138
  or32_expand_sibcall (operands[0], XEXP (operands[1], 0), operands[2]);
139
  DONE;
140
}")
141
 
142
(define_insn "sibcall_internal"
143 399 jeremybenn
  [(call (mem:SI (match_operand:SI 0 "sibcall_insn_operand" "s,Rsc,r"))
144 282 jeremybenn
         (match_operand 1 "" ""))
145
   (use (reg:SI 9))]
146 399 jeremybenn
  ""
147 282 jeremybenn
  "@
148 399 jeremybenn
   l.j\t%S0%(\t# sibcall s
149
   l.jr\t%0%(\t# sibcall Rsc
150
   l.jr\t%0\t\t# sibcall r%J0"
151
  [(set_attr "type" "jump,jump,jump_restore")])
152 282 jeremybenn
 
153
 
154
 
155
;;
156
;; movQI
157
;;
158
 
159
(define_expand "movqi"
160
  [(set (match_operand:QI 0 "general_operand" "")
161
        (match_operand:QI 1 "general_operand" ""))]
162
  ""
163
  "
164
      if (can_create_pseudo_p())
165
        {
166
          if (GET_CODE (operands[1]) == CONST_INT)
167
            {
168
              rtx reg = gen_reg_rtx (SImode);
169
 
170
              emit_insn (gen_movsi (reg, operands[1]));
171
              operands[1] = gen_lowpart (QImode, reg);
172
            }
173
          if (GET_CODE (operands[1]) == MEM && optimize > 0)
174
            {
175
              rtx reg = gen_reg_rtx (SImode);
176
 
177
              emit_insn (gen_rtx_SET (SImode, reg,
178
                                  gen_rtx_ZERO_EXTEND (SImode,
179
                                                       operands[1])));
180
 
181
              operands[1] = gen_lowpart (QImode, reg);
182
            }
183
          if (GET_CODE (operands[0]) != REG)
184
            operands[1] = force_reg (QImode, operands[1]);
185
        }
186
")
187
 
188
(define_insn "*movqi_internal"
189
  [(set (match_operand:QI 0 "nonimmediate_operand" "=m,r,r,r,r")
190
        (match_operand:QI 1 "general_operand"       "r,r,I,K,m"))]
191
  ""
192
  "@
193
   l.sb    \t%0,%1\t    # movqi
194
   l.ori   \t%0,%1,0\t  # movqi: move reg to reg
195
   l.addi  \t%0,r0,%1\t # movqi: move immediate
196
   l.ori   \t%0,r0,%1\t # movqi: move immediate
197
   l.lbz   \t%0,%1\t    # movqi"
198
  [(set_attr "type" "store,add,add,logic,load")])
199
 
200
 
201
;;
202
;; movHI
203
;;
204
 
205
(define_expand "movhi"
206
  [(set (match_operand:HI 0 "general_operand" "")
207
        (match_operand:HI 1 "general_operand" ""))]
208
  ""
209
  "
210
      if (can_create_pseudo_p())
211
        {
212
          if (GET_CODE (operands[1]) == CONST_INT)
213
            {
214
              rtx reg = gen_reg_rtx (SImode);
215
 
216
              emit_insn (gen_movsi (reg, operands[1]));
217
              operands[1] = gen_lowpart (HImode, reg);
218
            }
219
          if (GET_CODE (operands[1]) == MEM && optimize > 0)
220
            {
221
              rtx reg = gen_reg_rtx (SImode);
222
 
223
              emit_insn (gen_rtx_SET (SImode, reg,
224
                                      gen_rtx_ZERO_EXTEND (SImode,
225
                                                           operands[1])));
226
              operands[1] = gen_lowpart (HImode, reg);
227
            }
228
          if (GET_CODE (operands[0]) != REG)
229
            operands[1] = force_reg (HImode, operands[1]);
230
        }
231
")
232
 
233
(define_insn "*movhi_internal"
234
  [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r,r,r,r")
235
        (match_operand:HI 1 "general_operand"       "r,r,I,K,m"))]
236
  ""
237
  "@
238
   l.sh    \t%0,%1\t # movhi
239
   l.ori   \t%0,%1,0\t # movhi: move reg to reg
240
   l.addi  \t%0,r0,%1\t # movhi: move immediate
241
   l.ori   \t%0,r0,%1\t # movhi: move immediate
242
   l.lhz   \t%0,%1\t # movhi"
243
  [(set_attr "type" "store,add,add,logic,load")])
244
 
245
(define_expand "movsi"
246
  [(set (match_operand:SI 0 "general_operand" "")
247
        (match_operand:SI 1 "general_operand" ""))]
248
  ""
249
{
250
  /* Working with CONST_INTs is easier, so convert
251
     a double if needed.  */
252
 
253
     if (GET_CODE (operands[1]) == CONST_DOUBLE) {
254
           operands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
255
  }
256
 
257
  /* Handle sets of MEM first.  */
258
  if (GET_CODE (operands[0]) == MEM)
259
  {
260
   if (register_operand(operands[1], SImode)
261
                       || (operands[1] == const0_rtx))
262
        goto movsi_is_ok;
263
 
264
      if (! reload_in_progress)
265
        {
266
          operands[0] = validize_mem (operands[0]);
267
          operands[1] = force_reg (SImode, operands[1]);
268
        }
269
    }
270
 
271
  /* This makes sure we will not get rematched due to splittage.  */
272
  if (! CONSTANT_P (operands[1]) || input_operand (operands[1], SImode))
273
    ;
274
  else if (CONSTANT_P (operands[1])
275
           && GET_CODE (operands[1]) != HIGH
276
           && GET_CODE (operands[1]) != LO_SUM)
277
    {
278
      or32_emit_set_const32 (operands[0], operands[1]);
279
      DONE;
280
    }
281
 movsi_is_ok:
282
  ;
283
})
284
 
285
;;
286
;; movSI
287
;;
288
 
289
(define_insn "*movsi_insn"
290
  [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m")
291
        (match_operand:SI 1 "input_operand"       "I,K,M,r,m,r"))]
292
  "(register_operand (operands[0], SImode)
293
    || register_operand (operands[1], SImode)
294
    || (operands[1] == const0_rtx))"
295
  "@
296
   l.addi  \t%0,r0,%1\t # move immediate I
297
   l.ori   \t%0,r0,%1\t # move immediate K
298
   l.movhi \t%0,hi(%1)\t # move immediate M
299
   l.ori   \t%0,%1,0\t # move reg to reg
300
   l.lwz   \t%0,%1\t # SI load
301
   l.sw    \t%0,%1\t # SI store"
302
  [(set_attr "type" "add,load,store,add,logic,move")
303
   (set_attr "length" "1,1,1,1,1,1")])
304
 
305 399 jeremybenn
(define_insn "movsi_lo_sum"
306 282 jeremybenn
  [(set (match_operand:SI 0 "register_operand" "=r")
307
        (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
308
                   (match_operand:SI 2 "immediate_operand" "i")))]
309
  ""
310
  "l.ori   \t%0,%1,lo(%2)"
311
 [(set_attr "type" "logic")
312
   (set_attr "length" "1")])
313
 
314 399 jeremybenn
(define_insn "movsi_high"
315 282 jeremybenn
  [(set (match_operand:SI 0 "register_operand" "=r")
316
        (high:SI (match_operand:SI 1 "immediate_operand" "i")))]
317
  ""
318
  "l.movhi  \t%0,hi(%1)"
319
[(set_attr "type" "move")
320
   (set_attr "length" "1")])
321
 
322 399 jeremybenn
(define_insn_and_split "movsi_insn_big"
323
  [(set (match_operand:SI 0 "register_operand" "=r")
324 282 jeremybenn
        (match_operand:SI 1 "immediate_operand" "i"))]
325 399 jeremybenn
  "GET_CODE (operands[1]) != CONST_INT"
326 282 jeremybenn
  "l.movhi \t%0,hi(%1)\;l.ori   \t%0,%0,lo(%1)"
327 399 jeremybenn
  ;; the switch of or32 bfd to Rela allows us to schedule insns separately.
328
  "&& reload_completed
329
   && GET_CODE (operands[1]) != HIGH && GET_CODE (operands[1]) != LO_SUM"
330
  [(pc)]
331
{
332
  emit_insn (gen_movsi_high (operands[0], operands[1]));
333
  emit_insn (gen_movsi_lo_sum (operands[0], operands[0], operands[1]));
334
  DONE;
335
}
336 282 jeremybenn
  [(set_attr "type" "move")
337
   (set_attr "length" "2")])
338
 
339
 
340
;;
341
;; Conditional Branches & Moves
342
;;
343
 
344
(define_expand "addsicc"
345
  [(match_operand:SI 0 "register_operand" "")
346
   (match_operand 1 "comparison_operator" "")
347
   (match_operand:SI 2 "register_operand" "")
348
   (match_operand:SI 3 "register_operand" "")]
349
  ""
350
  "FAIL;")
351
 
352
(define_expand "addhicc"
353
  [(match_operand:HI 0 "register_operand" "")
354
   (match_operand 1 "comparison_operator" "")
355
   (match_operand:HI 2 "register_operand" "")
356
   (match_operand:HI 3 "register_operand" "")]
357
  ""
358
  "FAIL;")
359
 
360
(define_expand "addqicc"
361
  [(match_operand:QI 0 "register_operand" "")
362
   (match_operand 1 "comparison_operator" "")
363
   (match_operand:QI 2 "register_operand" "")
364
   (match_operand:QI 3 "register_operand" "")]
365
  ""
366
  "FAIL;")
367
 
368
 
369
;;
370
;; conditional moves
371
;;
372
 
373
(define_expand "movsicc"
374
   [(set (match_operand:SI 0 "register_operand" "")
375
         (if_then_else:SI (match_operand 1 "comparison_operator" "")
376
                          (match_operand:SI 2 "register_operand" "")
377
                          (match_operand:SI 3 "register_operand" "")))]
378
  "TARGET_MASK_CMOV"
379
  "
380
{
381
  if (or32_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
382
    DONE;
383
}")
384
 
385
(define_expand "movhicc"
386
   [(set (match_operand:HI 0 "register_operand" "")
387
         (if_then_else:SI (match_operand 1 "comparison_operator" "")
388
                          (match_operand:HI 2 "register_operand" "")
389
                          (match_operand:HI 3 "register_operand" "")))]
390
  ""
391
  "
392
{
393
    FAIL;
394
}")
395
 
396
(define_expand "movqicc"
397
   [(set (match_operand:QI 0 "register_operand" "")
398
         (if_then_else:SI (match_operand 1 "comparison_operator" "")
399
                          (match_operand:QI 2 "register_operand" "")
400
                          (match_operand:QI 3 "register_operand" "")))]
401
  ""
402
  "
403
{
404
    FAIL;
405
}")
406
 
407
 
408
;; We use the BASE_REGS for the cmov input operands because, if rA is
409
;; 0, the value of 0 is placed in rD upon truth.  Similarly for rB
410
;; because we may switch the operands and rB may end up being rA.
411
 
412
(define_insn "cmov"
413
  [(set (match_operand:SI 0 "register_operand" "=r")
414
        (if_then_else:SI
415
         (match_operator 1 "comparison_operator"
416
                         [(match_operand 4 "cc_reg_operand" "")
417
                          (const_int 0)])
418
         (match_operand:SI 2 "register_operand" "r")
419
         (match_operand:SI 3 "register_operand" "r")))]
420
  "TARGET_MASK_CMOV"
421
  "*
422
   return or32_output_cmov(operands);
423
  ")
424
 
425
;;
426
;;  ....................
427
;;
428
;;      COMPARISONS
429
;;
430
;;  ....................
431
 
432
;; Flow here is rather complex:
433
;;
434
;;  1)  The cmp{si,di,sf,df} routine is called.  It deposits the
435
;;      arguments into the branch_cmp array, and the type into
436
;;      branch_type.  No RTL is generated.
437
;;
438
;;  2)  The appropriate branch define_expand is called, which then
439
;;      creates the appropriate RTL for the comparison and branch.
440
;;      Different CC modes are used, based on what type of branch is
441
;;      done, so that we can constrain things appropriately.  There
442
;;      are assumptions in the rest of GCC that break if we fold the
443
;;      operands into the branches for integer operations, and use cc0
444
;;      for floating point, so we use the fp status register instead.
445
;;      If needed, an appropriate temporary is created to hold the
446
;;      of the integer compare.
447
 
448
;; Compare insns are next.  Note that the RS/6000 has two types of compares,
449
;; signed & unsigned, and one type of branch.
450
;;
451
;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
452
;; insns, and branches.  We store the operands of compares until we see
453
;; how it is used.
454
 
455
;; JPB 31-Aug-10: cmpxx appears to be obsolete in GCC 4.5. Needs more
456
;; investigation.
457
 
458
;;(define_expand "cmpsi"
459 399 jeremybenn
;;  [(set (reg:CC CC_REG)
460 282 jeremybenn
;;      (compare:CC (match_operand:SI 0 "register_operand" "")
461
;;                  (match_operand:SI 1 "nonmemory_operand" "")))]
462
;;  ""
463
;;  {
464
;;   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
465
;;      operands[0] = force_reg (SImode, operands[0]);
466
;;      or32_compare_op0 = operands[0];
467
;;     or32_compare_op1 = operands[1];
468
;;      DONE;
469
;;      })
470
 
471
;; (define_expand "cmpsf"
472 399 jeremybenn
;;   [(set (reg:CC CC_REG)
473 282 jeremybenn
;;      (compare:CC (match_operand:SF 0 "register_operand" "")
474
;;                  (match_operand:SF 1 "register_operand" "")))]
475
;;   "TARGET_HARD_FLOAT"
476
;;   {
477
;;    if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
478
;;       operands[0] = force_reg (SFmode, operands[0]);
479
;;       or32_compare_op0 = operands[0];
480
;;       or32_compare_op1 = operands[1];
481
;;       DONE;
482
;;       })
483
 
484
(define_expand "cbranchsi4"
485
  [(match_operator 0 "comparison_operator"
486
    [(match_operand:SI 1 "register_operand")
487
     (match_operand:SI 2 "nonmemory_operand")])
488
   (match_operand 3 "")]
489
   ""
490
   {
491
   or32_expand_conditional_branch (operands, SImode);
492
   DONE;
493
   })
494
 
495
(define_expand "cbranchsf4"
496
  [(match_operator 0 "comparison_operator"
497
    [(match_operand:SI 1 "register_operand")
498
     (match_operand:SI 2 "register_operand")])
499
   (match_operand 3 "")]
500
   "TARGET_HARD_FLOAT"
501
   {
502
   or32_expand_conditional_branch (operands, SFmode);
503
   DONE;
504
   })
505
 
506
;;
507
;; Setting a CCxx registers from comparision
508
;;
509
 
510
 
511
 
512
;; Here are the actual compare insns.
513
(define_insn "*cmpsi_eq"
514 399 jeremybenn
  [(set (reg:CCEQ CC_REG)
515 282 jeremybenn
        (compare:CCEQ (match_operand:SI 0 "register_operand" "r,r")
516
                      (match_operand:SI 1 "nonmemory_operand" "I,r")))]
517
  ""
518
  "@
519
   l.sfeqi\t%0,%1
520
   l.sfeq \t%0,%1")
521
 
522
(define_insn "*cmpsi_ne"
523 399 jeremybenn
  [(set (reg:CCNE CC_REG)
524 282 jeremybenn
        (compare:CCNE (match_operand:SI 0 "register_operand" "r,r")
525
                      (match_operand:SI 1 "nonmemory_operand" "I,r")))]
526
  ""
527
  "@
528
   l.sfnei\t%0,%1
529
   l.sfne \t%0,%1")
530
 
531
(define_insn "*cmpsi_gt"
532 399 jeremybenn
  [(set (reg:CCGT CC_REG)
533 282 jeremybenn
        (compare:CCGT (match_operand:SI 0 "register_operand" "r,r")
534
                      (match_operand:SI 1 "nonmemory_operand" "I,r")))]
535
  ""
536
  "@
537
   l.sfgtsi\t%0,%1
538
   l.sfgts \t%0,%1")
539
 
540
(define_insn "*cmpsi_gtu"
541 399 jeremybenn
  [(set (reg:CCGTU CC_REG)
542 282 jeremybenn
        (compare:CCGTU (match_operand:SI 0 "register_operand" "r,r")
543
                       (match_operand:SI 1 "nonmemory_operand" "I,r")))]
544
  ""
545
  "@
546
   l.sfgtui\t%0,%1
547
   l.sfgtu \t%0,%1")
548
 
549
(define_insn "*cmpsi_lt"
550 399 jeremybenn
  [(set (reg:CCLT CC_REG)
551 282 jeremybenn
        (compare:CCLT (match_operand:SI 0 "register_operand" "r,r")
552
                      (match_operand:SI 1 "nonmemory_operand" "I,r")))]
553
  ""
554
  "@
555
   l.sfltsi\t%0,%1
556
   l.sflts \t%0,%1")
557
 
558
(define_insn "*cmpsi_ltu"
559 399 jeremybenn
  [(set (reg:CCLTU CC_REG)
560 282 jeremybenn
        (compare:CCLTU (match_operand:SI 0 "register_operand" "r,r")
561
                       (match_operand:SI 1 "nonmemory_operand" "I,r")))]
562
  ""
563
  "@
564
   l.sfltui\t%0,%1
565
   l.sfltu \t%0,%1")
566
 
567
(define_insn "*cmpsi_ge"
568 399 jeremybenn
  [(set (reg:CCGE CC_REG)
569 282 jeremybenn
        (compare:CCGE (match_operand:SI 0 "register_operand" "r,r")
570
                      (match_operand:SI 1 "nonmemory_operand" "I,r")))]
571
  ""
572
  "@
573
   l.sfgesi\t%0,%1
574
   l.sfges \t%0,%1")
575
 
576
 
577
(define_insn "*cmpsi_geu"
578 399 jeremybenn
  [(set (reg:CCGEU CC_REG)
579 282 jeremybenn
        (compare:CCGEU (match_operand:SI 0 "register_operand" "r,r")
580
                       (match_operand:SI 1 "nonmemory_operand" "I,r")))]
581
  ""
582
  "@
583
   l.sfgeui\t%0,%1
584
   l.sfgeu \t%0,%1")
585
 
586
 
587
(define_insn "*cmpsi_le"
588 399 jeremybenn
  [(set (reg:CCLE CC_REG)
589 282 jeremybenn
        (compare:CCLE (match_operand:SI 0 "register_operand" "r,r")
590
                      (match_operand:SI 1 "nonmemory_operand" "I,r")))]
591
  ""
592
  "@
593
   l.sflesi\t%0,%1
594
   l.sfles \t%0,%1")
595
 
596
(define_insn "*cmpsi_leu"
597 399 jeremybenn
  [(set (reg:CCLEU CC_REG)
598 282 jeremybenn
        (compare:CCLEU (match_operand:SI 0 "register_operand" "r,r")
599
                       (match_operand:SI 1 "nonmemory_operand" "I,r")))]
600
  ""
601
  "@
602
   l.sfleui\t%0,%1
603
   l.sfleu \t%0,%1")
604
 
605
;; Single precision floating point evaluation instructions
606
(define_insn "*cmpsf_eq"
607 399 jeremybenn
  [(set (reg:CCEQ CC_REG)
608 282 jeremybenn
        (compare:CCEQ (match_operand:SF 0 "register_operand" "r,r")
609
                      (match_operand:SF 1 "register_operand" "r,r")))]
610
  "TARGET_HARD_FLOAT"
611
  "lf.sfeq.s\t%0,%1")
612
 
613
(define_insn "*cmpsf_ne"
614 399 jeremybenn
  [(set (reg:CCNE CC_REG)
615 282 jeremybenn
        (compare:CCNE (match_operand:SF 0 "register_operand" "r,r")
616
                      (match_operand:SF 1 "register_operand" "r,r")))]
617
  "TARGET_HARD_FLOAT"
618
  "lf.sfne.s\t%0,%1")
619
 
620
 
621
(define_insn "*cmpsf_gt"
622 399 jeremybenn
  [(set (reg:CCGT CC_REG)
623 282 jeremybenn
        (compare:CCGT (match_operand:SF 0 "register_operand" "r,r")
624
                      (match_operand:SF 1 "register_operand" "r,r")))]
625
  "TARGET_HARD_FLOAT"
626
  "lf.sfgt.s\t%0,%1")
627
 
628
(define_insn "*cmpsf_ge"
629 399 jeremybenn
  [(set (reg:CCGE CC_REG)
630 282 jeremybenn
        (compare:CCGE (match_operand:SF 0 "register_operand" "r,r")
631
                      (match_operand:SF 1 "register_operand" "r,r")))]
632
  "TARGET_HARD_FLOAT"
633
  "lf.sfge.s\t%0,%1")
634
 
635
 
636
(define_insn "*cmpsf_lt"
637 399 jeremybenn
  [(set (reg:CCLT CC_REG)
638 282 jeremybenn
        (compare:CCLT (match_operand:SF 0 "register_operand" "r,r")
639
                      (match_operand:SF 1 "register_operand" "r,r")))]
640
  "TARGET_HARD_FLOAT"
641
  "lf.sflt.s\t%0,%1")
642
 
643
(define_insn "*cmpsf_le"
644 399 jeremybenn
  [(set (reg:CCLE CC_REG)
645 282 jeremybenn
        (compare:CCLE (match_operand:SF 0 "register_operand" "r,r")
646
                      (match_operand:SF 1 "register_operand" "r,r")))]
647
  "TARGET_HARD_FLOAT"
648
  "lf.sfle.s\t%0,%1")
649
 
650
(define_insn "*bf"
651
  [(set (pc)
652
        (if_then_else (match_operator 1 "comparison_operator"
653
                                      [(match_operand 2
654
                                                      "cc_reg_operand" "")
655
                                       (const_int 0)])
656
                      (label_ref (match_operand 0 "" ""))
657
                      (pc)))]
658
  ""
659
  "*
660
   return or32_output_bf(operands);
661
  "
662
  [(set_attr "type" "branch")
663
   (set_attr "length" "1")])
664
 
665
;;
666
;;
667
;;
668
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
669
;;
670
;;
671
(define_insn "movdi"
672
  [(set (match_operand:DI 0 "nonimmediate_operand" "=r, r, m, r")
673
        (match_operand:DI 1 "general_operand"      " r, m, r, i"))]
674
  ""
675
  "*
676
    return or32_output_move_double (operands);
677
  "
678
  [(set_attr "length" "2,2,2,3")])
679
 
680
;; Moving double and single precision floating point values
681
 
682
(define_insn "movdf"
683
  [(set (match_operand:DF 0 "nonimmediate_operand" "=r, r, m, r")
684
        (match_operand:DF 1 "general_operand"      " r, m, r, i"))]
685
  ""
686
  "*
687
    return or32_output_move_double (operands);
688
  "
689
  [(set_attr "length" "2,2,2,3")])
690
 
691
 
692
(define_insn "movsf"
693
  [(set (match_operand:SF 0 "general_operand" "=r,r,m")
694
        (match_operand:SF 1 "general_operand"  "r,m,r"))]
695
  ""
696
  "@
697
   l.ori   \t%0,%1,0\t # movsf
698
   l.lwz   \t%0,%1\t # movsf
699
   l.sw    \t%0,%1\t # movsf"
700
  [(set_attr "type" "move,load,store")
701
   (set_attr "length" "1,1,1")])
702
 
703
 
704
;;
705
;; extendqisi2
706
;;
707
 
708
(define_expand "extendqisi2"
709
  [(use (match_operand:SI 0 "register_operand" ""))
710
   (use (match_operand:QI 1 "nonimmediate_operand" ""))]
711
  ""
712
  "
713
{
714
  if (TARGET_MASK_SEXT)
715
    emit_insn (gen_extendqisi2_sext(operands[0], operands[1]));
716
  else {
717
    if ( GET_CODE(operands[1]) == MEM ) {
718
      emit_insn (gen_extendqisi2_no_sext_mem(operands[0], operands[1]));
719
    }
720
    else {
721
      emit_insn (gen_extendqisi2_no_sext_reg(operands[0], operands[1]));
722
    }
723
 }
724
 DONE;
725
}")
726
 
727
(define_insn "extendqisi2_sext"
728
  [(set (match_operand:SI 0 "register_operand" "=r,r")
729
        (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
730
  "TARGET_MASK_SEXT"
731
  "@
732
   l.extbs \t%0,%1\t # extendqisi2_has_signed_extend
733
   l.lbs   \t%0,%1\t # extendqisi2_has_signed_extend"
734
  [(set_attr "length" "1,1")
735
   (set_attr "type" "extend,load")])
736
 
737
(define_insn "extendqisi2_no_sext_mem"
738
  [(set (match_operand:SI 0 "register_operand" "=r")
739
        (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
740
  "!TARGET_MASK_SEXT"
741
  "l.lbs   \t%0,%1\t # extendqisi2_no_sext_mem"
742
  [(set_attr "length" "1")
743
   (set_attr "type" "load")])
744
 
745
(define_expand "extendqisi2_no_sext_reg"
746
  [(set (match_dup 2)
747
        (ashift:SI (match_operand:QI 1 "register_operand" "")
748
                   (const_int 24)))
749
   (set (match_operand:SI 0 "register_operand" "")
750
        (ashiftrt:SI (match_dup 2)
751
                     (const_int 24)))]
752
  "!TARGET_MASK_SEXT"
753
  "
754
{
755
  operands[1] = gen_lowpart (SImode, operands[1]);
756
  operands[2] = gen_reg_rtx (SImode); }")
757
 
758
;;
759
;; extendhisi2
760
;;
761
 
762
(define_expand "extendhisi2"
763
  [(use (match_operand:SI 0 "register_operand" ""))
764
   (use (match_operand:HI 1 "nonimmediate_operand" ""))]
765
  ""
766
  "
767
{
768
  if (TARGET_MASK_SEXT)
769
    emit_insn (gen_extendhisi2_sext(operands[0], operands[1]));
770
  else {
771
    if ( GET_CODE(operands[1]) == MEM ) {
772
      emit_insn (gen_extendhisi2_no_sext_mem(operands[0], operands[1]));
773
    }
774
    else {
775
      emit_insn (gen_extendhisi2_no_sext_reg(operands[0], operands[1]));
776
    }
777
 }
778
 DONE;
779
}")
780
 
781
(define_insn "extendhisi2_sext"
782
  [(set (match_operand:SI 0 "register_operand" "=r,r")
783
        (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
784
  "TARGET_MASK_SEXT"
785
  "@
786
   l.exths \t%0,%1\t # extendhisi2_has_signed_extend
787
   l.lhs   \t%0,%1\t # extendhisi2_has_signed_extend"
788
  [(set_attr "length" "1,1")
789
   (set_attr "type" "extend,load")])
790
 
791
(define_insn "extendhisi2_no_sext_mem"
792
  [(set (match_operand:SI 0 "register_operand" "=r")
793
        (sign_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
794
  "!TARGET_MASK_SEXT"
795
  "l.lhs   \t%0,%1\t # extendhisi2_no_sext_mem"
796
  [(set_attr "length" "1")
797
   (set_attr "type" "load")])
798
 
799
(define_expand "extendhisi2_no_sext_reg"
800
  [(set (match_dup 2)
801
        (ashift:SI (match_operand:HI 1 "register_operand" "")
802
                   (const_int 16)))
803
   (set (match_operand:SI 0 "register_operand" "")
804
        (ashiftrt:SI (match_dup 2)
805
                     (const_int 16)))]
806
  "!TARGET_MASK_SEXT"
807
  "
808
{
809
  operands[1] = gen_lowpart (SImode, operands[1]);
810
  operands[2] = gen_reg_rtx (SImode); }")
811
 
812
 
813
;;
814
;; zero_extend2
815
;;
816
 
817
(define_insn "zero_extendqisi2"
818
  [(set (match_operand:SI 0 "register_operand" "=r,r")
819
        (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
820
  ""
821
  "@
822
   l.andi  \t%0,%1,0xff\t # zero_extendqisi2
823
   l.lbz   \t%0,%1\t # zero_extendqisi2"
824
  [(set_attr "type" "logic,load")
825
   (set_attr "length" "1,1")])
826
 
827
 
828
(define_insn "zero_extendhisi2"
829
  [(set (match_operand:SI 0 "register_operand" "=r,r")
830
        (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
831
  ""
832
  "@
833
   l.andi  \t%0,%1,0xffff\t # zero_extendqisi2
834
   l.lhz   \t%0,%1\t # zero_extendqisi2"
835
  [(set_attr "type" "logic,load")
836
   (set_attr "length" "1,1")])
837
 
838
;;
839
;; Shift/rotate operations
840
;;
841
 
842
(define_insn "ashlsi3"
843
  [(set (match_operand:SI 0 "register_operand" "=r,r")
844
        (ashift:SI (match_operand:SI 1 "register_operand" "r,r")
845
                   (match_operand:SI 2 "nonmemory_operand" "r,L")))]
846
  ""
847
  "@
848
   l.sll   \t%0,%1,%2
849
   l.slli  \t%0,%1,%2"
850
  [(set_attr "type" "shift,shift")
851
   (set_attr "length" "1,1")])
852
 
853
(define_insn "ashrsi3"
854
  [(set (match_operand:SI 0 "register_operand" "=r,r")
855
        (ashiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
856
                   (match_operand:SI 2 "nonmemory_operand" "r,L")))]
857
  ""
858
  "@
859
   l.sra   \t%0,%1,%2
860
   l.srai  \t%0,%1,%2"
861
  [(set_attr "type" "shift,shift")
862
   (set_attr "length" "1,1")])
863
 
864
(define_insn "lshrsi3"
865
  [(set (match_operand:SI 0 "register_operand" "=r,r")
866
        (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
867
                   (match_operand:SI 2 "nonmemory_operand" "r,L")))]
868
  ""
869
  "@
870
   l.srl   \t%0,%1,%2
871
   l.srli  \t%0,%1,%2"
872
  [(set_attr "type" "shift,shift")
873
   (set_attr "length" "1,1")])
874
 
875
(define_insn "rotrsi3"
876
  [(set (match_operand:SI 0 "register_operand" "=r,r")
877
        (rotatert:SI (match_operand:SI 1 "register_operand" "r,r")
878
                   (match_operand:SI 2 "nonmemory_operand" "r,L")))]
879
  "TARGET_MASK_ROR"
880
  "@
881
   l.ror   \t%0,%1,%2
882
   l.rori  \t%0,%1,%2"
883
  [(set_attr "type" "shift,shift")
884
   (set_attr "length" "1,1")])
885
 
886
;;
887
;; Logical bitwise operations
888
;;
889
 
890
(define_insn "andsi3"
891
  [(set (match_operand:SI 0 "register_operand" "=r,r")
892
        (and:SI (match_operand:SI 1 "register_operand" "%r,r")
893
                (match_operand:SI 2 "nonmemory_operand" "r,K")))]
894
  ""
895
  "@
896
   l.and   \t%0,%1,%2
897
   l.andi  \t%0,%1,%2"
898
  [(set_attr "type" "logic,logic")
899
   (set_attr "length" "1,1")])
900
 
901
(define_insn "iorsi3"
902
  [(set (match_operand:SI 0 "register_operand" "=r,r")
903
        (ior:SI (match_operand:SI 1 "register_operand" "%r,r")
904
                (match_operand:SI 2 "nonmemory_operand" "r,K")))]
905
  ""
906
  "@
907
   l.or    \t%0,%1,%2
908
   l.ori   \t%0,%1,%2"
909
  [(set_attr "type" "logic,logic")
910
   (set_attr "length" "1,1")])
911
 
912
(define_insn "xorsi3"
913
  [(set (match_operand:SI 0 "register_operand" "=r,r")
914
        (xor:SI (match_operand:SI 1 "register_operand" "%r,r")
915
                (match_operand:SI 2 "nonmemory_operand" "r,I")))]
916
  ""
917
  "@
918
   l.xor   \t%0,%1,%2
919
   l.xori  \t%0,%1,%2"
920
  [(set_attr "type" "logic,logic")
921
   (set_attr "length" "1,1")])
922
 
923
(define_insn "one_cmplqi2"
924
  [(set (match_operand:QI 0 "register_operand" "=r")
925
        (not:QI (match_operand:QI 1 "register_operand" "r")))]
926
  ""
927
  "l.xori  \t%0,%1,0x00ff"
928
  [(set_attr "type" "logic")
929
   (set_attr "length" "1")])
930
 
931
(define_insn "one_cmplsi2"
932
  [(set (match_operand:SI 0 "register_operand" "=r")
933
        (not:SI (match_operand:SI 1 "register_operand" "r")))]
934
  ""
935
  "l.xori  \t%0,%1,0xffff"
936
  [(set_attr "type" "logic")
937
   (set_attr "length" "1")])
938
 
939
;;
940
;; Arithmetic operations
941
;;
942
 
943
(define_insn "negsi2"
944
  [(set (match_operand:SI 0 "register_operand" "=r")
945
        (neg:SI (match_operand:SI 1 "register_operand" "r")))]
946
  ""
947
  "l.sub   \t%0,r0,%1"
948
  [(set_attr "type" "add")
949
   (set_attr "length" "1")])
950
 
951
(define_insn "addsi3"
952
  [(set (match_operand:SI 0 "register_operand" "=r,r")
953
        (plus:SI (match_operand:SI 1 "register_operand" "%r,r")
954
                 (match_operand:SI 2 "nonmemory_operand" "r,I")))]
955
  ""
956
  "@
957
   l.add   \t%0,%1,%2
958
   l.addi  \t%0,%1,%2"
959
  [(set_attr "type" "add,add")
960
   (set_attr "length" "1,1")])
961
 
962
(define_insn "subsi3"
963
  [(set (match_operand:SI 0 "register_operand" "=r,r")
964
        (minus:SI (match_operand:SI 1 "register_operand" "r,r")
965
                  (match_operand:SI 2 "nonmemory_operand" "r,I")))]
966
  ""
967
  "@
968
   l.sub   \t%0,%1,%2
969
   l.addi  \t%0,%1,%n2"
970
  [(set_attr "type" "add,add")]
971
)
972
 
973
;;
974
;; mul and div
975
;;
976
 
977
(define_insn "mulsi3"
978
  [(set (match_operand:SI 0 "register_operand" "=r")
979
        (mult:SI (match_operand:SI 1 "register_operand" "r")
980
                 (match_operand:SI 2 "register_operand" "r")))]
981
  "TARGET_HARD_MUL"
982
  "l.mul   \t%0,%1,%2"
983
  [(set_attr "type" "mul")
984
   (set_attr "length" "1")])
985
 
986
(define_insn "divsi3"
987
  [(set (match_operand:SI 0 "register_operand" "=r")
988
        (div:SI (match_operand:SI 1 "register_operand" "r")
989
                 (match_operand:SI 2 "register_operand" "r")))]
990
  "TARGET_HARD_DIV"
991
  "l.div   \t%0,%1,%2"
992
  [(set_attr "type" "mul")
993
   (set_attr "length" "1")])
994
 
995
(define_insn "udivsi3"
996
  [(set (match_operand:SI 0 "register_operand" "=r")
997
        (udiv:SI (match_operand:SI 1 "register_operand" "r")
998
                 (match_operand:SI 2 "register_operand" "r")))]
999
  "TARGET_HARD_DIV"
1000
  "l.divu  \t%0,%1,%2"
1001
  [(set_attr "type" "mul")
1002
   (set_attr "length" "1")])
1003
 
1004
;;
1005
;; jumps
1006
;;
1007
 
1008
;; jump
1009
 
1010
(define_expand "jump"
1011
  [(set (pc)
1012
        (label_ref (match_operand 0 "" "")))]
1013
  ""
1014
  "
1015
{
1016 399 jeremybenn
  emit_jump_insn (gen_jump_internal (operands[0]));
1017 282 jeremybenn
  DONE;
1018
}")
1019
 
1020
(define_insn "jump_internal"
1021
  [(set (pc)
1022
        (label_ref (match_operand 0 "" "")))]
1023 399 jeremybenn
  ""
1024 282 jeremybenn
  "l.j     \t%l0%("
1025
  [(set_attr "type" "jump")
1026
   (set_attr "length" "1")])
1027
 
1028
;; indirect jump
1029
 
1030
(define_expand "indirect_jump"
1031
  [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
1032
  ""
1033
  "
1034
{
1035 399 jeremybenn
  emit_jump_insn (gen_indirect_jump_internal (operands[0]));
1036 282 jeremybenn
  DONE;
1037
 
1038
}")
1039
 
1040
(define_insn "indirect_jump_internal"
1041
  [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
1042 399 jeremybenn
  ""
1043 282 jeremybenn
  "l.jr    \t%0%("
1044
  [(set_attr "type" "jump")
1045
   (set_attr "length" "1")])
1046
 
1047
;;
1048
;; calls
1049
;;
1050
 
1051
;; call
1052
 
1053
(define_expand "call"
1054
  [(parallel [(call (match_operand:SI 0 "sym_ref_mem_operand" "")
1055
                    (match_operand 1 "" "i"))
1056
              (clobber (reg:SI 9))])]
1057
  ""
1058
  "
1059
{
1060 399 jeremybenn
  emit_call_insn (gen_call_internal (operands[0], operands[1]));
1061 282 jeremybenn
  DONE;
1062
}")
1063
 
1064
(define_insn "call_internal"
1065
[(parallel [(call (match_operand:SI 0 "sym_ref_mem_operand" "")
1066
                  (match_operand 1 "" "i"))
1067
            (clobber (reg:SI 9))])]
1068 399 jeremybenn
  ""
1069 282 jeremybenn
  "l.jal   \t%S0%("
1070
  [(set_attr "type" "jump")
1071
   (set_attr "length" "1")])
1072
 
1073
;; call value
1074
 
1075
(define_expand "call_value"
1076
  [(parallel [(set (match_operand 0 "register_operand" "=r")
1077
                   (call (match_operand:SI 1 "sym_ref_mem_operand" "")
1078
                         (match_operand 2 "" "i")))
1079
              (clobber (reg:SI 9))])]
1080
  ""
1081
  "
1082
{
1083 399 jeremybenn
  emit_call_insn (gen_call_value_internal (operands[0], operands[1], operands[2]));
1084 282 jeremybenn
  DONE;
1085
}")
1086
 
1087
(define_insn "call_value_internal"
1088
[(parallel [(set (match_operand 0 "register_operand" "=r")
1089
                  (call (match_operand:SI 1 "sym_ref_mem_operand" "")
1090
                        (match_operand 2 "" "i")))
1091
            (clobber (reg:SI 9))])]
1092 399 jeremybenn
  ""
1093 282 jeremybenn
  "l.jal   \t%S1%("
1094
  [(set_attr "type" "jump")
1095
   (set_attr "length" "1")])
1096
 
1097
;; indirect call value
1098
 
1099
(define_expand "call_value_indirect"
1100
  [(parallel [(set (match_operand 0 "register_operand" "=r")
1101
                   (call (mem:SI (match_operand:SI 1 "register_operand" "r"))
1102
                         (match_operand 2 "" "i")))
1103
              (clobber (reg:SI 9))])]
1104
  ""
1105
  "
1106
{
1107 399 jeremybenn
  emit_call_insn (gen_call_value_indirect_internal (operands[0], operands[1], operands[2]));
1108 282 jeremybenn
  DONE;
1109
}")
1110
 
1111
(define_insn "call_value_indirect_internal"
1112
  [(parallel [(set (match_operand 0 "register_operand" "=r")
1113
                   (call (mem:SI (match_operand:SI 1 "register_operand" "r"))
1114
                         (match_operand 2 "" "i")))
1115
              (clobber (reg:SI 9))])]
1116 399 jeremybenn
  ""
1117 282 jeremybenn
  "l.jalr  \t%1%("
1118
  [(set_attr "type" "jump")
1119
   (set_attr "length" "1")])
1120
 
1121
;; indirect call
1122
 
1123
(define_expand "call_indirect"
1124
  [(parallel [(call (mem:SI (match_operand:SI 0 "register_operand" "r"))
1125
                    (match_operand 1 "" "i"))
1126
              (clobber (reg:SI 9))])]
1127
  ""
1128
  "
1129
{
1130 399 jeremybenn
  emit_call_insn (gen_call_indirect_internal (operands[0], operands[1]));
1131 282 jeremybenn
  DONE;
1132
}")
1133
 
1134
(define_insn "call_indirect_internal"
1135
[(parallel [(call (mem:SI (match_operand:SI 0 "register_operand" "r"))
1136
                  (match_operand 1 "" "i"))
1137
              (clobber (reg:SI 9))])]
1138 399 jeremybenn
  ""
1139 282 jeremybenn
  "l.jalr  \t%0%("
1140
  [(set_attr "type" "jump")
1141
   (set_attr "length" "1")])
1142
 
1143
;; table jump
1144
 
1145
(define_expand "tablejump"
1146
  [(set (pc) (match_operand:SI 0 "register_operand" "r"))
1147
   (use (label_ref (match_operand 1 "" "")))]
1148
   ""
1149
  "
1150
{
1151 399 jeremybenn
  if (CASE_VECTOR_PC_RELATIVE || flag_pic)
1152
    operands[0]
1153
      = force_reg (Pmode,
1154
                   gen_rtx_PLUS (Pmode, operands[0],
1155
                                 gen_rtx_LABEL_REF (Pmode, operands[1])));
1156
  emit_jump_insn (gen_tablejump_internal (operands[0], operands[1]));
1157 282 jeremybenn
  DONE;
1158
}")
1159
 
1160
(define_insn "tablejump_internal"
1161
  [(set (pc) (match_operand:SI 0 "register_operand" "r"))
1162
   (use (label_ref (match_operand 1 "" "")))]
1163 399 jeremybenn
  ""
1164 282 jeremybenn
  "l.jr    \t%0%("
1165
  [(set_attr "type" "jump")
1166
   (set_attr "length" "1")])
1167
 
1168
 
1169
;; no-op
1170
 
1171
(define_insn "nop"
1172
  [(const_int 0)]
1173
  ""
1174
  "l.nop"
1175
  [(set_attr "type" "logic")
1176
   (set_attr "length" "1")])
1177
 
1178
;;
1179
;; floating point
1180
;;
1181
 
1182
;; floating point arithmetic
1183
 
1184
(define_insn "addsf3"
1185
  [(set (match_operand:SF 0 "register_operand" "=r")
1186
        (plus:SF (match_operand:SF 1 "register_operand" "r")
1187
                 (match_operand:SF 2 "register_operand" "r")))]
1188
  "TARGET_HARD_FLOAT"
1189
  "lf.add.s\t%0,%1,%2"
1190
  [(set_attr "type"     "fp")
1191
   (set_attr "length"   "1")])
1192
 
1193
(define_insn "adddf3"
1194
  [(set (match_operand:DF 0 "register_operand" "=r")
1195
        (plus:DF (match_operand:DF 1 "register_operand" "r")
1196
                 (match_operand:DF 2 "register_operand" "r")))]
1197
  "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1198
  "lf.add.d\t%0,%1,%2"
1199
  [(set_attr "type"     "fp")
1200
   (set_attr "length"   "1")])
1201
 
1202
(define_insn "subsf3"
1203
  [(set (match_operand:SF 0 "register_operand" "=r")
1204
        (minus:SF (match_operand:SF 1 "register_operand" "r")
1205
                 (match_operand:SF 2 "register_operand" "r")))]
1206
  "TARGET_HARD_FLOAT"
1207
  "lf.sub.s\t%0,%1,%2"
1208
  [(set_attr "type"     "fp")
1209
   (set_attr "length"   "1")])
1210
 
1211
(define_insn "subdf3"
1212
  [(set (match_operand:DF 0 "register_operand" "=r")
1213
        (minus:DF (match_operand:DF 1 "register_operand" "r")
1214
                  (match_operand:DF 2 "register_operand" "r")))]
1215
  "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1216
  "lf.sub.d\t%0,%1,%2"
1217
  [(set_attr "type"     "fp")
1218
   (set_attr "length"   "1")])
1219
 
1220
(define_insn "mulsf3"
1221
  [(set (match_operand:SF 0 "register_operand" "=r")
1222
        (mult:SF (match_operand:SF 1 "register_operand" "r")
1223
                 (match_operand:SF 2 "register_operand" "r")))]
1224
  "TARGET_HARD_FLOAT"
1225
  "lf.mul.s\t%0,%1,%2"
1226
  [(set_attr "type"     "fp")
1227
   (set_attr "length"   "1")])
1228
 
1229
(define_insn "muldf3"
1230
  [(set (match_operand:DF 0 "register_operand" "=r")
1231
        (mult:DF (match_operand:DF 1 "register_operand" "r")
1232
                 (match_operand:DF 2 "register_operand" "r")))]
1233
  "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1234
  "lf.mul.d\t%0,%1,%2"
1235
  [(set_attr "type"     "fp")
1236
   (set_attr "length"   "1")])
1237
 
1238
(define_insn "divsf3"
1239
  [(set (match_operand:SF 0 "register_operand" "=r")
1240
        (div:SF (match_operand:SF 1 "register_operand" "r")
1241
                (match_operand:SF 2 "register_operand" "r")))]
1242
  "TARGET_HARD_FLOAT"
1243
  "lf.div.s\t%0,%1,%2"
1244
  [(set_attr "type"     "fp")
1245
   (set_attr "length"   "1")])
1246
 
1247
(define_insn "divdf3"
1248
  [(set (match_operand:DF 0 "register_operand" "=r")
1249
        (div:DF (match_operand:DF 1 "register_operand" "r")
1250
                (match_operand:DF 2 "register_operand" "r")))]
1251
  "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1252
  "lf.div.d\t%0,%1,%2"
1253
  [(set_attr "type"     "fp")
1254
   (set_attr "length"   "1")])
1255
 
1256
;; Conversion between fixed point and floating point.
1257
 
1258
 
1259
(define_insn "floatsisf2"
1260
  [(set (match_operand:SF 0 "register_operand" "=r")
1261
        (float:SF (match_operand:SI 1 "register_operand" "r")))]
1262
  "TARGET_HARD_FLOAT"
1263
  "lf.itof.s\t%0, %1"
1264
  [(set_attr "type" "fp")
1265
   (set_attr "length" "1")])
1266
 
1267
;; not working
1268
(define_insn "fixunssfsi2"
1269
  [(set (match_operand:SI 0 "register_operand" "=r")
1270
        (fix:SI (match_operand:SF 1 "register_operand" "r")))]
1271
  "TARGET_HARD_FLOAT"
1272
  "lf.ftoi.s\t%0, %1"
1273
  [(set_attr "type" "fp")
1274
   (set_attr "length" "1")])
1275
 
1276
 
1277
;; Local variables:
1278
;; mode:emacs-lisp
1279
;; comment-start: ";; "
1280
;; eval: (set-syntax-table (copy-sequence (syntax-table)))
1281
;; eval: (modify-syntax-entry ?[ "(]")
1282
;; eval: (modify-syntax-entry ?] ")[")
1283
;; eval: (modify-syntax-entry ?{ "(}")
1284
;; eval: (modify-syntax-entry ?} "){")
1285
;; eval: (setq indent-tabs-mode t)
1286
;; End:

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.