OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

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

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

powered by: WebSVN 2.1.0

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