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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [config/] [or32/] [or32.md] - Blame information for rev 247

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

Line No. Rev Author Line
1 38 julius
;; Machine description for GNU compiler, OpenRISC 1000 family, OR32 ISA
2 247 jeremybenn
;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
3
;; Foundation, Inc.
4 38 julius
;; Contributed by Damjan Lampret  in 1999.
5
;; Major optimizations by Matjaz Breskvar  in 2005.
6 247 jeremybenn
;; Floating point additions by Jungsook Yang  and
7
;; Julius Baxter 
8 38 julius
 
9
;; This file is part of GNU CC.
10
 
11
;; GNU CC is free software; you can redistribute it and/or modify
12
;; it under the terms of the GNU General Public License as published by
13
;; the Free Software Foundation; either version 1, or (at your option)
14
;; any later version.
15
 
16
;; GNU CC is distributed in the hope that it will be useful,
17
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
;; GNU General Public License for more details.
20
 
21
;; You should have received a copy of the GNU General Public License
22
;; along with GNU CC; see the file COPYING.  If not, write to
23
;; the Free Software Foundation, 59 Temple Place - Suite 330,
24
;; Boston, MA 02111-1307, USA.
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 247 jeremybenn
;; Number of machine instructions required to implement an insn.
33 38 julius
(define_attr "length" "" (const_int 1))
34
 
35 247 jeremybenn
;; Single delay slot after branch or jump instructions, wich may contain any
36
;; instruction but another branch or jump.
37 38 julius
(define_delay (eq_attr "type" "branch,jump")
38
               [(and (eq_attr "type" "!branch,jump")
39
                     (eq_attr "length" "1")) (nil) (nil)])
40
 
41 247 jeremybenn
;; ALU is modelled as a single functional unit, which is reserved for varying
42
;; numbers of slots.
43 38 julius
;;
44 247 jeremybenn
;; 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 38 julius
(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 247 jeremybenn
(define_insn_reservation "alu_unit" 2
51
                         (eq_attr "type" "add,logic,extend,move,compare")
52
                         "or32_alu")
53 38 julius
(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 (!no_new_pseudos)
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 (!no_new_pseudos)
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
(define_expand "cmpsi"
432
  [(set (reg:CC 32)
433
        (compare:CC (match_operand:SI 0 "register_operand" "")
434
                    (match_operand:SI 1 "nonmemory_operand" "")))]
435
  ""
436 133 jeremybenn
  {
437
   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
438
      operands[0] = force_reg (SImode, operands[0]);
439
      or32_compare_op0 = operands[0];
440
      or32_compare_op1 = operands[1];
441
      DONE;
442
      })
443 38 julius
 
444 133 jeremybenn
(define_expand "cmpsf"
445
  [(set (reg:CC 32)
446
        (compare:CC (match_operand:SF 0 "register_operand" "")
447
                    (match_operand:SF 1 "register_operand" "")))]
448
  "TARGET_HARD_FLOAT"
449
  {
450
   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
451
      operands[0] = force_reg (SFmode, operands[0]);
452
      or32_compare_op0 = operands[0];
453
      or32_compare_op1 = operands[1];
454
      DONE;
455
      })
456
 
457 38 julius
 
458
 
459
;;
460
;; Conditional branches
461
;;
462
 
463
(define_expand "beq"
464
  [(use (match_operand 0 "" ""))]
465
  ""
466
  "or32_expand_branch (EQ, operands[0]); DONE;")
467
 
468
(define_expand "bne"
469
  [(use (match_operand 0 "" ""))]
470
  ""
471
  "or32_expand_branch (NE, operands[0]); DONE;")
472
 
473
(define_expand "bgt"
474
  [(use (match_operand 0 "" ""))]
475
  ""
476
  "or32_expand_branch (GT, operands[0]); DONE;")
477
 
478
(define_expand "bgtu"
479
  [(use (match_operand 0 "" ""))]
480
  ""
481
  "or32_expand_branch (GTU, operands[0]); DONE;")
482
 
483
(define_expand "blt"
484
  [(use (match_operand 0 "" ""))]
485
  ""
486
  "or32_expand_branch (LT, operands[0]); DONE;")
487
 
488
(define_expand "bltu"
489
  [(use (match_operand 0 "" ""))]
490
  ""
491
  "or32_expand_branch (LTU, operands[0]); DONE;")
492
 
493
(define_expand "bge"
494
  [(use (match_operand 0 "" ""))]
495
  ""
496
  "or32_expand_branch (GE, operands[0]); DONE;")
497
 
498
(define_expand "bgeu"
499
  [(use (match_operand 0 "" ""))]
500
  ""
501
  "or32_expand_branch (GEU, operands[0]); DONE;")
502
 
503
(define_expand "ble"
504
  [(use (match_operand 0 "" ""))]
505
  ""
506
  "or32_expand_branch (LE, operands[0]); DONE;")
507
 
508
(define_expand "bleu"
509
  [(use (match_operand 0 "" ""))]
510
  ""
511
  "or32_expand_branch (LEU, operands[0]); DONE;")
512
 
513
 
514
 
515
;;
516
;; Setting a CCxx registers from comparision
517
;;
518
 
519
 
520
 
521
;; Here are the actual compare insns.
522
(define_insn "*cmpsi_eq"
523
  [(set (reg:CCEQ 32)
524
        (compare:CCEQ (match_operand:SI 0 "register_operand" "r,r")
525
                      (match_operand:SI 1 "nonmemory_operand" "I,r")))]
526
  ""
527
  "@
528
   l.sfeqi\t%0,%1
529
   l.sfeq \t%0,%1")
530
 
531
(define_insn "*cmpsi_ne"
532
  [(set (reg:CCNE 32)
533
        (compare:CCNE (match_operand:SI 0 "register_operand" "r,r")
534
                      (match_operand:SI 1 "nonmemory_operand" "I,r")))]
535
  ""
536
  "@
537
   l.sfnei\t%0,%1
538
   l.sfne \t%0,%1")
539
 
540
(define_insn "*cmpsi_gt"
541
  [(set (reg:CCGT 32)
542
        (compare:CCGT (match_operand:SI 0 "register_operand" "r,r")
543
                      (match_operand:SI 1 "nonmemory_operand" "I,r")))]
544
  ""
545
  "@
546
   l.sfgtsi\t%0,%1
547
   l.sfgts \t%0,%1")
548
 
549
(define_insn "*cmpsi_gtu"
550
  [(set (reg:CCGTU 32)
551
        (compare:CCGTU (match_operand:SI 0 "register_operand" "r,r")
552
                       (match_operand:SI 1 "nonmemory_operand" "I,r")))]
553
  ""
554
  "@
555
   l.sfgtui\t%0,%1
556
   l.sfgtu \t%0,%1")
557
 
558
(define_insn "*cmpsi_lt"
559
  [(set (reg:CCLT 32)
560
        (compare:CCLT (match_operand:SI 0 "register_operand" "r,r")
561
                      (match_operand:SI 1 "nonmemory_operand" "I,r")))]
562
  ""
563
  "@
564
   l.sfltsi\t%0,%1
565
   l.sflts \t%0,%1")
566
 
567
(define_insn "*cmpsi_ltu"
568
  [(set (reg:CCLTU 32)
569
        (compare:CCLTU (match_operand:SI 0 "register_operand" "r,r")
570
                       (match_operand:SI 1 "nonmemory_operand" "I,r")))]
571
  ""
572
  "@
573
   l.sfltui\t%0,%1
574
   l.sfltu \t%0,%1")
575
 
576
(define_insn "*cmpsi_ge"
577
  [(set (reg:CCGE 32)
578
        (compare:CCGE (match_operand:SI 0 "register_operand" "r,r")
579
                      (match_operand:SI 1 "nonmemory_operand" "I,r")))]
580
  ""
581
  "@
582
   l.sfgesi\t%0,%1
583
   l.sfges \t%0,%1")
584
 
585
 
586
(define_insn "*cmpsi_geu"
587
  [(set (reg:CCGEU 32)
588
        (compare:CCGEU (match_operand:SI 0 "register_operand" "r,r")
589
                       (match_operand:SI 1 "nonmemory_operand" "I,r")))]
590
  ""
591
  "@
592
   l.sfgeui\t%0,%1
593
   l.sfgeu \t%0,%1")
594
 
595
 
596
(define_insn "*cmpsi_le"
597
  [(set (reg:CCLE 32)
598
        (compare:CCLE (match_operand:SI 0 "register_operand" "r,r")
599
                      (match_operand:SI 1 "nonmemory_operand" "I,r")))]
600
  ""
601
  "@
602
   l.sflesi\t%0,%1
603
   l.sfles \t%0,%1")
604
 
605
(define_insn "*cmpsi_leu"
606
  [(set (reg:CCLEU 32)
607
        (compare:CCLEU (match_operand:SI 0 "register_operand" "r,r")
608
                       (match_operand:SI 1 "nonmemory_operand" "I,r")))]
609
  ""
610
  "@
611
   l.sfleui\t%0,%1
612
   l.sfleu \t%0,%1")
613
 
614 133 jeremybenn
;; Single precision floating point evaluation instructions
615
(define_insn "*cmpsf_eq"
616
  [(set (reg:CCEQ 32)
617
        (compare:CCEQ (match_operand:SF 0 "register_operand" "r,r")
618
                      (match_operand:SF 1 "register_operand" "r,r")))]
619
  "TARGET_HARD_FLOAT"
620
  "lf.sfeq.s\t%0,%1")
621
 
622
(define_insn "*cmpsf_ne"
623
  [(set (reg:CCNE 32)
624
        (compare:CCNE (match_operand:SF 0 "register_operand" "r,r")
625
                      (match_operand:SF 1 "register_operand" "r,r")))]
626
  "TARGET_HARD_FLOAT"
627
  "lf.sfne.s\t%0,%1")
628
 
629
 
630
(define_insn "*cmpsf_gt"
631
  [(set (reg:CCGT 32)
632
        (compare:CCGT (match_operand:SF 0 "register_operand" "r,r")
633
                      (match_operand:SF 1 "register_operand" "r,r")))]
634
  "TARGET_HARD_FLOAT"
635
  "lf.sfgt.s\t%0,%1")
636
 
637
(define_insn "*cmpsf_ge"
638
  [(set (reg:CCGE 32)
639
        (compare:CCGE (match_operand:SF 0 "register_operand" "r,r")
640
                      (match_operand:SF 1 "register_operand" "r,r")))]
641
  "TARGET_HARD_FLOAT"
642
  "lf.sfge.s\t%0,%1")
643
 
644
 
645
(define_insn "*cmpsf_lt"
646
  [(set (reg:CCLT 32)
647
        (compare:CCLT (match_operand:SF 0 "register_operand" "r,r")
648
                      (match_operand:SF 1 "register_operand" "r,r")))]
649
  "TARGET_HARD_FLOAT"
650
  "lf.sflt.s\t%0,%1")
651
 
652
(define_insn "*cmpsf_le"
653
  [(set (reg:CCLE 32)
654
        (compare:CCLE (match_operand:SF 0 "register_operand" "r,r")
655
                      (match_operand:SF 1 "register_operand" "r,r")))]
656
  "TARGET_HARD_FLOAT"
657
  "lf.sfle.s\t%0,%1")
658
 
659 38 julius
(define_insn "*bf"
660
  [(set (pc)
661
        (if_then_else (match_operator 1 "comparison_operator"
662
                                      [(match_operand 2
663
                                                      "cc_reg_operand" "")
664
                                       (const_int 0)])
665
                      (label_ref (match_operand 0 "" ""))
666
                      (pc)))]
667
  ""
668
  "*
669
   return or32_output_bf(operands);
670
  "
671
  [(set_attr "type" "branch")
672
   (set_attr "length" "1")])
673
 
674
;;
675
;;
676
;;
677
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
678
;;
679
;;
680
(define_insn "movdi"
681
        [(set (match_operand:DI 0 "nonimmediate_operand" "=r, r, m, r")
682
              (match_operand:DI 1 "general_operand"      " r, m, r, i"))]
683
        ""
684
        "*
685
         return or32_output_move_double (operands);
686
        "
687
        [(set_attr "length" "2,2,2,3")])
688
 
689
(define_insn "movdf"
690
        [(set (match_operand:DF 0 "nonimmediate_operand" "=r, r, m, r")
691
              (match_operand:DF 1 "general_operand"      " r, m, r, i"))]
692
        ""
693
        "*
694
         return or32_output_move_double (operands);
695
        "
696
        [(set_attr "length" "2,2,2,3")])
697
 
698
 
699
(define_insn "movsf"
700
  [(set (match_operand:SF 0 "general_operand" "=r,r,m")
701
        (match_operand:SF 1 "general_operand"  "r,m,r"))]
702
  ""
703
  "@
704
   l.ori   \t%0,%1,0\t # movsf
705
   l.lwz   \t%0,%1\t # movsf
706
   l.sw    \t%0,%1\t # movsf"
707
[(set_attr "type" "move,load,store")
708
   (set_attr "length" "1,1,1")])
709
 
710
;;
711
;; extendqisi2
712
;;
713
 
714
(define_expand "extendqisi2"
715
  [(use (match_operand:SI 0 "register_operand" ""))
716
   (use (match_operand:QI 1 "nonimmediate_operand" ""))]
717
  ""
718
  "
719
{
720
  if (TARGET_MASK_SEXT)
721
    emit_insn (gen_extendqisi2_sext(operands[0], operands[1]));
722
  else {
723
    if ( GET_CODE(operands[1]) == MEM ) {
724
      emit_insn (gen_extendqisi2_no_sext_mem(operands[0], operands[1]));
725
    }
726
    else {
727
      emit_insn (gen_extendqisi2_no_sext_reg(operands[0], operands[1]));
728
    }
729
 }
730
 DONE;
731
}")
732
 
733
(define_insn "extendqisi2_sext"
734
  [(set (match_operand:SI 0 "register_operand" "=r,r")
735
        (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
736
  "TARGET_MASK_SEXT"
737
  "@
738
   l.extbs \t%0,%1\t # extendqisi2_has_signed_extend
739
   l.lbs   \t%0,%1\t # extendqisi2_has_signed_extend"
740
  [(set_attr "length" "1,1")
741
   (set_attr "type" "extend,load")])
742
 
743
(define_insn "extendqisi2_no_sext_mem"
744
  [(set (match_operand:SI 0 "register_operand" "=r")
745
        (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
746
  "!TARGET_MASK_SEXT"
747
  "l.lbs   \t%0,%1\t # extendqisi2_no_sext_mem"
748
  [(set_attr "length" "1")
749
   (set_attr "type" "load")])
750
 
751
(define_expand "extendqisi2_no_sext_reg"
752
  [(set (match_dup 2)
753
        (ashift:SI (match_operand:QI 1 "register_operand" "")
754
                   (const_int 24)))
755
   (set (match_operand:SI 0 "register_operand" "")
756
        (ashiftrt:SI (match_dup 2)
757
                     (const_int 24)))]
758
  "!TARGET_MASK_SEXT"
759
  "
760
{
761
  operands[1] = gen_lowpart (SImode, operands[1]);
762
  operands[2] = gen_reg_rtx (SImode); }")
763
 
764
;;
765
;; extendhisi2
766
;;
767
 
768
(define_expand "extendhisi2"
769
  [(use (match_operand:SI 0 "register_operand" ""))
770
   (use (match_operand:HI 1 "nonimmediate_operand" ""))]
771
  ""
772
  "
773
{
774
  if (TARGET_MASK_SEXT)
775
    emit_insn (gen_extendhisi2_sext(operands[0], operands[1]));
776
  else {
777
    if ( GET_CODE(operands[1]) == MEM ) {
778
      emit_insn (gen_extendhisi2_no_sext_mem(operands[0], operands[1]));
779
    }
780
    else {
781
      emit_insn (gen_extendhisi2_no_sext_reg(operands[0], operands[1]));
782
    }
783
 }
784
 DONE;
785
}")
786
 
787
(define_insn "extendhisi2_sext"
788
  [(set (match_operand:SI 0 "register_operand" "=r,r")
789
        (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
790
  "TARGET_MASK_SEXT"
791
  "@
792
   l.exths \t%0,%1\t # extendhisi2_has_signed_extend
793
   l.lhs   \t%0,%1\t # extendhisi2_has_signed_extend"
794
  [(set_attr "length" "1,1")
795
   (set_attr "type" "extend,load")])
796
 
797
(define_insn "extendhisi2_no_sext_mem"
798
  [(set (match_operand:SI 0 "register_operand" "=r")
799
        (sign_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
800
  "!TARGET_MASK_SEXT"
801
  "l.lhs   \t%0,%1\t # extendhisi2_no_sext_mem"
802
  [(set_attr "length" "1")
803
   (set_attr "type" "load")])
804
 
805
(define_expand "extendhisi2_no_sext_reg"
806
  [(set (match_dup 2)
807
        (ashift:SI (match_operand:HI 1 "register_operand" "")
808
                   (const_int 16)))
809
   (set (match_operand:SI 0 "register_operand" "")
810
        (ashiftrt:SI (match_dup 2)
811
                     (const_int 16)))]
812
  "!TARGET_MASK_SEXT"
813
  "
814
{
815
  operands[1] = gen_lowpart (SImode, operands[1]);
816
  operands[2] = gen_reg_rtx (SImode); }")
817
 
818
 
819
;;
820
;; zero_extend2
821
;;
822
 
823
(define_insn "zero_extendqisi2"
824
  [(set (match_operand:SI 0 "register_operand" "=r,r")
825
        (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
826
  ""
827
  "@
828
   l.andi  \t%0,%1,0xff\t # zero_extendqisi2
829
   l.lbz   \t%0,%1\t # zero_extendqisi2"
830
  [(set_attr "type" "logic,load")
831
   (set_attr "length" "1,1")])
832
 
833
 
834
(define_insn "zero_extendhisi2"
835
  [(set (match_operand:SI 0 "register_operand" "=r,r")
836
        (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
837
  ""
838
  "@
839
   l.andi  \t%0,%1,0xffff\t # zero_extendqisi2
840
   l.lhz   \t%0,%1\t # zero_extendqisi2"
841
  [(set_attr "type" "logic,load")
842
   (set_attr "length" "1,1")])
843
 
844
;;
845
;; Shift/rotate operations
846
;;
847
 
848
(define_insn "ashlsi3"
849
  [(set (match_operand:SI 0 "register_operand" "=r,r")
850
        (ashift:SI (match_operand:SI 1 "register_operand" "r,r")
851
                   (match_operand:SI 2 "nonmemory_operand" "r,L")))]
852
  ""
853
  "@
854
   l.sll   \t%0,%1,%2
855
   l.slli  \t%0,%1,%2"
856
  [(set_attr "type" "shift,shift")
857
   (set_attr "length" "1,1")])
858
 
859
(define_insn "ashrsi3"
860
  [(set (match_operand:SI 0 "register_operand" "=r,r")
861
        (ashiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
862
                   (match_operand:SI 2 "nonmemory_operand" "r,L")))]
863
  ""
864
  "@
865
   l.sra   \t%0,%1,%2
866
   l.srai  \t%0,%1,%2"
867
  [(set_attr "type" "shift,shift")
868
   (set_attr "length" "1,1")])
869
 
870
(define_insn "lshrsi3"
871
  [(set (match_operand:SI 0 "register_operand" "=r,r")
872
        (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
873
                   (match_operand:SI 2 "nonmemory_operand" "r,L")))]
874
  ""
875
  "@
876
   l.srl   \t%0,%1,%2
877
   l.srli  \t%0,%1,%2"
878
  [(set_attr "type" "shift,shift")
879
   (set_attr "length" "1,1")])
880
 
881
(define_insn "rotrsi3"
882
  [(set (match_operand:SI 0 "register_operand" "=r,r")
883
        (rotatert:SI (match_operand:SI 1 "register_operand" "r,r")
884
                   (match_operand:SI 2 "nonmemory_operand" "r,L")))]
885
  "TARGET_MASK_ROR"
886
  "@
887
   l.ror   \t%0,%1,%2
888
   l.rori  \t%0,%1,%2"
889
  [(set_attr "type" "shift,shift")
890
   (set_attr "length" "1,1")])
891
 
892
;;
893
;; Logical bitwise operations
894
;;
895
 
896
(define_insn "andsi3"
897
  [(set (match_operand:SI 0 "register_operand" "=r,r")
898
        (and:SI (match_operand:SI 1 "register_operand" "%r,r")
899
                (match_operand:SI 2 "nonmemory_operand" "r,K")))]
900
  ""
901
  "@
902
   l.and   \t%0,%1,%2
903
   l.andi  \t%0,%1,%2"
904
  [(set_attr "type" "logic,logic")
905
   (set_attr "length" "1,1")])
906
 
907
(define_insn "iorsi3"
908
  [(set (match_operand:SI 0 "register_operand" "=r,r")
909
        (ior:SI (match_operand:SI 1 "register_operand" "%r,r")
910
                (match_operand:SI 2 "nonmemory_operand" "r,K")))]
911
  ""
912
  "@
913
   l.or    \t%0,%1,%2
914
   l.ori   \t%0,%1,%2"
915
  [(set_attr "type" "logic,logic")
916
   (set_attr "length" "1,1")])
917
 
918
(define_insn "xorsi3"
919
  [(set (match_operand:SI 0 "register_operand" "=r,r")
920
        (xor:SI (match_operand:SI 1 "register_operand" "%r,r")
921
                (match_operand:SI 2 "nonmemory_operand" "r,I")))]
922
  ""
923
  "@
924
   l.xor   \t%0,%1,%2
925
   l.xori  \t%0,%1,%2"
926
  [(set_attr "type" "logic,logic")
927
   (set_attr "length" "1,1")])
928
 
929
(define_insn "one_cmplqi2"
930
  [(set (match_operand:QI 0 "register_operand" "=r")
931
        (not:QI (match_operand:QI 1 "register_operand" "r")))]
932
  ""
933
  "l.xori  \t%0,%1,0x00ff"
934
  [(set_attr "type" "logic")
935
   (set_attr "length" "1")])
936
 
937
(define_insn "one_cmplsi2"
938
  [(set (match_operand:SI 0 "register_operand" "=r")
939
        (not:SI (match_operand:SI 1 "register_operand" "r")))]
940
  ""
941
  "l.xori  \t%0,%1,0xffff"
942
  [(set_attr "type" "logic")
943
   (set_attr "length" "1")])
944
 
945
;;
946
;; Arithmetic operations
947
;;
948
 
949
(define_insn "negsi2"
950
  [(set (match_operand:SI 0 "register_operand" "=r")
951
        (neg:SI (match_operand:SI 1 "register_operand" "r")))]
952
  ""
953
  "l.sub   \t%0,r0,%1"
954
  [(set_attr "type" "add")
955
   (set_attr "length" "1")])
956
 
957
(define_insn "addsi3"
958
  [(set (match_operand:SI 0 "register_operand" "=r,r")
959
        (plus:SI (match_operand:SI 1 "register_operand" "%r,r")
960
                 (match_operand:SI 2 "nonmemory_operand" "r,I")))]
961
  ""
962
  "@
963
   l.add   \t%0,%1,%2
964
   l.addi  \t%0,%1,%2"
965
  [(set_attr "type" "add,add")
966
   (set_attr "length" "1,1")])
967
 
968
(define_insn "subsi3"
969
  [(set (match_operand:SI 0 "register_operand" "=r,r")
970
        (minus:SI (match_operand:SI 1 "register_operand" "r,r")
971
                  (match_operand:SI 2 "nonmemory_operand" "r,I")))]
972
  ""
973
  "@
974
   l.sub   \t%0,%1,%2
975
   l.addi  \t%0,%1,%n2"
976
  [(set_attr "type" "add,add")]
977
)
978
 
979
;;
980
;; mul and div
981
;;
982
 
983
(define_insn "mulsi3"
984
  [(set (match_operand:SI 0 "register_operand" "=r")
985
        (mult:SI (match_operand:SI 1 "register_operand" "r")
986
                 (match_operand:SI 2 "register_operand" "r")))]
987
  "TARGET_HARD_MUL"
988
  "l.mul   \t%0,%1,%2"
989
  [(set_attr "type" "mul")
990
   (set_attr "length" "1")])
991
 
992
(define_insn "divsi3"
993
  [(set (match_operand:SI 0 "register_operand" "=r")
994
        (div:SI (match_operand:SI 1 "register_operand" "r")
995
                 (match_operand:SI 2 "register_operand" "r")))]
996
  "TARGET_HARD_DIV"
997
  "l.div   \t%0,%1,%2"
998
  [(set_attr "type" "mul")
999
   (set_attr "length" "1")])
1000
 
1001
(define_insn "udivsi3"
1002
  [(set (match_operand:SI 0 "register_operand" "=r")
1003
        (udiv:SI (match_operand:SI 1 "register_operand" "r")
1004
                 (match_operand:SI 2 "register_operand" "r")))]
1005
  "TARGET_HARD_DIV"
1006
  "l.divu  \t%0,%1,%2"
1007
  [(set_attr "type" "mul")
1008
   (set_attr "length" "1")])
1009
 
1010
;;
1011
;; jumps
1012
;;
1013
 
1014
;; jump
1015
 
1016
(define_expand "jump"
1017
  [(set (pc)
1018
        (label_ref (match_operand 0 "" "")))]
1019
  ""
1020
  "
1021
{
1022
  if (!TARGET_MASK_ALIGNED_JUMPS)
1023
    emit_jump_insn (gen_jump_internal (operands[0]));
1024
  else
1025
    emit_jump_insn (gen_jump_aligned (operands[0]));
1026
  DONE;
1027
}")
1028
 
1029
(define_insn "jump_internal"
1030
  [(set (pc)
1031
        (label_ref (match_operand 0 "" "")))]
1032
  "!TARGET_MASK_ALIGNED_JUMPS"
1033
  "l.j     \t%l0%("
1034
  [(set_attr "type" "jump")
1035
   (set_attr "length" "1")])
1036
 
1037
(define_insn "jump_aligned"
1038
  [(set (pc)
1039
        (label_ref (match_operand 0 "" "")))]
1040
  "TARGET_MASK_ALIGNED_JUMPS"
1041
  ".balignl 0x8,0x15000015,0x4\;l.j     \t%l0%("
1042
  [(set_attr "type" "jump")
1043
   (set_attr "length" "1")])
1044
 
1045
;; indirect jump
1046
 
1047
(define_expand "indirect_jump"
1048
  [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
1049
  ""
1050
  "
1051
{
1052
  if (!TARGET_MASK_ALIGNED_JUMPS)
1053
    emit_jump_insn (gen_indirect_jump_internal (operands[0]));
1054
  else
1055
    emit_jump_insn (gen_indirect_jump_aligned (operands[0]));
1056
  DONE;
1057
 
1058
}")
1059
 
1060
(define_insn "indirect_jump_internal"
1061
  [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
1062
  "!TARGET_MASK_ALIGNED_JUMPS"
1063
  "l.jr    \t%0%("
1064
  [(set_attr "type" "jump")
1065
   (set_attr "length" "1")])
1066
 
1067
(define_insn "indirect_jump_aligned"
1068
  [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
1069
  "TARGET_MASK_ALIGNED_JUMPS"
1070
  ".balignl 0x8,0x15000015,0x4\;l.jr    \t%0%("
1071
  [(set_attr "type" "jump")
1072
   (set_attr "length" "1")])
1073
 
1074
;;
1075
;; calls
1076
;;
1077
 
1078
;; call
1079
 
1080
(define_expand "call"
1081
  [(parallel [(call (match_operand:SI 0 "sym_ref_mem_operand" "")
1082
                    (match_operand 1 "" "i"))
1083
              (clobber (reg:SI 9))])]
1084
  ""
1085
  "
1086
{
1087
  if (!TARGET_MASK_ALIGNED_JUMPS)
1088
    emit_call_insn (gen_call_internal (operands[0], operands[1]));
1089
  else
1090
    emit_call_insn (gen_call_aligned (operands[0], operands[1]));
1091
  DONE;
1092
}")
1093
 
1094
(define_insn "call_internal"
1095
[(parallel [(call (match_operand:SI 0 "sym_ref_mem_operand" "")
1096
                  (match_operand 1 "" "i"))
1097
            (clobber (reg:SI 9))])]
1098
  "!TARGET_MASK_ALIGNED_JUMPS"
1099
  "l.jal   \t%S0%("
1100
  [(set_attr "type" "jump")
1101
   (set_attr "length" "1")])
1102
 
1103
(define_insn "call_aligned"
1104
[(parallel [(call (match_operand:SI 0 "sym_ref_mem_operand" "")
1105
                  (match_operand 1 "" "i"))
1106
            (clobber (reg:SI 9))])]
1107
  "TARGET_MASK_ALIGNED_JUMPS"
1108
  ".balignl 0x8,0x15000015,0x4\;l.jal   \t%S0%("
1109
  [(set_attr "type" "jump")
1110
   (set_attr "length" "1")])
1111
 
1112
;; call value
1113
 
1114
(define_expand "call_value"
1115
  [(parallel [(set (match_operand 0 "register_operand" "=r")
1116
                   (call (match_operand:SI 1 "sym_ref_mem_operand" "")
1117
                         (match_operand 2 "" "i")))
1118
              (clobber (reg:SI 9))])]
1119
  ""
1120
  "
1121
{
1122
  if (!TARGET_MASK_ALIGNED_JUMPS)
1123
    emit_call_insn (gen_call_value_internal (operands[0], operands[1], operands[2]));
1124
  else
1125
    emit_call_insn (gen_call_value_aligned (operands[0], operands[1], operands[2]));
1126
  DONE;
1127
}")
1128
 
1129
(define_insn "call_value_internal"
1130
[(parallel [(set (match_operand 0 "register_operand" "=r")
1131
                  (call (match_operand:SI 1 "sym_ref_mem_operand" "")
1132
                        (match_operand 2 "" "i")))
1133
            (clobber (reg:SI 9))])]
1134
  "!TARGET_MASK_ALIGNED_JUMPS"
1135
  "l.jal   \t%S1%("
1136
  [(set_attr "type" "jump")
1137
   (set_attr "length" "1")])
1138
 
1139
(define_insn "call_value_aligned"
1140
[(parallel [(set (match_operand 0 "register_operand" "=r")
1141
                  (call (match_operand:SI 1 "sym_ref_mem_operand" "")
1142
                        (match_operand 2 "" "i")))
1143
            (clobber (reg:SI 9))])]
1144
  "TARGET_MASK_ALIGNED_JUMPS"
1145
  ".balignl 0x8,0x15000015,0x4\;l.jal   \t%S1%("
1146
  [(set_attr "type" "jump")
1147
   (set_attr "length" "1")])
1148
 
1149
;; indirect call value
1150
 
1151
(define_expand "call_value_indirect"
1152
  [(parallel [(set (match_operand 0 "register_operand" "=r")
1153
                   (call (mem:SI (match_operand:SI 1 "register_operand" "r"))
1154
                         (match_operand 2 "" "i")))
1155
              (clobber (reg:SI 9))])]
1156
  ""
1157
  "
1158
{
1159
  if (!TARGET_MASK_ALIGNED_JUMPS)
1160
    emit_call_insn (gen_call_value_indirect_internal (operands[0], operands[1], operands[2]));
1161
  else
1162
    emit_call_insn (gen_call_value_indirect_aligned (operands[0], operands[1], operands[2]));
1163
  DONE;
1164
}")
1165
 
1166
(define_insn "call_value_indirect_internal"
1167
  [(parallel [(set (match_operand 0 "register_operand" "=r")
1168
                   (call (mem:SI (match_operand:SI 1 "register_operand" "r"))
1169
                         (match_operand 2 "" "i")))
1170
              (clobber (reg:SI 9))])]
1171
  "!TARGET_MASK_ALIGNED_JUMPS"
1172
  "l.jalr  \t%1%("
1173
  [(set_attr "type" "jump")
1174
   (set_attr "length" "1")])
1175
 
1176
(define_insn "call_value_indirect_aligned"
1177
  [(parallel [(set (match_operand 0 "register_operand" "=r")
1178
                   (call (mem:SI (match_operand:SI 1 "register_operand" "r"))
1179
                         (match_operand 2 "" "i")))
1180
              (clobber (reg:SI 9))])]
1181
  "TARGET_MASK_ALIGNED_JUMPS"
1182
  ".balignl 0x8,0x15000015,0x4\;l.jalr  \t%1%("
1183
  [(set_attr "type" "jump")
1184
   (set_attr "length" "1")])
1185
 
1186
;; indirect call
1187
 
1188
(define_expand "call_indirect"
1189
  [(parallel [(call (mem:SI (match_operand:SI 0 "register_operand" "r"))
1190
                    (match_operand 1 "" "i"))
1191
              (clobber (reg:SI 9))])]
1192
  ""
1193
  "
1194
{
1195
  if (!TARGET_MASK_ALIGNED_JUMPS)
1196
    emit_call_insn (gen_call_indirect_internal (operands[0], operands[1]));
1197
  else
1198
    emit_call_insn (gen_call_indirect_aligned (operands[0], operands[1]));
1199
  DONE;
1200
}")
1201
 
1202
(define_insn "call_indirect_internal"
1203
[(parallel [(call (mem:SI (match_operand:SI 0 "register_operand" "r"))
1204
                  (match_operand 1 "" "i"))
1205
              (clobber (reg:SI 9))])]
1206
  "!TARGET_MASK_ALIGNED_JUMPS"
1207
  "l.jalr  \t%0%("
1208
  [(set_attr "type" "jump")
1209
   (set_attr "length" "1")])
1210
 
1211
(define_insn "call_indirect_aligned"
1212
[(parallel [(call (mem:SI (match_operand:SI 0 "register_operand" "r"))
1213
                  (match_operand 1 "" "i"))
1214
              (clobber (reg:SI 9))])]
1215
  "TARGET_MASK_ALIGNED_JUMPS"
1216
  ".balignl 0x8,0x15000015,0x4\;l.jalr  \t%0%("
1217
  [(set_attr "type" "jump")
1218
   (set_attr "length" "1")])
1219
 
1220
;; table jump
1221
 
1222
(define_expand "tablejump"
1223
  [(set (pc) (match_operand:SI 0 "register_operand" "r"))
1224
   (use (label_ref (match_operand 1 "" "")))]
1225
   ""
1226
  "
1227
{
1228
  if (!TARGET_MASK_ALIGNED_JUMPS)
1229
    emit_jump_insn (gen_tablejump_internal (operands[0], operands[1]));
1230
  else
1231
    emit_jump_insn (gen_tablejump_aligned (operands[0], operands[1]));
1232
  DONE;
1233
}")
1234
 
1235
(define_insn "tablejump_internal"
1236
  [(set (pc) (match_operand:SI 0 "register_operand" "r"))
1237
   (use (label_ref (match_operand 1 "" "")))]
1238
  "!TARGET_MASK_ALIGNED_JUMPS"
1239
  "l.jr    \t%0%("
1240
  [(set_attr "type" "jump")
1241
   (set_attr "length" "1")])
1242
 
1243
(define_insn "tablejump_aligned"
1244
  [(set (pc) (match_operand:SI 0 "register_operand" "r"))
1245
   (use (label_ref (match_operand 1 "" "")))]
1246
  "TARGET_MASK_ALIGNED_JUMPS"
1247
  ".balignl 0x8,0x15000015,0x4\;l.jr    \t%0%("
1248
  [(set_attr "type" "jump")
1249
   (set_attr "length" "1")])
1250
 
1251
 
1252
;; no-op
1253
 
1254
(define_insn "nop"
1255
  [(const_int 0)]
1256
  ""
1257
  "l.nop"
1258
  [(set_attr "type" "logic")
1259
   (set_attr "length" "1")])
1260
 
1261
;;
1262
;; floating point
1263
;;
1264
 
1265 133 jeremybenn
;; floating point arithmetic
1266
 
1267 38 julius
(define_insn "addsf3"
1268
  [(set (match_operand:SF 0 "register_operand" "=r")
1269
        (plus:SF (match_operand:SF 1 "register_operand" "r")
1270
                 (match_operand:SF 2 "register_operand" "r")))]
1271
  "TARGET_HARD_FLOAT"
1272
  "lf.add.s\t%0,%1,%2"
1273
  [(set_attr "type"     "fp")
1274
   (set_attr "length"   "1")])
1275
 
1276
(define_insn "adddf3"
1277
  [(set (match_operand:DF 0 "register_operand" "=r")
1278
        (plus:DF (match_operand:DF 1 "register_operand" "r")
1279
                 (match_operand:DF 2 "register_operand" "r")))]
1280 133 jeremybenn
  "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1281 38 julius
  "lf.add.d\t%0,%1,%2"
1282
  [(set_attr "type"     "fp")
1283
   (set_attr "length"   "1")])
1284
 
1285
(define_insn "subsf3"
1286
  [(set (match_operand:SF 0 "register_operand" "=r")
1287
        (minus:SF (match_operand:SF 1 "register_operand" "r")
1288
                 (match_operand:SF 2 "register_operand" "r")))]
1289
  "TARGET_HARD_FLOAT"
1290
  "lf.sub.s\t%0,%1,%2"
1291
  [(set_attr "type"     "fp")
1292
   (set_attr "length"   "1")])
1293
 
1294
(define_insn "subdf3"
1295
  [(set (match_operand:DF 0 "register_operand" "=r")
1296
        (minus:DF (match_operand:DF 1 "register_operand" "r")
1297 133 jeremybenn
                  (match_operand:DF 2 "register_operand" "r")))]
1298
  "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1299 38 julius
  "lf.sub.d\t%0,%1,%2"
1300
  [(set_attr "type"     "fp")
1301
   (set_attr "length"   "1")])
1302
 
1303
(define_insn "mulsf3"
1304
  [(set (match_operand:SF 0 "register_operand" "=r")
1305
        (mult:SF (match_operand:SF 1 "register_operand" "r")
1306
                 (match_operand:SF 2 "register_operand" "r")))]
1307
  "TARGET_HARD_FLOAT"
1308
  "lf.mul.s\t%0,%1,%2"
1309
  [(set_attr "type"     "fp")
1310
   (set_attr "length"   "1")])
1311
 
1312
(define_insn "muldf3"
1313
  [(set (match_operand:DF 0 "register_operand" "=r")
1314
        (mult:DF (match_operand:DF 1 "register_operand" "r")
1315
                 (match_operand:DF 2 "register_operand" "r")))]
1316 133 jeremybenn
  "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1317 38 julius
  "lf.mul.d\t%0,%1,%2"
1318
  [(set_attr "type"     "fp")
1319
   (set_attr "length"   "1")])
1320
 
1321
(define_insn "divsf3"
1322
  [(set (match_operand:SF 0 "register_operand" "=r")
1323
        (div:SF (match_operand:SF 1 "register_operand" "r")
1324 133 jeremybenn
                (match_operand:SF 2 "register_operand" "r")))]
1325 38 julius
  "TARGET_HARD_FLOAT"
1326
  "lf.div.s\t%0,%1,%2"
1327
  [(set_attr "type"     "fp")
1328
   (set_attr "length"   "1")])
1329
 
1330
(define_insn "divdf3"
1331
  [(set (match_operand:DF 0 "register_operand" "=r")
1332
        (div:DF (match_operand:DF 1 "register_operand" "r")
1333 133 jeremybenn
                (match_operand:DF 2 "register_operand" "r")))]
1334
  "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1335 38 julius
  "lf.div.d\t%0,%1,%2"
1336
  [(set_attr "type"     "fp")
1337
   (set_attr "length"   "1")])
1338
 
1339 133 jeremybenn
;; Conversion between fixed point and floating point.
1340 38 julius
 
1341 133 jeremybenn
 
1342
(define_insn "floatsisf2"
1343
  [(set (match_operand:SF 0 "register_operand" "=r")
1344
        (float:SF (match_operand:SI 1 "register_operand" "r")))]
1345
  "TARGET_HARD_FLOAT"
1346
  "lf.itof.s\t%0, %1"
1347
  [(set_attr "type" "fp")
1348
   (set_attr "length" "1")])
1349
 
1350
;; not working
1351
(define_insn "fixunssfsi2"
1352
  [(set (match_operand:SI 0 "register_operand" "=r")
1353
        (fix:SI (match_operand:SF 1 "register_operand" "r")))]
1354
  "TARGET_HARD_FLOAT"
1355
  "lf.ftoi.s\t%0, %1"
1356
  [(set_attr "type" "fp")
1357
   (set_attr "length" "1")])
1358
 
1359
 
1360 38 julius
;; Local variables:
1361
;; mode:emacs-lisp
1362
;; comment-start: ";; "
1363
;; eval: (set-syntax-table (copy-sequence (syntax-table)))
1364
;; eval: (modify-syntax-entry ?[ "(]")
1365
;; eval: (modify-syntax-entry ?] ")[")
1366
;; eval: (modify-syntax-entry ?{ "(}")
1367
;; eval: (modify-syntax-entry ?} "){")
1368
;; eval: (setq indent-tabs-mode t)
1369
;; End:

powered by: WebSVN 2.1.0

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