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

Subversion Repositories openrisc_2011-10-31

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

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

Line No. Rev Author Line
1 282 jeremybenn
;;  Machine description for Sunplus S+CORE
2
;;  Copyright (C) 2005, 2007
3
;;  Free Software Foundation, Inc.
4
;;  Contributed by Sunnorth.
5
 
6
;; This file is part of GCC.
7
 
8
;; GCC is free software; you can redistribute it and/or modify
9
;; it under the terms of the GNU General Public License as published by
10
;; the Free Software Foundation; either version 3, or (at your option)
11
;; any later version.
12
 
13
;; GCC is distributed in the hope that it will be useful,
14
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
;; GNU General Public License for more details.
17
 
18
;; You should have received a copy of the GNU General Public License
19
;; along with GCC; see the file COPYING3.  If not see
20
;; .
21
 
22
;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
23
 
24
; branch        conditional branch
25
; jump          unconditional jump
26
; call          unconditional call
27
; load          load instruction(s)
28
; store         store instruction(s)
29
; cmp           integer compare
30
; arith         integer arithmetic instruction
31
; move          data movement within same register set
32
; const         load constant
33
; nop           no operation
34
; mul           integer multiply
35
; div           integer divide
36
; cndmv         conditional moves
37
; fce           transfer from hi/lo registers
38
; tce           transfer to   hi/lo registers
39
; fsr           transfer from special registers
40
; tsr           transfer to   special registers
41
 
42
(define_constants
43
  [(CC_REGNUM       33)
44
   (T_REGNUM        34)
45
   (RA_REGNUM       3)
46
   (SP_REGNUM       0)
47
   (AT_REGNUM       1)
48
   (FP_REGNUM       2)
49
   (RT_REGNUM       4)
50
   (GP_REGNUM       28)
51
   (EH_REGNUM       29)
52
   (HI_REGNUM       48)
53
   (LO_REGNUM       49)
54
   (CN_REGNUM       50)
55
   (LC_REGNUM       51)
56
   (SC_REGNUM       52)])
57
 
58
(define_constants
59
   [(BITTST         0)
60
    (CPLOAD         1)
61
    (CPRESTORE      2)
62
 
63
    (SCB            3)
64
    (SCW            4)
65
    (SCE            5)
66
    (SCLC           6)
67
 
68
    (LCB            7)
69
    (LCW            8)
70
    (LCE            9)
71
 
72
    (SFFS           10)])
73
 
74
(define_attr "type"
75
  "unknown,branch,jump,call,load,store,cmp,arith,move,const,nop,mul,div,cndmv,fce,tce,fsr,tsr,fcr,tcr"
76
  (const_string "unknown"))
77
 
78
(define_attr "mode" "unknown,QI,HI,SI,DI"
79
  (const_string "unknown"))
80
 
81
(define_attr "length" "" (const_int 4))
82
 
83
(define_attr "up_c" "yes,no"
84
  (const_string "no"))
85
 
86
(include "score-generic.md")
87
(include "predicates.md")
88
 
89
(define_expand "movqi"
90
  [(set (match_operand:QI 0 "nonimmediate_operand")
91
        (match_operand:QI 1 "general_operand"))]
92
  ""
93
{
94
  if (MEM_P (operands[0])
95
      && !register_operand (operands[1], QImode))
96
    {
97
      operands[1] = force_reg (QImode, operands[1]);
98
    }
99
})
100
 
101
(define_insn "*movqi_insns_score7"
102
  [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,m,d,*x,d,*a")
103
        (match_operand:QI 1 "general_operand" "i,d,m,d,*x,d,*a,d"))]
104
  "(!MEM_P (operands[0]) || register_operand (operands[1], QImode))
105
   && (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
106
{
107
  switch (which_alternative)
108
    {
109
    case 0: return score_limm (operands);
110
    case 1: return score_move (operands);
111
    case 2: return score_linsn (operands, SCORE_BYTE, false);
112
    case 3: return score_sinsn (operands, SCORE_BYTE);
113
    case 4: return TARGET_SCORE7D ? \"mf%1%S0 %0\" : \"mf%1    %0\";
114
    case 5: return TARGET_SCORE7D ? \"mt%0%S1 %1\" : \"mt%0    %1\";
115
    case 6: return \"mfsr\t%0, %1\";
116
    case 7: return \"mtsr\t%1, %0\";
117
    default: gcc_unreachable ();
118
    }
119
}
120
  [(set_attr "type" "arith,move,load,store,fce,tce,fsr,tsr")
121
   (set_attr "mode" "QI")])
122
 
123
(define_insn "*movqi_insns_score3"
124
  [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,m,d,*x,d,*a")
125
        (match_operand:QI 1 "general_operand" "i,d,m,d,*x,d,*a,d"))]
126
  "(!MEM_P (operands[0]) || register_operand (operands[1], QImode))
127
   && (TARGET_SCORE3)"
128
{
129
  switch (which_alternative)
130
    {
131
    case 0: return score_limm (operands);
132
    case 1: return \"mv!\t%0, %1\";
133
    case 2: return score_linsn (operands, SCORE_BYTE, false);
134
    case 3: return score_sinsn (operands, SCORE_BYTE);
135
    case 4: return TARGET_SCORE3D ? \"mf%1%S0\t%0\" : \"mf%1\t%0\";
136
    case 5: return TARGET_SCORE3D ? \"mt%0%S1\t%1\" : \"mt%0\t%1\";
137
    case 6: return \"mfsr\t%0, %1\";
138
    case 7: return \"mtsr\t%1, %0\";
139
    default: gcc_unreachable ();
140
    }
141
}
142
  [(set_attr "type" "arith,move,load,store,fce,tce,fsr,tsr")
143
   (set_attr "length" "6,2,6,6,4,4,4,4")
144
   (set_attr "mode" "QI")])
145
 
146
(define_expand "movhi"
147
  [(set (match_operand:HI 0 "nonimmediate_operand")
148
        (match_operand:HI 1 "general_operand"))]
149
  ""
150
{
151
  if (MEM_P (operands[0])
152
      && !register_operand (operands[1], HImode))
153
    {
154
      operands[1] = force_reg (HImode, operands[1]);
155
    }
156
})
157
 
158
(define_insn "*movhi_insns_score7"
159
  [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,m,d,*x,d,*a")
160
        (match_operand:HI 1 "general_operand" "i,d,m,d,*x,d,*a,d"))]
161
  "(!MEM_P (operands[0]) || register_operand (operands[1], HImode))
162
   && (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
163
{
164
  switch (which_alternative)
165
    {
166
    case 0: return score_limm (operands);
167
    case 1: return score_move (operands);
168
    case 2: return score_linsn (operands, SCORE_HWORD, false);
169
    case 3: return score_sinsn (operands, SCORE_HWORD);
170
    case 4: return TARGET_SCORE7D ? \"mf%1%S0 %0\" : \"mf%1    %0\";
171
    case 5: return TARGET_SCORE7D ? \"mt%0%S1 %1\" : \"mt%0    %1\";
172
    case 6: return \"mfsr\t%0, %1\";
173
    case 7: return \"mtsr\t%1, %0\";
174
    default: gcc_unreachable ();
175
    }
176
}
177
  [(set_attr "type" "arith,move,load,store,fce,tce,fsr,tsr")
178
   (set_attr "mode" "HI")])
179
 
180
(define_insn "*movhi_insns_score3"
181
  [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,m,d,*x,d,*a")
182
        (match_operand:HI 1 "general_operand" "i,d,m,d,*x,d,*a,d"))]
183
  "(!MEM_P (operands[0]) || register_operand (operands[1], HImode))
184
   && (TARGET_SCORE3)"
185
{
186
  switch (which_alternative)
187
    {
188
    case 0: return score_limm (operands);
189
    case 1: return \"mv!\t%0, %1\";
190
    case 2: return score_linsn (operands, SCORE_HWORD, false);
191
    case 3: return score_sinsn (operands, SCORE_HWORD);
192
    case 4: return TARGET_SCORE3D ? \"mf%1%S0\t%0\" : \"mf%1\t%0\";
193
    case 5: return TARGET_SCORE3D ? \"mt%0%S1\t%1\" : \"mt%0\t%1\";
194
    case 6: return \"mfsr\t%0, %1\";
195
    case 7: return \"mtsr\t%1, %0\";
196
    default: gcc_unreachable ();
197
    }
198
}
199
  [(set_attr "type" "arith,move,load,store,fce,tce,fsr,tsr")
200
   (set_attr "length" "6,2,6,6,4,4,4,4")
201
   (set_attr "mode" "HI")])
202
 
203
(define_expand "movsi"
204
  [(set (match_operand:SI 0 "nonimmediate_operand")
205
        (match_operand:SI 1 "general_operand"))]
206
  ""
207
{
208
  if (MEM_P (operands[0])
209
      && !register_operand (operands[1], SImode))
210
    {
211
      operands[1] = force_reg (SImode, operands[1]);
212
    }
213
})
214
 
215
(define_insn "*movsi_insns_score7"
216
  [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,m,d,*x,d,*a,d,*c")
217
        (match_operand:SI 1 "general_operand" "i,d,m,d,*x,d,*a,d,*c,d"))]
218
  "(!MEM_P (operands[0]) || register_operand (operands[1], SImode))
219
   && (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
220
{
221
  switch (which_alternative)
222
    {
223
    case 0:
224
      if (GET_CODE (operands[1]) != CONST_INT)
225
        return \"la\t%0, %1\";
226
      else
227
        return score_limm (operands);
228
    case 1: return score_move (operands);
229
    case 2: return score_linsn (operands, SCORE_WORD, false);
230
    case 3: return score_sinsn (operands, SCORE_WORD);
231
    case 4: return TARGET_SCORE7D ? \"mf%1%S0 %0\" : \"mf%1    %0\";
232
    case 5: return TARGET_SCORE7D ? \"mt%0%S1 %1\" : \"mt%0    %1\";
233
    case 6: return \"mfsr\t%0, %1\";
234
    case 7: return \"mtsr\t%1, %0\";
235
    case 8: return \"mfcr\t%0, %1\";
236
    case 9: return \"mtcr\t%1, %0\";
237
    default: gcc_unreachable ();
238
    }
239
}
240
  [(set_attr "type" "arith,move,load,store,fce,tce,fsr,tsr,fcr,tcr")
241
   (set_attr "mode" "SI")])
242
 
243
(define_insn "*movsi_insns_score3"
244
  [(set (match_operand:SI 0 "nonimmediate_operand" "=ed,e,d,d,m,d,*x,d,*a")
245
        (match_operand:SI 1 "general_operand" "i,e,d,m,d,*x,d,*a,d"))]
246
  "(!MEM_P (operands[0]) || register_operand (operands[1], SImode))
247
   && (TARGET_SCORE3)"
248
{
249
  switch (which_alternative)
250
    {
251
    case 0:
252
      if (GET_CODE (operands[1]) != CONST_INT)
253
        return \"ldi48\t%0, %1\";
254
      else
255
        return score_limm (operands);
256
    case 1: return \"mv!\t%0, %1\";
257
    case 2: return \"mv!\t%0, %1\";
258
    case 3: return score_linsn (operands, SCORE_WORD, false);
259
    case 4: return score_sinsn (operands, SCORE_WORD);
260
    case 5: return TARGET_SCORE3D ? \"mf%1%S0\t%0\" : \"mf%1\t%0\";
261
    case 6: return TARGET_SCORE3D ? \"mt%0%S1\t%1\" : \"mt%0\t%1\";
262
    case 7: return \"mfsr\t%0, %1\";
263
    case 8: return \"mtsr\t%1, %0\";
264
    default: gcc_unreachable ();
265
    }
266
}
267
  [(set_attr "type" "arith,move,move,load,store,fce,tce,fsr,tsr")
268
   (set_attr "length" "6,2,2,6,6,4,4,4,4")
269
   (set_attr "mode" "SI")])
270
 
271
(define_insn_and_split "movdi"
272
  [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,m,d,*x")
273
        (match_operand:DI 1 "general_operand" "i,d,m,d,*x,d"))]
274
  ""
275
  "#"
276
  "reload_completed"
277
  [(const_int 0)]
278
{
279
  score_movdi (operands);
280
  DONE;
281
})
282
 
283
(define_expand "movsf"
284
  [(set (match_operand:SF 0 "nonimmediate_operand")
285
        (match_operand:SF 1 "general_operand"))]
286
  ""
287
{
288
  if (MEM_P (operands[0])
289
      && !register_operand (operands[1], SFmode))
290
    {
291
      operands[1] = force_reg (SFmode, operands[1]);
292
    }
293
})
294
 
295
(define_insn "*movsf_insns_score7"
296
  [(set (match_operand:SF 0 "nonimmediate_operand" "=d,d,d,m")
297
        (match_operand:SF 1 "general_operand" "i,d,m,d"))]
298
  "(!MEM_P (operands[0]) || register_operand (operands[1], SFmode))
299
   && (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
300
{
301
  switch (which_alternative)
302
    {
303
    case 0: return \"li\t%0, %D1\";;
304
    case 1: return score_move (operands);
305
    case 2: return score_linsn (operands, SCORE_WORD, false);
306
    case 3: return score_sinsn (operands, SCORE_WORD);
307
    default: gcc_unreachable ();
308
    }
309
}
310
  [(set_attr "type" "arith,move,load,store")
311
   (set_attr "mode" "SI")])
312
 
313
(define_insn "*movsf_insns_score3"
314
  [(set (match_operand:SF 0 "nonimmediate_operand" "=d,d,d,m")
315
        (match_operand:SF 1 "general_operand" "i,d,m,d"))]
316
  "(!MEM_P (operands[0]) || register_operand (operands[1], SFmode))
317
   && (TARGET_SCORE3)"
318
{
319
  switch (which_alternative)
320
    {
321
    case 0: return \"li\t%0, %D1\";
322
    case 1: return \"mv!\t%0, %1\";
323
    case 2: return score_linsn (operands, SCORE_WORD, false);
324
    case 3: return score_sinsn (operands, SCORE_WORD);
325
    default: gcc_unreachable ();
326
    }
327
}
328
  [(set_attr "type" "arith,move,load,store")
329
   (set_attr "length" "4,2,6,6")
330
   (set_attr "mode" "SI")])
331
 
332
(define_insn_and_split "movdf"
333
  [(set (match_operand:DF 0 "nonimmediate_operand" "=d,d,d,m")
334
        (match_operand:DF 1 "general_operand" "i,d,m,d"))]
335
  ""
336
  "#"
337
  "reload_completed"
338
  [(const_int 0)]
339
{
340
  score_movdi (operands);
341
  DONE;
342
})
343
 
344
(define_expand "addsi3"
345
  [(set (match_operand:SI 0 "score_register_operand" )
346
        (plus:SI (match_operand:SI 1 "score_register_operand")
347
                 (match_operand:SI 2 "arith_operand")))]
348
  ""
349
  ""
350
)
351
 
352
(define_insn "*addsi3_score7"
353
  [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
354
        (plus:SI (match_operand:SI 1 "register_operand" "0,0,d,d")
355
                 (match_operand:SI 2 "arith_operand" "I,L,N,d")))]
356
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
357
{
358
  switch (which_alternative)
359
    {
360
    case 0: return \"addis\t%0, %U2\";
361
    case 1: return score_select_add_imm (operands, false);
362
    case 2: return \"addri\t%0, %1, %c2\";
363
    case 3: return score_select (operands, "add", true, "", false);
364
    default: gcc_unreachable ();
365
    }
366
}
367
  [(set_attr "type" "arith")
368
   (set_attr "mode" "SI")])
369
 
370
(define_insn "*addsi3_score3"
371
  [(set (match_operand:SI 0 "score_register_operand" "=d,d,d,d")
372
        (plus:SI (match_operand:SI 1 "score_register_operand" "%0,0,d,d")
373
                 (match_operand:SI 2 "arith_operand" "I,L,N,d")))]
374
  "(TARGET_SCORE3)"
375
{
376
  switch (which_alternative)
377
    {
378
    case 0: return \"addis\t%0, %U2\";
379
    case 1: return score_select_add_imm (operands, false);
380
    case 2: return \"addri\t%0, %1, %c2\";
381
    case 3: return score_select (operands, "add", true, "", false);
382
    default: gcc_unreachable ();
383
    }
384
}
385
  [(set_attr "type" "arith")
386
   (set_attr "length" "4,4,4,4")
387
   (set_attr "mode" "SI")])
388
 
389
(define_insn "*addsi3_cmp_score7"
390
  [(set (reg:CC_NZ CC_REGNUM)
391
        (compare:CC_NZ (plus:SI
392
                        (match_operand:SI 1 "register_operand" "0,0,d,d")
393
                        (match_operand:SI 2 "arith_operand" "I,L,N,d"))
394
                       (const_int 0)))
395
   (clobber (match_scratch:SI 0 "=d,d,d,d"))]
396
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
397
{
398
  switch (which_alternative)
399
    {
400
    case 0: return \"addis.c\t%0, %U2\";
401
    case 1: return score_select_add_imm (operands, true);
402
    case 2: return \"addri.c\t%0, %1, %c2\";
403
    case 3: return score_select (operands, "add", true, "", true);
404
    default: gcc_unreachable ();
405
    }
406
}
407
  [(set_attr "type" "arith")
408
   (set_attr "up_c" "yes")
409
   (set_attr "mode" "SI")])
410
 
411
(define_insn "*addsi3_cmp_score3"
412
  [(set (reg:CC_NZ CC_REGNUM)
413
        (compare:CC_NZ (plus:SI
414
                        (match_operand:SI 1 "score_register_operand" "0,0,d,d")
415
                        (match_operand:SI 2 "arith_operand" "I,L,N,d"))
416
                       (const_int 0)))
417
   (clobber (match_scratch:SI 0 "=d,d,d,d"))]
418
  "(TARGET_SCORE3)"
419
{
420
  switch (which_alternative)
421
    {
422
    case 0: return \"addis.c\t%0, %U2\";
423
    case 1: return score_select_add_imm (operands, true);
424
    case 2: return \"addri.c\t%0, %1, %c2\";
425
    case 3: return score_select (operands, "add", true, "", true);
426
    default: gcc_unreachable ();
427
    }
428
}
429
  [(set_attr "type" "arith")
430
   (set_attr "length" "4,4,4,4")
431
   (set_attr "up_c" "yes")
432
   (set_attr "mode" "SI")])
433
 
434
(define_insn "*addsi3_ucc_score7"
435
  [(set (reg:CC_NZ CC_REGNUM)
436
        (compare:CC_NZ (plus:SI
437
                        (match_operand:SI 1 "register_operand" "0,0,d,d")
438
                        (match_operand:SI 2 "arith_operand" "I,L,N,d"))
439
                       (const_int 0)))
440
   (set (match_operand:SI 0 "register_operand" "=d,d,d,d")
441
        (plus:SI (match_dup 1) (match_dup 2)))]
442
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
443
{
444
  switch (which_alternative)
445
    {
446
    case 0: return \"addis.c\t%0, %U2\";
447
    case 1: return score_select_add_imm (operands, true);
448
    case 2: return \"addri.c\t%0, %1, %c2\";
449
    case 3: return score_select (operands, "add", true, "", true);
450
    default: gcc_unreachable ();
451
    }
452
}
453
  [(set_attr "type" "arith")
454
   (set_attr "up_c" "yes")
455
   (set_attr "mode" "SI")])
456
 
457
(define_insn "*addsi3_ucc_score3"
458
  [(set (reg:CC_NZ CC_REGNUM)
459
        (compare:CC_NZ (plus:SI
460
                        (match_operand:SI 1 "score_register_operand" "0,0,d,d")
461
                        (match_operand:SI 2 "arith_operand" "I,L,N,d"))
462
                       (const_int 0)))
463
   (set (match_operand:SI 0 "score_register_operand" "=d,d,d,d")
464
        (plus:SI (match_dup 1) (match_dup 2)))]
465
  "(TARGET_SCORE3)"
466
{
467
  switch (which_alternative)
468
    {
469
    case 0: return \"addis.c\t%0, %U2\";
470
    case 1: return score_select_add_imm (operands, true);
471
    case 2: return \"addri.c\t%0, %1, %c2\";
472
    case 3: return score_select (operands, "add", true, "", true);
473
    default: gcc_unreachable ();
474
    }
475
}
476
  [(set_attr "type" "arith")
477
   (set_attr "length" "4,4,4,4")
478
   (set_attr "up_c" "yes")
479
   (set_attr "mode" "SI")])
480
 
481
(define_expand "adddi3"
482
  [(parallel
483
    [(set (match_operand:DI 0 "score_register_operand")
484
          (plus:DI (match_operand:DI 1 "score_register_operand")
485
                   (match_operand:DI 2 "score_register_operand")))
486
    (clobber (reg:CC CC_REGNUM))])]
487
  ""
488
  ""
489
)
490
 
491
(define_insn "*adddi3_score7"
492
  [(set (match_operand:DI 0 "register_operand" "=e,d")
493
        (plus:DI (match_operand:DI 1 "register_operand" "0,d")
494
                 (match_operand:DI 2 "register_operand" "e,d")))
495
  (clobber (reg:CC CC_REGNUM))]
496
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
497
  "@
498
   add!    %L0, %L2\;addc!   %H0, %H2
499
   add.c   %L0, %L1, %L2\;addc    %H0, %H1, %H2"
500
  [(set_attr "type" "arith")
501
   (set_attr "mode" "DI")])
502
 
503
(define_insn "*adddi3_score3"
504
  [(set (match_operand:DI 0 "score_register_operand" "=d")
505
        (plus:DI (match_operand:DI 1 "score_register_operand" "d")
506
                 (match_operand:DI 2 "score_register_operand" "d")))
507
  (clobber (reg:CC CC_REGNUM))]
508
  "(TARGET_SCORE3)"
509
  "add.c\t%L0, %L1, %L2\;addc\t%H0, %H1, %H2"
510
  [(set_attr "type" "arith")
511
   (set_attr "length" "8")
512
   (set_attr "mode" "DI")])
513
 
514
(define_expand "subsi3"
515
  [(set (match_operand:SI 0 "score_register_operand")
516
        (minus:SI (match_operand:SI 1 "score_register_operand")
517
                  (match_operand:SI 2 "score_register_operand")))]
518
  ""
519
  ""
520
)
521
 
522
(define_insn "*subsi3_score7"
523
  [(set (match_operand:SI 0 "register_operand" "=d")
524
        (minus:SI (match_operand:SI 1 "register_operand" "d")
525
                  (match_operand:SI 2 "register_operand" "d")))]
526
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
527
{
528
  return score_select (operands, "sub", false, "", false);
529
}
530
  [(set_attr "type" "arith")
531
   (set_attr "mode" "SI")])
532
 
533
(define_insn "*subsi3_score3"
534
  [(set (match_operand:SI 0 "score_register_operand" "=e,d")
535
        (minus:SI (match_operand:SI 1 "score_register_operand" "0,d")
536
                  (match_operand:SI 2 "score_register_operand" "e,d")))]
537
  "(TARGET_SCORE3)"
538
{
539
  switch (which_alternative)
540
    {
541
    case 0: return \"sub!\t%0, %2\";
542
    case 1: return score_select (operands, "sub", false, "", false);
543
    default: gcc_unreachable ();
544
    }
545
}
546
  [(set_attr "type" "arith")
547
   (set_attr "length" "2,4")
548
   (set_attr "mode" "SI")])
549
 
550
(define_insn "*subsi3_cmp_score7"
551
  [(set (reg:CC_NZ CC_REGNUM)
552
        (compare:CC_NZ (minus:SI (match_operand:SI 1 "register_operand" "d")
553
                                 (match_operand:SI 2 "register_operand" "d"))
554
                       (const_int 0)))
555
   (clobber (match_scratch:SI 0 "=d"))]
556
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
557
{
558
  return score_select (operands, "sub", false, "", true);
559
}
560
  [(set_attr "type" "arith")
561
   (set_attr "up_c" "yes")
562
   (set_attr "mode" "SI")])
563
 
564
(define_insn "*subsi3_cmp_score3"
565
  [(set (reg:CC_NZ CC_REGNUM)
566
        (compare:CC_NZ (minus:SI (match_operand:SI 1 "score_register_operand" "d")
567
                                 (match_operand:SI 2 "score_register_operand" "d"))
568
                       (const_int 0)))
569
   (clobber (match_scratch:SI 0 "=d"))]
570
  "(TARGET_SCORE3)"
571
{
572
  return score_select (operands, "sub", false, "", true);
573
}
574
  [(set_attr "type" "arith")
575
   (set_attr "length" "4")
576
   (set_attr "up_c" "yes")
577
   (set_attr "mode" "SI")])
578
 
579
(define_peephole2
580
  [(set (match_operand:SI 0 "g32reg_operand" "")
581
        (minus:SI (match_operand:SI 1 "g32reg_operand" "")
582
                  (match_operand:SI 2 "g32reg_operand" "")))
583
   (set (reg:CC CC_REGNUM)
584
        (compare:CC (match_dup 1) (match_dup 2)))]
585
  ""
586
  [(set (reg:CC CC_REGNUM)
587
        (compare:CC (match_dup 1) (match_dup 2)))
588
   (set (match_dup 0)
589
        (minus:SI (match_dup 1) (match_dup 2)))])
590
 
591
(define_insn "subsi3_ucc_pcmp"
592
  [(parallel
593
    [(set (reg:CC CC_REGNUM)
594
          (compare:CC (match_operand:SI 1 "score_register_operand" "d")
595
                      (match_operand:SI 2 "score_register_operand" "d")))
596
     (set (match_operand:SI 0 "score_register_operand" "=d")
597
          (minus:SI (match_dup 1) (match_dup 2)))])]
598
  ""
599
{
600
  return score_select (operands, "sub", false, "", true);
601
}
602
  [(set_attr "type" "arith")
603
   (set_attr "length" "4")
604
   (set_attr "up_c" "yes")
605
   (set_attr "mode" "SI")])
606
 
607
(define_insn "subsi3_ucc"
608
  [(set (reg:CC_NZ CC_REGNUM)
609
        (compare:CC_NZ (minus:SI (match_operand:SI 1 "score_register_operand" "d")
610
                                 (match_operand:SI 2 "score_register_operand" "d"))
611
                       (const_int 0)))
612
   (set (match_operand:SI 0 "score_register_operand" "=d")
613
        (minus:SI (match_dup 1) (match_dup 2)))]
614
  ""
615
{
616
  return score_select (operands, "sub", false, "", true);
617
}
618
  [(set_attr "type" "arith")
619
   (set_attr "length" "4")
620
   (set_attr "up_c" "yes")
621
   (set_attr "mode" "SI")])
622
 
623
(define_expand "subdi3"
624
  [(parallel
625
    [(set (match_operand:DI 0 "score_register_operand")
626
          (minus:DI (match_operand:DI 1 "score_register_operand")
627
                    (match_operand:DI 2 "score_register_operand")))
628
     (clobber (reg:CC CC_REGNUM))])]
629
  ""
630
  ""
631
)
632
 
633
(define_insn "*subdi3_score7"
634
  [(set (match_operand:DI 0 "register_operand" "=e,d")
635
        (minus:DI (match_operand:DI 1 "register_operand" "0,d")
636
                  (match_operand:DI 2 "register_operand" "e,d")))
637
   (clobber (reg:CC CC_REGNUM))]
638
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
639
  "@
640
   sub!    %L0, %L2\;subc    %H0, %H1, %H2
641
   sub.c   %L0, %L1, %L2\;subc    %H0, %H1, %H2"
642
  [(set_attr "type" "arith")
643
   (set_attr "mode" "DI")])
644
 
645
(define_insn "*subdi3_score3"
646
  [(set (match_operand:DI 0 "score_register_operand" "=d")
647
        (minus:DI (match_operand:DI 1 "score_register_operand" "d")
648
                  (match_operand:DI 2 "score_register_operand" "d")))
649
   (clobber (reg:CC CC_REGNUM))]
650
  "(TARGET_SCORE3)"
651
  "sub.c\t%L0, %L1, %L2\;subc\t%H0, %H1, %H2"
652
  [(set_attr "type" "arith")
653
   (set_attr "length" "8")
654
   (set_attr "mode" "DI")])
655
 
656
(define_expand "andsi3"
657
  [(set (match_operand:SI 0 "score_register_operand")
658
        (and:SI (match_operand:SI 1 "score_register_operand")
659
                (match_operand:SI 2 "arith_operand")))]
660
  ""
661
  ""
662
)
663
 
664
(define_insn "*andsi3_score7"
665
  [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
666
        (and:SI (match_operand:SI 1 "register_operand" "0,0,d,d")
667
                (match_operand:SI 2 "arith_operand" "I,K,M,d")))]
668
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
669
{
670
  switch (which_alternative)
671
    {
672
    case 0: return \"andis\t%0, %U2\";
673
    case 1: return \"andi\t%0, %c2";
674
    case 2: return \"andri\t%0, %1, %c2\";
675
    case 3: return score_select (operands, "and", true, "", false);
676
    default: gcc_unreachable ();
677
    }
678
}
679
  [(set_attr "type" "arith")
680
   (set_attr "mode" "SI")])
681
 
682
(define_insn "*andsi3_score3"
683
  [(set (match_operand:SI 0 "score_register_operand" "=e,d,d,d,d")
684
        (and:SI (match_operand:SI 1 "score_register_operand" "%0,0,0,d,d")
685
                (match_operand:SI 2 "arith_operand" "e,I,K,M,d")))]
686
  "(TARGET_SCORE3)"
687
{
688
  switch (which_alternative)
689
    {
690
    case 0: return \"and!\t%0, %2\";
691
    case 1: return \"andis\t%0, %U2\";
692
    case 2: return \"andi\t%0, %c2";
693
    case 3: return \"andri\t%0, %1, %c2\";
694
    case 4: return score_select (operands, "and", true, "", false);
695
    default: gcc_unreachable ();
696
    }
697
}
698
  [(set_attr "type" "arith")
699
   (set_attr "length" "2,4,4,4,4")
700
   (set_attr "mode" "SI")])
701
 
702
(define_insn "andsi3_cmp_score7"
703
  [(set (reg:CC_NZ CC_REGNUM)
704
        (compare:CC_NZ (and:SI (match_operand:SI 1 "register_operand" "0,0,0,d")
705
                               (match_operand:SI 2 "arith_operand" "I,K,M,d"))
706
                       (const_int 0)))
707
   (clobber (match_scratch:SI 0 "=d,d,d,d"))]
708
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
709
{
710
  switch (which_alternative)
711
    {
712
    case 0: return \"andis.c\t%0, %U2\";
713
    case 1: return \"andi.c\t%0, %c2";
714
    case 2: return \"andri.c\t%0, %1, %c2\";
715
    case 3: return score_select (operands, "and", true, "", true);
716
    default: gcc_unreachable ();
717
    }
718
}
719
  [(set_attr "type" "arith")
720
   (set_attr "up_c" "yes")
721
   (set_attr "mode" "SI")])
722
 
723
(define_insn "andsi3_cmp_score3"
724
  [(set (reg:CC_NZ CC_REGNUM)
725
        (compare:CC_NZ (and:SI (match_operand:SI 1 "score_register_operand" "0,0,0,d")
726
                               (match_operand:SI 2 "arith_operand" "I,K,M,d"))
727
                       (const_int 0)))
728
   (clobber (match_scratch:SI 0 "=d,d,d,d"))]
729
  ""
730
{
731
  switch (which_alternative)
732
    {
733
    case 0: return \"andis.c\t%0, %U2\";
734
    case 1: return \"andi.c\t%0, %c2";
735
    case 2: return \"andri.c\t%0, %1, %c2\";
736
    case 3: return score_select (operands, "and", true, "", true);
737
    default: gcc_unreachable ();
738
    }
739
}
740
  [(set_attr "type" "arith")
741
   (set_attr "length" "4,4,4,4")
742
   (set_attr "up_c" "yes")
743
   (set_attr "mode" "SI")])
744
 
745
(define_insn "*andsi3_ucc_score7"
746
  [(set (reg:CC_NZ CC_REGNUM)
747
        (compare:CC_NZ (and:SI
748
                        (match_operand:SI 1 "register_operand" "0,0,d,d")
749
                        (match_operand:SI 2 "arith_operand" "I,K,M,d"))
750
                       (const_int 0)))
751
   (set (match_operand:SI 0 "register_operand" "=d,d,d,d")
752
        (and:SI (match_dup 1) (match_dup 2)))]
753
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
754
{
755
  switch (which_alternative)
756
    {
757
    case 0: return \"andis.c\t%0, %U2\";
758
    case 1: return \"andi.c\t%0, %c2";
759
    case 2: return \"andri.c\t%0, %1, %c2\";
760
    case 3: return score_select (operands, "and", true, "", true);
761
    default: gcc_unreachable ();
762
    }
763
}
764
  [(set_attr "type" "arith")
765
   (set_attr "up_c" "yes")
766
   (set_attr "mode" "SI")])
767
 
768
(define_insn "*andsi3_ucc_score3"
769
  [(set (reg:CC_NZ CC_REGNUM)
770
        (compare:CC_NZ (and:SI
771
                        (match_operand:SI 1 "score_register_operand" "0,0,d,d")
772
                        (match_operand:SI 2 "arith_operand" "I,K,M,d"))
773
                       (const_int 0)))
774
   (set (match_operand:SI 0 "score_register_operand" "=d,d,d,d")
775
        (and:SI (match_dup 1) (match_dup 2)))]
776
  "(TARGET_SCORE3)"
777
{
778
  switch (which_alternative)
779
    {
780
    case 0: return \"andis.c\t%0, %U2\";
781
    case 1: return \"andi.c\t%0, %c2";
782
    case 2: return \"andri.c\t%0, %1, %c2\";
783
    case 3: return score_select (operands, "and", true, "", true);
784
    default: gcc_unreachable ();
785
    }
786
}
787
  [(set_attr "type" "arith")
788
   (set_attr "length" "4,4,4,4")
789
   (set_attr "up_c" "yes")
790
   (set_attr "mode" "SI")])
791
 
792
 
793
(define_insn_and_split "*zero_extract_andi"
794
  [(set (reg:CC CC_REGNUM)
795
        (compare:CC (zero_extract:SI
796
                     (match_operand:SI 0 "score_register_operand" "d")
797
                     (match_operand:SI 1 "const_uimm5" "")
798
                     (match_operand:SI 2 "const_uimm5" ""))
799
                    (const_int 0)))]
800
  ""
801
  "#"
802
  ""
803
  [(const_int 1)]
804
{
805
  score_zero_extract_andi (operands);
806
  DONE;
807
})
808
 
809
(define_expand "iorsi3"
810
  [(set (match_operand:SI 0 "score_register_operand")
811
        (ior:SI (match_operand:SI 1 "score_register_operand")
812
                (match_operand:SI 2 "arith_operand")))]
813
  ""
814
  ""
815
)
816
 
817
(define_insn "*iorsi3_score7"
818
  [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
819
        (ior:SI (match_operand:SI 1 "register_operand" "0,0,d,d")
820
                (match_operand:SI 2 "arith_operand" "I,K,M,d")))]
821
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
822
{
823
  switch (which_alternative)
824
    {
825
    case 0: return \"oris\t%0, %U2\";
826
    case 1: return \"ori\t%0, %c2\";
827
    case 2: return \"orri\t%0, %1, %c2\";
828
    case 3: return score_select (operands, "or", true, "", false);
829
    default: gcc_unreachable ();
830
    }
831
}
832
  [(set_attr "type" "arith")
833
   (set_attr "mode" "SI")])
834
 
835
(define_insn "*iorsi3_score3"
836
  [(set (match_operand:SI 0 "score_register_operand" "=e,d,d,d,d")
837
        (ior:SI (match_operand:SI 1 "score_register_operand" "%0,0,0,d,d")
838
                (match_operand:SI 2 "arith_operand" "e,I,K,M,d")))]
839
  "(TARGET_SCORE3)"
840
{
841
  switch (which_alternative)
842
    {
843
    case 0: return \"or!\t%0, %2\";
844
    case 1: return \"oris\t%0, %U2\";
845
    case 2: return \"ori\t%0, %c2\";
846
    case 3: return \"orri\t%0, %1, %c2\";
847
    case 4: return score_select (operands, "or", true, "", false);
848
    default: gcc_unreachable ();
849
    }
850
}
851
  [(set_attr "type" "arith")
852
   (set_attr "length" "2,4,4,4,4")
853
   (set_attr "mode" "SI")])
854
 
855
(define_insn "*iorsi3_ucc_score7"
856
  [(set (reg:CC_NZ CC_REGNUM)
857
        (compare:CC_NZ (ior:SI
858
                        (match_operand:SI 1 "register_operand" "0,0,d,d")
859
                        (match_operand:SI 2 "arith_operand" "I,K,M,d"))
860
                       (const_int 0)))
861
   (set (match_operand:SI 0 "register_operand" "=d,d,d,d")
862
        (ior:SI (match_dup 1) (match_dup 2)))]
863
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
864
{
865
  switch (which_alternative)
866
    {
867
    case 0: return \"oris.c\t%0, %U2\";
868
    case 1: return \"ori.c\t%0, %c2\";
869
    case 2: return \"orri.c\t%0, %1, %c2\";
870
    case 3: return score_select (operands, "or", true, "", true);
871
    default: gcc_unreachable ();
872
    }
873
}
874
  [(set_attr "type" "arith")
875
   (set_attr "up_c" "yes")
876
   (set_attr "mode" "SI")])
877
 
878
(define_insn "*iorsi3_ucc_score3"
879
  [(set (reg:CC_NZ CC_REGNUM)
880
        (compare:CC_NZ (ior:SI
881
                        (match_operand:SI 1 "score_register_operand" "0,0,d,d")
882
                        (match_operand:SI 2 "arith_operand" "I,K,M,d"))
883
                       (const_int 0)))
884
   (set (match_operand:SI 0 "score_register_operand" "=d,d,d,d")
885
        (ior:SI (match_dup 1) (match_dup 2)))]
886
  "(TARGET_SCORE3)"
887
{
888
  switch (which_alternative)
889
    {
890
    case 0: return \"oris.c\t%0, %U2\";
891
    case 1: return \"ori.c\t%0, %c2\";
892
    case 2: return \"orri.c\t%0, %1, %c2\";
893
    case 3: return score_select (operands, "or", true, "", true);
894
    default: gcc_unreachable ();
895
    }
896
}
897
  [(set_attr "type" "arith")
898
   (set_attr "length" "4,4,4,4")
899
   (set_attr "up_c" "yes")
900
   (set_attr "mode" "SI")])
901
 
902
(define_insn "*iorsi3_cmp_score7"
903
  [(set (reg:CC_NZ CC_REGNUM)
904
        (compare:CC_NZ (ior:SI
905
                        (match_operand:SI 1 "register_operand" "0,0,d,d")
906
                        (match_operand:SI 2 "arith_operand" "I,K,M,d"))
907
                       (const_int 0)))
908
   (clobber (match_scratch:SI 0 "=d,d,d,d"))]
909
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
910
{
911
  switch (which_alternative)
912
    {
913
    case 0: return \"oris.c\t%0, %U2\";
914
    case 1: return \"ori.c\t%0, %c2\";
915
    case 2: return \"orri.c\t%0, %1, %c2\";
916
    case 3: return score_select (operands, "or", true, "", true);
917
    default: gcc_unreachable ();
918
    }
919
}
920
  [(set_attr "type" "arith")
921
   (set_attr "up_c" "yes")
922
   (set_attr "mode" "SI")])
923
 
924
(define_insn "*iorsi3_cmp_score3"
925
  [(set (reg:CC_NZ CC_REGNUM)
926
        (compare:CC_NZ (ior:SI
927
                        (match_operand:SI 1 "score_register_operand" "0,0,d,d")
928
                        (match_operand:SI 2 "arith_operand" "I,K,M,d"))
929
                       (const_int 0)))
930
   (clobber (match_scratch:SI 0 "=d,d,d,d"))]
931
  "(TARGET_SCORE3)"
932
{
933
  switch (which_alternative)
934
    {
935
    case 0: return \"oris.c\t%0, %U2\";
936
    case 1: return \"ori.c\t%0, %c2\";
937
    case 2: return \"orri.c\t%0, %1, %c2\";
938
    case 3: return score_select (operands, "or", true, "", true);
939
    default: gcc_unreachable ();
940
    }
941
}
942
  [(set_attr "type" "arith")
943
   (set_attr "length" "4,4,4,4")
944
   (set_attr "up_c" "yes")
945
   (set_attr "mode" "SI")])
946
 
947
(define_expand "xorsi3"
948
  [(set (match_operand:SI 0 "score_register_operand")
949
        (xor:SI (match_operand:SI 1 "score_register_operand")
950
                (match_operand:SI 2 "score_register_operand")))]
951
  ""
952
  ""
953
)
954
 
955
(define_insn "*xorsi3_score7"
956
  [(set (match_operand:SI 0 "register_operand" "=d")
957
        (xor:SI (match_operand:SI 1 "register_operand" "d")
958
                (match_operand:SI 2 "register_operand" "d")))]
959
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
960
{
961
  return score_select (operands, "xor", true, "", false);
962
}
963
  [(set_attr "type" "arith")
964
   (set_attr "mode" "SI")])
965
 
966
(define_insn "*xorsi3_score3"
967
  [(set (match_operand:SI 0 "score_register_operand" "=d")
968
        (xor:SI (match_operand:SI 1 "score_register_operand" "d")
969
                (match_operand:SI 2 "score_register_operand" "d")))]
970
  "(TARGET_SCORE3)"
971
{
972
  return score_select (operands, "xor", true, "", false);
973
}
974
  [(set_attr "type" "arith")
975
   (set_attr "length" "4")
976
   (set_attr "mode" "SI")])
977
 
978
 
979
(define_insn "*xorsi3_ucc_score7"
980
  [(set (reg:CC_NZ CC_REGNUM)
981
        (compare:CC_NZ (xor:SI (match_operand:SI 1 "register_operand" "d")
982
                               (match_operand:SI 2 "register_operand" "d"))
983
                       (const_int 0)))
984
   (set (match_operand:SI 0 "register_operand" "=d")
985
        (xor:SI (match_dup 1) (match_dup 2)))]
986
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
987
{
988
  return score_select (operands, "xor", true, "", true);
989
}
990
  [(set_attr "type" "arith")
991
   (set_attr "up_c" "yes")
992
   (set_attr "mode" "SI")])
993
 
994
(define_insn "*xorsi3_ucc_score3"
995
  [(set (reg:CC_NZ CC_REGNUM)
996
        (compare:CC_NZ (xor:SI (match_operand:SI 1 "score_register_operand" "d")
997
                               (match_operand:SI 2 "score_register_operand" "d"))
998
                       (const_int 0)))
999
   (set (match_operand:SI 0 "score_register_operand" "=d")
1000
        (xor:SI (match_dup 1) (match_dup 2)))]
1001
  "(TARGET_SCORE3)"
1002
{
1003
  return score_select (operands, "xor", true, "", true);
1004
}
1005
  [(set_attr "type" "arith")
1006
   (set_attr "length" "4")
1007
   (set_attr "up_c" "yes")
1008
   (set_attr "mode" "SI")])
1009
 
1010
 
1011
(define_insn "*xorsi3_cmp_score7"
1012
  [(set (reg:CC_NZ CC_REGNUM)
1013
        (compare:CC_NZ (xor:SI (match_operand:SI 1 "register_operand" "d")
1014
                               (match_operand:SI 2 "register_operand" "d"))
1015
                       (const_int 0)))
1016
   (clobber (match_scratch:SI 0 "=d"))]
1017
  ""
1018
{
1019
  return score_select (operands, "xor", true, "", true);
1020
}
1021
  [(set_attr "type" "arith")
1022
   (set_attr "up_c" "yes")
1023
   (set_attr "mode" "SI")])
1024
 
1025
(define_insn "*xorsi3_cmp_score3"
1026
  [(set (reg:CC_NZ CC_REGNUM)
1027
        (compare:CC_NZ (xor:SI (match_operand:SI 1 "score_register_operand" "d")
1028
                               (match_operand:SI 2 "score_register_operand" "d"))
1029
                       (const_int 0)))
1030
   (clobber (match_scratch:SI 0 "=d"))]
1031
  ""
1032
{
1033
  return score_select (operands, "xor", true, "", true);
1034
}
1035
  [(set_attr "type" "arith")
1036
   (set_attr "length" "4")
1037
   (set_attr "up_c" "yes")
1038
   (set_attr "mode" "SI")])
1039
 
1040
(define_expand "extendqisi2"
1041
  [(set (match_operand:SI 0 "score_register_operand")
1042
        (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand")))]
1043
  ""
1044
  ""
1045
)
1046
 
1047
(define_insn "*extendqisi2_score7"
1048
  [(set (match_operand:SI 0 "register_operand" "=d,d")
1049
        (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
1050
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1051
{
1052
  switch (which_alternative)
1053
    {
1054
    case 0: return \"extsb\t%0, %1\";
1055
    case 1: return score_linsn (operands, SCORE_BYTE, true);
1056
    default: gcc_unreachable ();
1057
    }
1058
}
1059
  [(set_attr "type" "arith,load")
1060
   (set_attr "mode" "SI")])
1061
 
1062
(define_insn "*extendqisi2_score3"
1063
  [(set (match_operand:SI 0 "score_register_operand" "=d,d")
1064
        (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
1065
  "(TARGET_SCORE3)"
1066
{
1067
  switch (which_alternative)
1068
    {
1069
    case 0: return \"extsb\t%0, %1\";
1070
    case 1: return score_linsn (operands, SCORE_BYTE, true);
1071
    default: gcc_unreachable ();
1072
    }
1073
}
1074
  [(set_attr "type" "arith,load")
1075
   (set_attr "length" "4,4")
1076
   (set_attr "mode" "SI")])
1077
 
1078
(define_insn "*extendqisi2_ucc_score7"
1079
  [(set (reg:CC_N CC_REGNUM)
1080
        (compare:CC_N (ashiftrt:SI
1081
                       (ashift:SI (match_operand:SI 1 "register_operand" "d")
1082
                                  (const_int 24))
1083
                       (const_int 24))
1084
                      (const_int 0)))
1085
   (set (match_operand:SI 0 "register_operand" "=d")
1086
        (sign_extend:SI (match_operand:QI 2 "register_operand" "0")))]
1087
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1088
  "extsb.c %0, %1"
1089
  [(set_attr "type" "arith")
1090
   (set_attr "up_c" "yes")
1091
   (set_attr "mode" "SI")])
1092
 
1093
(define_insn "*extendqisi2_ucc_score3"
1094
  [(set (reg:CC_N CC_REGNUM)
1095
        (compare:CC_N (ashiftrt:SI
1096
                       (ashift:SI (match_operand:SI 1 "score_register_operand" "d")
1097
                                  (const_int 24))
1098
                       (const_int 24))
1099
                      (const_int 0)))
1100
   (set (match_operand:SI 0 "score_register_operand" "=d")
1101
        (sign_extend:SI (match_operand:QI 2 "score_register_operand" "0")))]
1102
  "(TARGET_SCORE3)"
1103
  "extsb.c\t%0, %1"
1104
  [(set_attr "type" "arith")
1105
   (set_attr "length" "4")
1106
   (set_attr "up_c" "yes")
1107
   (set_attr "mode" "SI")])
1108
 
1109
(define_insn "*extendqisi2_cmp_score7"
1110
  [(set (reg:CC_N CC_REGNUM)
1111
        (compare:CC_N (ashiftrt:SI
1112
                       (ashift:SI (match_operand:SI 1 "register_operand" "d")
1113
                                  (const_int 24))
1114
                       (const_int 24))
1115
                      (const_int 0)))
1116
   (clobber (match_scratch:SI 0 "=d"))]
1117
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1118
  "extsb.c %0, %1"
1119
  [(set_attr "type" "arith")
1120
   (set_attr "up_c" "yes")
1121
   (set_attr "mode" "SI")])
1122
 
1123
(define_insn "*extendqisi2_cmp_score3"
1124
  [(set (reg:CC_N CC_REGNUM)
1125
        (compare:CC_N (ashiftrt:SI
1126
                       (ashift:SI (match_operand:SI 1 "score_register_operand" "d")
1127
                                  (const_int 24))
1128
                       (const_int 24))
1129
                      (const_int 0)))
1130
   (clobber (match_scratch:SI 0 "=d"))]
1131
  "(TARGET_SCORE3)"
1132
  "extsb.c\t%0, %1"
1133
  [(set_attr "type" "arith")
1134
   (set_attr "length" "4")
1135
   (set_attr "up_c" "yes")
1136
   (set_attr "mode" "SI")])
1137
 
1138
(define_expand "extendhisi2"
1139
  [(set (match_operand:SI 0 "score_register_operand")
1140
        (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand")))]
1141
  ""
1142
  ""
1143
)
1144
 
1145
(define_insn "*extendhisi2_score7"
1146
  [(set (match_operand:SI 0 "register_operand" "=d,d")
1147
        (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d,m")))]
1148
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1149
{
1150
  switch (which_alternative)
1151
    {
1152
    case 0: return \"extsh\t%0, %1\";
1153
    case 1: return score_linsn (operands, SCORE_HWORD, true);
1154
    default: gcc_unreachable ();
1155
    }
1156
}
1157
  [(set_attr "type" "arith, load")
1158
   (set_attr "mode" "SI")])
1159
 
1160
(define_insn "*extendhisi2_score3"
1161
  [(set (match_operand:SI 0 "score_register_operand" "=d,d")
1162
        (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d,m")))]
1163
  "(TARGET_SCORE3)"
1164
{
1165
  switch (which_alternative)
1166
    {
1167
    case 0: return \"extsh\t%0, %1\";
1168
    case 1: return score_linsn (operands, SCORE_HWORD, true);
1169
    default: gcc_unreachable ();
1170
    }
1171
}
1172
  [(set_attr "type" "arith, load")
1173
   (set_attr "length" "4,4")
1174
   (set_attr "mode" "SI")])
1175
 
1176
(define_insn "*extendhisi2_ucc_score7"
1177
  [(set (reg:CC_N CC_REGNUM)
1178
        (compare:CC_N (ashiftrt:SI
1179
                       (ashift:SI (match_operand:SI 1 "register_operand" "d")
1180
                                  (const_int 16))
1181
                       (const_int 16))
1182
                      (const_int 0)))
1183
  (set (match_operand:SI 0 "register_operand" "=d")
1184
       (sign_extend:SI (match_operand:HI 2 "register_operand" "0")))]
1185
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1186
  "extsh.c %0, %1"
1187
  [(set_attr "type" "arith")
1188
   (set_attr "up_c" "yes")
1189
   (set_attr "mode" "SI")])
1190
 
1191
(define_insn "*extendhisi2_ucc_score3"
1192
  [(set (reg:CC_N CC_REGNUM)
1193
        (compare:CC_N (ashiftrt:SI
1194
                       (ashift:SI (match_operand:SI 1 "score_register_operand" "d")
1195
                                  (const_int 16))
1196
                       (const_int 16))
1197
                      (const_int 0)))
1198
  (set (match_operand:SI 0 "score_register_operand" "=d")
1199
       (sign_extend:SI (match_operand:HI 2 "score_register_operand" "0")))]
1200
  "(TARGET_SCORE3)"
1201
  "extsh.c\t%0, %1"
1202
  [(set_attr "type" "arith")
1203
   (set_attr "length" "4")
1204
   (set_attr "up_c" "yes")
1205
   (set_attr "mode" "SI")])
1206
 
1207
(define_insn "*extendhisi2_cmp_score7"
1208
  [(set (reg:CC_N CC_REGNUM)
1209
        (compare:CC_N (ashiftrt:SI
1210
                       (ashift:SI (match_operand:SI 1 "register_operand" "d")
1211
                                  (const_int 16))
1212
                       (const_int 16))
1213
                      (const_int 0)))
1214
   (clobber (match_scratch:SI 0 "=d"))]
1215
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1216
  "extsh.c %0, %1"
1217
  [(set_attr "type" "arith")
1218
   (set_attr "up_c" "yes")
1219
   (set_attr "mode" "SI")])
1220
 
1221
(define_insn "*extendhisi2_cmp_score3"
1222
  [(set (reg:CC_N CC_REGNUM)
1223
        (compare:CC_N (ashiftrt:SI
1224
                       (ashift:SI (match_operand:SI 1 "score_register_operand" "d")
1225
                                  (const_int 16))
1226
                       (const_int 16))
1227
                      (const_int 0)))
1228
   (clobber (match_scratch:SI 0 "=d"))]
1229
  "(TARGET_SCORE3)"
1230
  "extsh.c\t%0, %1"
1231
  [(set_attr "type" "arith")
1232
   (set_attr "length" "4")
1233
   (set_attr "up_c" "yes")
1234
   (set_attr "mode" "SI")])
1235
 
1236
(define_expand "zero_extendqisi2"
1237
  [(set (match_operand:SI 0 "score_register_operand")
1238
        (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand")))]
1239
  ""
1240
  ""
1241
)
1242
 
1243
(define_insn "*zero_extendqisi2_score7"
1244
  [(set (match_operand:SI 0 "register_operand" "=d,d")
1245
        (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
1246
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1247
{
1248
  switch (which_alternative)
1249
    {
1250
    case 0: return \"extzb\t%0, %1\";
1251
    case 1: return score_linsn (operands, SCORE_BYTE, false);
1252
    default: gcc_unreachable ();
1253
    }
1254
}
1255
  [(set_attr "type" "arith, load")
1256
   (set_attr "mode" "SI")])
1257
 
1258
(define_insn "*zero_extendqisi2_score3"
1259
  [(set (match_operand:SI 0 "score_register_operand" "=d,d")
1260
        (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
1261
  "(TARGET_SCORE3)"
1262
{
1263
  switch (which_alternative)
1264
    {
1265
    case 0: return \"extzb\t%0, %1\";
1266
    case 1: return score_linsn (operands, SCORE_BYTE, false);
1267
    default: gcc_unreachable ();
1268
    }
1269
}
1270
  [(set_attr "type" "arith, load")
1271
   (set_attr "length" "4,4")
1272
   (set_attr "mode" "SI")])
1273
 
1274
(define_insn "*zero_extendqisi2_ucc_score7"
1275
  [(set (reg:CC_N CC_REGNUM)
1276
        (compare:CC_N (lshiftrt:SI
1277
                       (ashift:SI (match_operand:SI 1 "register_operand" "d")
1278
                                  (const_int 24))
1279
                       (const_int 24))
1280
                      (const_int 0)))
1281
   (set (match_operand:SI 0 "register_operand" "=d")
1282
        (zero_extend:SI (match_operand:QI 2 "register_operand" "0")))]
1283
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1284
  "extzb.c %0, %1"
1285
  [(set_attr "type" "arith")
1286
   (set_attr "up_c" "yes")
1287
   (set_attr "mode" "SI")])
1288
 
1289
(define_insn "*zero_extendqisi2_ucc_score3"
1290
  [(set (reg:CC_N CC_REGNUM)
1291
        (compare:CC_N (lshiftrt:SI
1292
                       (ashift:SI (match_operand:SI 1 "score_register_operand" "d")
1293
                                  (const_int 24))
1294
                       (const_int 24))
1295
                      (const_int 0)))
1296
   (set (match_operand:SI 0 "score_register_operand" "=d")
1297
        (zero_extend:SI (match_operand:QI 2 "score_register_operand" "0")))]
1298
  "(TARGET_SCORE3)"
1299
  "extzb.c\t%0, %1"
1300
  [(set_attr "type" "arith")
1301
   (set_attr "length" "4")
1302
   (set_attr "up_c" "yes")
1303
   (set_attr "mode" "SI")])
1304
 
1305
(define_insn "*zero_extendqisi2_cmp_score7"
1306
  [(set (reg:CC_N CC_REGNUM)
1307
        (compare:CC_N (lshiftrt:SI
1308
                       (ashift:SI (match_operand:SI 1 "register_operand" "d")
1309
                                  (const_int 24))
1310
                       (const_int 24))
1311
                      (const_int 0)))
1312
   (clobber (match_scratch:SI 0 "=d"))]
1313
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1314
  "extzb.c %0, %1"
1315
  [(set_attr "type" "arith")
1316
   (set_attr "up_c" "yes")
1317
   (set_attr "mode" "SI")])
1318
 
1319
(define_insn "*zero_extendqisi2_cmp_score3"
1320
  [(set (reg:CC_N CC_REGNUM)
1321
        (compare:CC_N (lshiftrt:SI
1322
                       (ashift:SI (match_operand:SI 1 "score_register_operand" "d")
1323
                                  (const_int 24))
1324
                       (const_int 24))
1325
                      (const_int 0)))
1326
   (clobber (match_scratch:SI 0 "=d"))]
1327
  "(TARGET_SCORE3)"
1328
  "extzb.c\t%0, %1"
1329
  [(set_attr "type" "arith")
1330
   (set_attr "length" "4")
1331
   (set_attr "up_c" "yes")
1332
   (set_attr "mode" "SI")])
1333
 
1334
(define_expand "zero_extendhisi2"
1335
  [(set (match_operand:SI 0 "score_register_operand")
1336
        (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand")))]
1337
  ""
1338
  ""
1339
)
1340
 
1341
(define_insn "*zero_extendhisi2_score7"
1342
  [(set (match_operand:SI 0 "register_operand" "=d,d")
1343
        (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d,m")))]
1344
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1345
{
1346
  switch (which_alternative)
1347
    {
1348
    case 0: return \"extzh\t%0, %1\";
1349
    case 1: return score_linsn (operands, SCORE_HWORD, false);
1350
    default: gcc_unreachable ();
1351
    }
1352
}
1353
  [(set_attr "type" "arith, load")
1354
   (set_attr "mode" "SI")])
1355
 
1356
(define_insn "*zero_extendhisi2_score3"
1357
  [(set (match_operand:SI 0 "score_register_operand" "=d,d")
1358
        (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d,m")))]
1359
  "(TARGET_SCORE3)"
1360
{
1361
  switch (which_alternative)
1362
    {
1363
    case 0: return \"extzh\t%0, %1\";
1364
    case 1: return score_linsn (operands, SCORE_HWORD, false);
1365
    default: gcc_unreachable ();
1366
    }
1367
}
1368
  [(set_attr "type" "arith, load")
1369
   (set_attr "length" "4,4")
1370
   (set_attr "mode" "SI")])
1371
 
1372
(define_insn "*zero_extendhisi2_ucc_score7"
1373
  [(set (reg:CC_N CC_REGNUM)
1374
        (compare:CC_N (lshiftrt:SI
1375
                       (ashift:SI (match_operand:SI 1 "register_operand" "d")
1376
                                  (const_int 16))
1377
                       (const_int 16))
1378
                      (const_int 0)))
1379
  (set (match_operand:SI 0 "register_operand" "=d")
1380
       (zero_extend:SI (match_operand:HI 2 "register_operand" "0")))]
1381
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1382
  "extzh.c %0, %1"
1383
  [(set_attr "type" "arith")
1384
   (set_attr "up_c" "yes")
1385
   (set_attr "mode" "SI")])
1386
 
1387
(define_insn "*zero_extendhisi2_ucc_score3"
1388
  [(set (reg:CC_N CC_REGNUM)
1389
        (compare:CC_N (lshiftrt:SI
1390
                       (ashift:SI (match_operand:SI 1 "score_register_operand" "d")
1391
                                  (const_int 16))
1392
                       (const_int 16))
1393
                      (const_int 0)))
1394
  (set (match_operand:SI 0 "score_register_operand" "=d")
1395
       (zero_extend:SI (match_operand:HI 2 "score_register_operand" "0")))]
1396
  "(TARGET_SCORE3)"
1397
  "extzh.c\t%0, %1"
1398
  [(set_attr "type" "arith")
1399
   (set_attr "length" "4")
1400
   (set_attr "up_c" "yes")
1401
   (set_attr "mode" "SI")])
1402
 
1403
(define_insn "*zero_extendhisi2_cmp_score7"
1404
  [(set (reg:CC_N CC_REGNUM)
1405
        (compare:CC_N (lshiftrt:SI
1406
                       (ashift:SI (match_operand:SI 1 "register_operand" "d")
1407
                                  (const_int 16))
1408
                       (const_int 16))
1409
                      (const_int 0)))
1410
   (clobber (match_scratch:SI 0 "=d"))]
1411
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1412
  "extzh.c %0, %1"
1413
  [(set_attr "type" "arith")
1414
   (set_attr "up_c" "yes")
1415
   (set_attr "mode" "SI")])
1416
 
1417
(define_insn "*zero_extendhisi2_cmp_score3"
1418
  [(set (reg:CC_N CC_REGNUM)
1419
        (compare:CC_N (lshiftrt:SI
1420
                       (ashift:SI (match_operand:SI 1 "score_register_operand" "d")
1421
                                  (const_int 16))
1422
                       (const_int 16))
1423
                      (const_int 0)))
1424
   (clobber (match_scratch:SI 0 "=d"))]
1425
  "(TARGET_SCORE3)"
1426
  "extzh.c\t%0, %1"
1427
  [(set_attr "type" "arith")
1428
   (set_attr "length" "4")
1429
   (set_attr "up_c" "yes")
1430
   (set_attr "mode" "SI")])
1431
 
1432
(define_expand "mulsi3"
1433
    [(set (match_operand:SI 0 "score_register_operand")
1434
          (mult:SI (match_operand:SI 1 "score_register_operand")
1435
                   (match_operand:SI 2 "score_register_operand")))]
1436
  ""
1437
{
1438
  if (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)
1439
    emit_insn (gen_mulsi3_score7 (operands[0], operands[1], operands[2]));
1440
  else if (TARGET_SCORE3)
1441
    emit_insn (gen_mulsi3_score3 (operands[0], operands[1], operands[2]));
1442
  DONE;
1443
})
1444
 
1445
(define_insn "mulsi3_score7"
1446
  [(set (match_operand:SI 0 "register_operand" "=l")
1447
        (mult:SI (match_operand:SI 1 "register_operand" "d")
1448
                 (match_operand:SI 2 "register_operand" "d")))
1449
   (clobber (reg:SI HI_REGNUM))]
1450
  "(TARGET_SCORE5 || TARGET_SCORE7 || TARGET_SCORE7D)"
1451
  "mul     %1, %2"
1452
  [(set_attr "type" "mul")
1453
   (set_attr "mode" "SI")])
1454
 
1455
(define_insn "mulsi3_score3"
1456
  [(set (match_operand:SI 0 "score_register_operand" "=d")
1457
        (mult:SI (match_operand:SI 1 "score_register_operand" "d")
1458
                 (match_operand:SI 2 "score_register_operand" "d")))]
1459
  "(TARGET_SCORE3)"
1460
  "mulr.l\t%0, %1, %2"
1461
  [(set_attr "type" "mul")
1462
   (set_attr "length" "4")
1463
   (set_attr "mode" "SI")])
1464
 
1465
(define_expand "mulsidi3"
1466
    [(set (match_operand:DI 0 "score_register_operand")
1467
          (mult:DI (sign_extend:DI
1468
                    (match_operand:SI 1 "score_register_operand"))
1469
                   (sign_extend:DI
1470
                    (match_operand:SI 2 "score_register_operand"))))]
1471
  ""
1472
{
1473
  if (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)
1474
    emit_insn (gen_mulsidi3_score7 (operands[0], operands[1], operands[2]));
1475
  else if (TARGET_SCORE3)
1476
    emit_insn (gen_mulsidi3_score3 (operands[0], operands[1], operands[2]));
1477
  DONE;
1478
})
1479
 
1480
(define_insn "mulsidi3_score7"
1481
  [(set (match_operand:DI 0 "register_operand" "=x")
1482
        (mult:DI (sign_extend:DI
1483
                  (match_operand:SI 1 "register_operand" "d"))
1484
                 (sign_extend:DI
1485
                  (match_operand:SI 2 "register_operand" "d"))))]
1486
  "(TARGET_SCORE5 || TARGET_SCORE7 || TARGET_SCORE7D)"
1487
  "mul     %1, %2"
1488
  [(set_attr "type" "mul")
1489
   (set_attr "mode" "DI")])
1490
 
1491
(define_insn "mulsidi3_score3"
1492
  [(set (match_operand:DI 0 "score_register_operand" "=d")
1493
        (mult:DI (sign_extend:DI
1494
                  (match_operand:SI 1 "score_register_operand" "d"))
1495
                 (sign_extend:DI
1496
                  (match_operand:SI 2 "score_register_operand" "d"))))]
1497
  "(TARGET_SCORE3)"
1498
  "mulr\t%0, %1, %2"
1499
  [(set_attr "type" "mul")
1500
   (set_attr "length" "4")
1501
   (set_attr "mode" "DI")])
1502
 
1503
(define_expand "umulsidi3"
1504
  [(set (match_operand:DI 0 "score_register_operand")
1505
        (mult:DI (zero_extend:DI
1506
                  (match_operand:SI 1 "score_register_operand"))
1507
                 (zero_extend:DI
1508
                  (match_operand:SI 2 "score_register_operand"))))]
1509
  ""
1510
{
1511
  if (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)
1512
    emit_insn (gen_umulsidi3_score7 (operands[0], operands[1], operands[2]));
1513
  else if (TARGET_SCORE3)
1514
    emit_insn (gen_umulsidi3_score3 (operands[0], operands[1], operands[2]));
1515
  DONE;
1516
})
1517
 
1518
(define_insn "umulsidi3_score7"
1519
  [(set (match_operand:DI 0 "register_operand" "=x")
1520
        (mult:DI (zero_extend:DI
1521
                  (match_operand:SI 1 "register_operand" "d"))
1522
                 (zero_extend:DI
1523
                  (match_operand:SI 2 "register_operand" "d"))))]
1524
  "(TARGET_SCORE5 || TARGET_SCORE7 || TARGET_SCORE7D)"
1525
  "mulu    %1, %2"
1526
  [(set_attr "type" "mul")
1527
   (set_attr "mode" "DI")])
1528
 
1529
(define_insn "umulsidi3_score3"
1530
  [(set (match_operand:DI 0 "score_register_operand" "=d")
1531
        (mult:DI (zero_extend:DI
1532
                  (match_operand:SI 1 "score_register_operand" "d"))
1533
                 (zero_extend:DI
1534
                  (match_operand:SI 2 "score_register_operand" "d"))))]
1535
  "(TARGET_SCORE3)"
1536
  "mulur\t%0, %1, %2"
1537
  [(set_attr "type" "mul")
1538
   (set_attr "length" "4")
1539
   (set_attr "mode" "DI")])
1540
 
1541
(define_expand "divmodsi4"
1542
  [(parallel
1543
    [(set (match_operand:SI 0 "score_register_operand")
1544
          (div:SI (match_operand:SI 1 "score_register_operand")
1545
                  (match_operand:SI 2 "score_register_operand")))
1546
     (set (match_operand:SI 3 "score_register_operand")
1547
          (mod:SI (match_dup 1) (match_dup 2)))])]
1548
  ""
1549
  ""
1550
)
1551
 
1552
(define_insn "*divmodsi4_score7"
1553
  [(set (match_operand:SI 0 "register_operand" "=l")
1554
        (div:SI (match_operand:SI 1 "register_operand" "d")
1555
                (match_operand:SI 2 "register_operand" "d")))
1556
   (set (match_operand:SI 3 "register_operand" "=h")
1557
        (mod:SI (match_dup 1) (match_dup 2)))]
1558
  "(TARGET_SCORE5 || TARGET_SCORE7 || TARGET_SCORE7D)"
1559
  "div     %1, %2"
1560
  [(set_attr "type" "div")
1561
   (set_attr "mode" "SI")])
1562
 
1563
(define_insn "*divmodsi4_score3"
1564
  [(set (match_operand:SI 0 "score_register_operand" "=l")
1565
        (div:SI (match_operand:SI 1 "score_register_operand" "d")
1566
                (match_operand:SI 2 "score_register_operand" "d")))
1567
   (set (match_operand:SI 3 "score_register_operand" "=h")
1568
        (mod:SI (match_dup 1) (match_dup 2)))]
1569
  "(TARGET_SCORE3)"
1570
  "div\t%1, %2"
1571
  [(set_attr "type" "div")
1572
   (set_attr "mode" "SI")])
1573
 
1574
(define_expand "udivmodsi4"
1575
  [(parallel
1576
    [(set (match_operand:SI 0 "score_register_operand")
1577
          (udiv:SI (match_operand:SI 1 "score_register_operand")
1578
                   (match_operand:SI 2 "score_register_operand")))
1579
     (set (match_operand:SI 3 "score_register_operand")
1580
          (umod:SI (match_dup 1) (match_dup 2)))])]
1581
  ""
1582
  ""
1583
)
1584
 
1585
(define_insn "*udivmodsi4_score7"
1586
  [(set (match_operand:SI 0 "register_operand" "=l")
1587
        (udiv:SI (match_operand:SI 1 "register_operand" "d")
1588
                 (match_operand:SI 2 "register_operand" "d")))
1589
   (set (match_operand:SI 3 "register_operand" "=h")
1590
        (umod:SI (match_dup 1) (match_dup 2)))]
1591
  "(TARGET_SCORE5 || TARGET_SCORE7 || TARGET_SCORE7D)"
1592
  "divu    %1, %2"
1593
  [(set_attr "type" "div")
1594
   (set_attr "mode" "SI")])
1595
 
1596
(define_insn "*udivmodsi4_score3"
1597
  [(set (match_operand:SI 0 "score_register_operand" "=l")
1598
        (udiv:SI (match_operand:SI 1 "score_register_operand" "d")
1599
                 (match_operand:SI 2 "score_register_operand" "d")))
1600
   (set (match_operand:SI 3 "score_register_operand" "=h")
1601
        (umod:SI (match_dup 1) (match_dup 2)))]
1602
  "(TARGET_SCORE3)"
1603
  "divu\t%1, %2"
1604
  [(set_attr "type" "div")
1605
   (set_attr "mode" "SI")])
1606
 
1607
(define_expand "ashlsi3"
1608
  [(set (match_operand:SI 0 "score_register_operand")
1609
        (ashift:SI (match_operand:SI 1 "score_register_operand")
1610
                   (match_operand:SI 2 "arith_operand")))]
1611
  ""
1612
  ""
1613
)
1614
 
1615
(define_insn "*ashlsi3_score7"
1616
  [(set (match_operand:SI 0 "register_operand" "=d,d")
1617
        (ashift:SI (match_operand:SI 1 "register_operand" "d,d")
1618
                   (match_operand:SI 2 "arith_operand" "J,d")))]
1619
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1620
  "@
1621
   slli    %0, %1, %c2
1622
   sll     %0, %1, %2"
1623
  [(set_attr "type" "arith")
1624
   (set_attr "mode" "SI")])
1625
 
1626
(define_insn "*ashlsi3_score3"
1627
  [(set (match_operand:SI 0 "score_register_operand" "=e,d,d")
1628
        (ashift:SI (match_operand:SI 1 "score_register_operand" "0,d,d")
1629
                   (match_operand:SI 2 "arith_operand" "J,J,d")))]
1630
  "(TARGET_SCORE3)"
1631
  "@
1632
   slli!\t%0, %c2
1633
   slli\t%0, %1, %c2
1634
   sll\t%0, %1, %2"
1635
  [(set_attr "type" "arith")
1636
   (set_attr "length" "2,4,4")
1637
   (set_attr "mode" "SI")])
1638
 
1639
(define_insn "*ashlsi3_ucc_score7"
1640
  [(set (reg:CC_NZ CC_REGNUM)
1641
        (compare:CC_NZ (ashift:SI
1642
                        (match_operand:SI 1 "register_operand" "d,d")
1643
                        (match_operand:SI 2 "arith_operand" "J,d"))
1644
                       (const_int 0)))
1645
   (set (match_operand:SI 0 "register_operand" "=d,d")
1646
        (ashift:SI (match_dup 1) (match_dup 2)))]
1647
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1648
{
1649
  switch (which_alternative)
1650
    {
1651
    case 0: return score_select (operands, "slli", false, "c", true);
1652
    case 1: return score_select (operands, "sll", false, "", true);
1653
    default: gcc_unreachable ();
1654
    }
1655
}
1656
  [(set_attr "type" "arith")
1657
   (set_attr "up_c" "yes")
1658
   (set_attr "mode" "SI")])
1659
 
1660
(define_insn "*ashlsi3_ucc_score3"
1661
  [(set (reg:CC_NZ CC_REGNUM)
1662
        (compare:CC_NZ (ashift:SI
1663
                        (match_operand:SI 1 "score_register_operand" "d,d")
1664
                        (match_operand:SI 2 "arith_operand" "J,d"))
1665
                       (const_int 0)))
1666
   (set (match_operand:SI 0 "score_register_operand" "=d,d")
1667
        (ashift:SI (match_dup 1) (match_dup 2)))]
1668
  "(TARGET_SCORE3)"
1669
{
1670
  switch (which_alternative)
1671
    {
1672
    case 0: return score_select (operands, "slli", false, "c", true);
1673
    case 1: return score_select (operands, "sll", false, "", true);
1674
    default: gcc_unreachable ();
1675
    }
1676
}
1677
  [(set_attr "type" "arith")
1678
   (set_attr "length" "4,4")
1679
   (set_attr "up_c" "yes")
1680
   (set_attr "mode" "SI")])
1681
 
1682
(define_insn "*ashlsi3_cmp_score7"
1683
  [(set (reg:CC_NZ CC_REGNUM)
1684
        (compare:CC_NZ (ashift:SI
1685
                        (match_operand:SI 1 "register_operand" "d,d")
1686
                        (match_operand:SI 2 "arith_operand" "J,d"))
1687
                       (const_int 0)))
1688
   (clobber (match_scratch:SI 0 "=d,d"))]
1689
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1690
{
1691
  switch (which_alternative)
1692
    {
1693
    case 0: return score_select (operands, "slli", false, "c", true);
1694
    case 1: return score_select (operands, "sll", false, "", true);
1695
    default: gcc_unreachable ();
1696
    }
1697
}
1698
  [(set_attr "type" "arith")
1699
   (set_attr "up_c" "yes")
1700
   (set_attr "mode" "SI")])
1701
 
1702
(define_insn "*ashlsi3_cmp_score3"
1703
  [(set (reg:CC_NZ CC_REGNUM)
1704
        (compare:CC_NZ (ashift:SI
1705
                        (match_operand:SI 1 "score_register_operand" "d,d")
1706
                        (match_operand:SI 2 "arith_operand" "J,d"))
1707
                       (const_int 0)))
1708
   (clobber (match_scratch:SI 0 "=d,d"))]
1709
  "(TARGET_SCORE3)"
1710
{
1711
  switch (which_alternative)
1712
    {
1713
    case 0: return score_select (operands, "slli", false, "c", true);
1714
    case 1: return score_select (operands, "sll", false, "", true);
1715
    default: gcc_unreachable ();
1716
    }
1717
}
1718
  [(set_attr "type" "arith")
1719
   (set_attr "length" "4,4")
1720
   (set_attr "up_c" "yes")
1721
   (set_attr "mode" "SI")])
1722
 
1723
 
1724
(define_expand "ashrsi3"
1725
  [(set (match_operand:SI 0 "score_register_operand")
1726
        (ashiftrt:SI (match_operand:SI 1 "score_register_operand")
1727
                     (match_operand:SI 2 "arith_operand")))]
1728
  ""
1729
  ""
1730
)
1731
 
1732
(define_insn "*ashrsi3_score7"
1733
  [(set (match_operand:SI 0 "register_operand" "=d,d")
1734
        (ashiftrt:SI (match_operand:SI 1 "register_operand" "d,d")
1735
                     (match_operand:SI 2 "arith_operand" "J,d")))]
1736
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1737
  "@
1738
   srai    %0, %1, %c2
1739
   sra     %0, %1, %2"
1740
  [(set_attr "type" "arith")
1741
   (set_attr "mode" "SI")])
1742
 
1743
(define_insn "*ashrsi3_score3"
1744
  [(set (match_operand:SI 0 "score_register_operand" "=d,d")
1745
        (ashiftrt:SI (match_operand:SI 1 "score_register_operand" "d,d")
1746
                     (match_operand:SI 2 "arith_operand" "J,d")))]
1747
  "(TARGET_SCORE3)"
1748
  "@
1749
   srai\t%0, %1, %c2
1750
   sra\t%0, %1, %2"
1751
  [(set_attr "type" "arith")
1752
   (set_attr "length" "4,4")
1753
   (set_attr "mode" "SI")])
1754
 
1755
(define_insn "*ashrsi3_ucc_score7"
1756
  [(set (reg:CC_NZ CC_REGNUM)
1757
        (compare:CC_NZ (ashiftrt:SI
1758
                        (match_operand:SI 1 "register_operand" "d,d")
1759
                        (match_operand:SI 2 "arith_operand" "J,d"))
1760
                       (const_int 0)))
1761
   (set (match_operand:SI 0 "register_operand" "=d,d")
1762
        (ashiftrt:SI (match_dup 1) (match_dup 2)))]
1763
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1764
{
1765
  switch (which_alternative)
1766
    {
1767
    case 0: return \"srai.c\t%0, %1, %c2\";
1768
    case 1: return score_select (operands, "sra", false, "", true);
1769
    default: gcc_unreachable ();
1770
    }
1771
}
1772
  [(set_attr "type" "arith")
1773
   (set_attr "up_c" "yes")
1774
   (set_attr "mode" "SI")])
1775
 
1776
(define_insn "*ashrsi3_ucc_score3"
1777
  [(set (reg:CC_NZ CC_REGNUM)
1778
        (compare:CC_NZ (ashiftrt:SI
1779
                        (match_operand:SI 1 "score_register_operand" "d,d")
1780
                        (match_operand:SI 2 "arith_operand" "J,d"))
1781
                       (const_int 0)))
1782
   (set (match_operand:SI 0 "score_register_operand" "=d,d")
1783
        (ashiftrt:SI (match_dup 1) (match_dup 2)))]
1784
  "(TARGET_SCORE3)"
1785
{
1786
  switch (which_alternative)
1787
    {
1788
    case 0: return \"srai.c\t%0, %1, %c2\";
1789
    case 1: return score_select (operands, "sra", false, "", true);
1790
    default: gcc_unreachable ();
1791
    }
1792
}
1793
  [(set_attr "type" "arith")
1794
   (set_attr "length" "4,4")
1795
   (set_attr "up_c" "yes")
1796
   (set_attr "mode" "SI")])
1797
 
1798
(define_insn "*ashrsi3_cmp_score7"
1799
  [(set (reg:CC_NZ CC_REGNUM)
1800
        (compare:CC_NZ (ashiftrt:SI
1801
                        (match_operand:SI 1 "register_operand" "d,d")
1802
                        (match_operand:SI 2 "arith_operand" "J,d"))
1803
                       (const_int 0)))
1804
   (clobber (match_scratch:SI 0 "=d,d"))]
1805
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1806
{
1807
  switch (which_alternative)
1808
    {
1809
    case 0: return \"srai.c\t%0, %1, %c2\";
1810
    case 1: return score_select (operands, "sra", false, "", true);
1811
    default: gcc_unreachable ();
1812
    }
1813
}
1814
  [(set_attr "type" "arith")
1815
   (set_attr "up_c" "yes")
1816
   (set_attr "mode" "SI")])
1817
 
1818
(define_insn "ashrsi3_cmp_score3"
1819
  [(set (reg:CC_NZ CC_REGNUM)
1820
        (compare:CC_NZ (ashiftrt:SI
1821
                        (match_operand:SI 1 "score_register_operand" "d,d")
1822
                        (match_operand:SI 2 "arith_operand" "J,d"))
1823
                       (const_int 0)))
1824
   (clobber (match_scratch:SI 0 "=d,d"))]
1825
  "(TARGET_SCORE3)"
1826
{
1827
  switch (which_alternative)
1828
    {
1829
    case 0: return \"srai.c\t%0, %1, %c2\";
1830
    case 1: return score_select (operands, "sra", false, "", true);
1831
    default: gcc_unreachable ();
1832
    }
1833
}
1834
  [(set_attr "type" "arith")
1835
   (set_attr "length" "4,4")
1836
   (set_attr "up_c" "yes")
1837
   (set_attr "mode" "SI")])
1838
 
1839
(define_expand "lshrsi3"
1840
  [(set (match_operand:SI 0 "score_register_operand")
1841
        (lshiftrt:SI (match_operand:SI 1 "score_register_operand")
1842
                     (match_operand:SI 2 "arith_operand")))]
1843
  ""
1844
  ""
1845
)
1846
 
1847
(define_insn "*lshrsi3_score7"
1848
  [(set (match_operand:SI 0 "register_operand" "=d,d")
1849
        (lshiftrt:SI (match_operand:SI 1 "register_operand" "d,d")
1850
                     (match_operand:SI 2 "arith_operand" "J,d")))]
1851
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1852
  "@
1853
   srli    %0, %1, %c2
1854
   srl     %0, %1, %2"
1855
  [(set_attr "type" "arith")
1856
   (set_attr "mode" "SI")])
1857
 
1858
(define_insn "*lshrsi3_score3"
1859
  [(set (match_operand:SI 0 "score_register_operand" "=e,d,d")
1860
        (lshiftrt:SI (match_operand:SI 1 "score_register_operand" "0,d,d")
1861
                     (match_operand:SI 2 "arith_operand" "J,J,d")))]
1862
  "(TARGET_SCORE3)"
1863
  "@
1864
   srli!\t%0, %c2
1865
   srli\t%0, %1, %c2
1866
   srl\t%0, %1, %2"
1867
  [(set_attr "type" "arith")
1868
   (set_attr "length" "2,4,4")
1869
   (set_attr "mode" "SI")])
1870
 
1871
(define_insn "*lshrsi3_ucc_score7"
1872
  [(set (reg:CC_NZ CC_REGNUM)
1873
        (compare:CC_NZ (lshiftrt:SI
1874
                        (match_operand:SI 1 "register_operand" "d,d")
1875
                        (match_operand:SI 2 "arith_operand" "J,d"))
1876
                       (const_int 0)))
1877
   (set (match_operand:SI 0 "register_operand" "=d,d")
1878
        (lshiftrt:SI (match_dup 1) (match_dup 2)))]
1879
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1880
{
1881
  switch (which_alternative)
1882
    {
1883
    case 0: return score_select (operands, "srli", false, "c", true);
1884
    case 1: return score_select (operands, "srl", false, "", true);
1885
    default: gcc_unreachable ();
1886
    }
1887
}
1888
  [(set_attr "type" "arith")
1889
   (set_attr "up_c" "yes")
1890
   (set_attr "mode" "SI")])
1891
 
1892
(define_insn "*lshrsi3_ucc_score3"
1893
  [(set (reg:CC_NZ CC_REGNUM)
1894
        (compare:CC_NZ (lshiftrt:SI
1895
                        (match_operand:SI 1 "score_register_operand" "d,d")
1896
                        (match_operand:SI 2 "arith_operand" "J,d"))
1897
                       (const_int 0)))
1898
   (set (match_operand:SI 0 "score_register_operand" "=d,d")
1899
        (lshiftrt:SI (match_dup 1) (match_dup 2)))]
1900
  "(TARGET_SCORE3)"
1901
{
1902
  switch (which_alternative)
1903
    {
1904
    case 0: return score_select (operands, "srli", false, "c", true);
1905
    case 1: return score_select (operands, "srl", false, "", true);
1906
    default: gcc_unreachable ();
1907
    }
1908
}
1909
  [(set_attr "type" "arith")
1910
   (set_attr "length" "4,4")
1911
   (set_attr "up_c" "yes")
1912
   (set_attr "mode" "SI")])
1913
 
1914
(define_insn "*lshrsi3_cmp_score7"
1915
  [(set (reg:CC_NZ CC_REGNUM)
1916
        (compare:CC_NZ (lshiftrt:SI
1917
                        (match_operand:SI 1 "register_operand" "d,d")
1918
                        (match_operand:SI 2 "arith_operand" "J,d"))
1919
                       (const_int 0)))
1920
   (clobber (match_scratch:SI 0 "=d,d"))]
1921
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1922
{
1923
  switch (which_alternative)
1924
    {
1925
    case 0: return score_select (operands, "srli", false, "c", true);
1926
    case 1: return score_select (operands, "srl", false, "", true);
1927
    default: gcc_unreachable ();
1928
    }
1929
}
1930
  [(set_attr "type" "arith")
1931
   (set_attr "up_c" "yes")
1932
   (set_attr "mode" "SI")])
1933
 
1934
(define_insn "*lshrsi3_cmp_score3"
1935
  [(set (reg:CC_NZ CC_REGNUM)
1936
        (compare:CC_NZ (lshiftrt:SI
1937
                        (match_operand:SI 1 "score_register_operand" "d,d")
1938
                        (match_operand:SI 2 "arith_operand" "J,d"))
1939
                       (const_int 0)))
1940
   (clobber (match_scratch:SI 0 "=d,d"))]
1941
  "(TARGET_SCORE3)"
1942
{
1943
  switch (which_alternative)
1944
    {
1945
    case 0: return score_select (operands, "srli", false, "c", true);
1946
    case 1: return score_select (operands, "srl", false, "", true);
1947
    default: gcc_unreachable ();
1948
    }
1949
}
1950
  [(set_attr "type" "arith")
1951
   (set_attr "length" "4,4")
1952
   (set_attr "up_c" "yes")
1953
   (set_attr "mode" "SI")])
1954
 
1955
(define_expand "negsi2"
1956
  [(set (match_operand:SI 0 "score_register_operand")
1957
        (neg:SI (match_operand:SI 1 "score_register_operand")))]
1958
  ""
1959
  ""
1960
)
1961
 
1962
(define_insn "*negsi2_score7"
1963
  [(set (match_operand:SI 0 "register_operand" "=d")
1964
        (neg:SI (match_operand:SI 1 "register_operand" "d")))]
1965
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1966
  "neg     %0, %1"
1967
  [(set_attr "type" "arith")
1968
   (set_attr "mode" "SI")])
1969
 
1970
(define_insn "*negsi2_score3"
1971
  [(set (match_operand:SI 0 "score_register_operand" "=d")
1972
        (neg:SI (match_operand:SI 1 "score_register_operand" "d")))]
1973
  "(TARGET_SCORE3)"
1974
  "neg\t%0, %1"
1975
  [(set_attr "type" "arith")
1976
   (set_attr "length" "4")
1977
   (set_attr "mode" "SI")])
1978
 
1979
(define_insn "*negsi2_cmp_score7"
1980
  [(set (reg:CC_NZ CC_REGNUM)
1981
        (compare:CC_NZ (neg:SI (match_operand:SI 1 "register_operand" "e,d"))
1982
                       (const_int 0)))
1983
   (clobber (match_scratch:SI 0 "=e,d"))]
1984
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
1985
  "@
1986
   neg!    %0, %1
1987
   neg.c   %0, %1"
1988
  [(set_attr "type" "arith")
1989
   (set_attr "up_c" "yes")
1990
   (set_attr "mode" "SI")])
1991
 
1992
(define_insn "*negsi2_cmp_score3"
1993
  [(set (reg:CC_NZ CC_REGNUM)
1994
        (compare:CC_NZ (neg:SI (match_operand:SI 1 "score_register_operand" "d"))
1995
                       (const_int 0)))
1996
   (clobber (match_scratch:SI 0 "=d"))]
1997
  "(TARGET_SCORE3)"
1998
  "neg.c\t%0, %1"
1999
  [(set_attr "type" "arith")
2000
   (set_attr "length" "4")
2001
   (set_attr "up_c" "yes")
2002
   (set_attr "mode" "SI")])
2003
 
2004
(define_insn "*negsi2_ucc_score7"
2005
  [(set (reg:CC_NZ CC_REGNUM)
2006
        (compare:CC_NZ (neg:SI (match_operand:SI 1 "register_operand" "e,d"))
2007
                       (const_int 0)))
2008
   (set (match_operand:SI 0 "register_operand" "=e,d")
2009
        (neg:SI (match_dup 1)))]
2010
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2011
  "@
2012
   neg!    %0, %1
2013
   neg.c   %0, %1"
2014
  [(set_attr "type" "arith")
2015
   (set_attr "up_c" "yes")
2016
   (set_attr "mode" "SI")])
2017
 
2018
(define_insn "*negsi2_ucc_score3"
2019
  [(set (reg:CC_NZ CC_REGNUM)
2020
        (compare:CC_NZ (neg:SI (match_operand:SI 1 "score_register_operand" "d"))
2021
                       (const_int 0)))
2022
   (set (match_operand:SI 0 "score_register_operand" "=d")
2023
        (neg:SI (match_dup 1)))]
2024
  "(TARGET_SCORE3)"
2025
  "neg.c\t%0, %1"
2026
  [(set_attr "type" "arith")
2027
   (set_attr "length" "4")
2028
   (set_attr "up_c" "yes")
2029
   (set_attr "mode" "SI")])
2030
 
2031
 
2032
(define_expand "one_cmplsi2"
2033
  [(set (match_operand:SI 0 "score_register_operand")
2034
        (not:SI (match_operand:SI 1 "score_register_operand")))]
2035
  ""
2036
  ""
2037
)
2038
 
2039
(define_insn "*one_cmplsi2_score7"
2040
  [(set (match_operand:SI 0 "register_operand" "=d")
2041
        (not:SI (match_operand:SI 1 "register_operand" "d")))]
2042
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2043
  "not\t%0, %1"
2044
  [(set_attr "type" "arith")
2045
   (set_attr "mode" "SI")])
2046
 
2047
(define_insn "*one_cmplsi2_score3"
2048
  [(set (match_operand:SI 0 "score_register_operand" "=d")
2049
        (not:SI (match_operand:SI 1 "score_register_operand" "d")))]
2050
  "(TARGET_SCORE3)"
2051
  "not\t%0, %1"
2052
  [(set_attr "type" "arith")
2053
   (set_attr "length" "4")
2054
   (set_attr "mode" "SI")])
2055
 
2056
(define_insn "*one_cmplsi2_ucc_score7"
2057
  [(set (reg:CC_NZ CC_REGNUM)
2058
        (compare:CC_NZ (not:SI (match_operand:SI 1 "register_operand" "e,d"))
2059
                       (const_int 0)))
2060
   (set (match_operand:SI 0 "register_operand" "=e,d")
2061
        (not:SI (match_dup 1)))]
2062
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2063
  "@
2064
   not!    %0, %1
2065
   not.c   %0, %1"
2066
  [(set_attr "type" "arith")
2067
   (set_attr "up_c" "yes")
2068
   (set_attr "mode" "SI")])
2069
 
2070
(define_insn "*one_cmplsi2_ucc_score3"
2071
  [(set (reg:CC_NZ CC_REGNUM)
2072
        (compare:CC_NZ (not:SI (match_operand:SI 1 "score_register_operand" "d"))
2073
                       (const_int 0)))
2074
   (set (match_operand:SI 0 "score_register_operand" "=d")
2075
        (not:SI (match_dup 1)))]
2076
  "(TARGET_SCORE3)"
2077
  "not.c\t%0, %1"
2078
  [(set_attr "type" "arith")
2079
   (set_attr "length" "4")
2080
   (set_attr "up_c" "yes")
2081
   (set_attr "mode" "SI")])
2082
 
2083
(define_insn "*one_cmplsi2_cmp_score7"
2084
  [(set (reg:CC_NZ CC_REGNUM)
2085
        (compare:CC_NZ (not:SI (match_operand:SI 1 "register_operand" "e,d"))
2086
                       (const_int 0)))
2087
   (clobber (match_scratch:SI 0 "=e,d"))]
2088
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2089
  "@
2090
   not!    %0, %1
2091
   not.c   %0, %1"
2092
  [(set_attr "type" "arith")
2093
   (set_attr "up_c" "yes")
2094
   (set_attr "mode" "SI")])
2095
 
2096
(define_insn "*one_cmplsi2_cmp_score3"
2097
  [(set (reg:CC_NZ CC_REGNUM)
2098
        (compare:CC_NZ (not:SI (match_operand:SI 1 "score_register_operand" "d"))
2099
                       (const_int 0)))
2100
   (clobber (match_scratch:SI 0 "=d"))]
2101
  "(TARGET_SCORE3)"
2102
  "not.c\t%0, %1"
2103
  [(set_attr "type" "arith")
2104
   (set_attr "length" "4")
2105
   (set_attr "up_c" "yes")
2106
   (set_attr "mode" "SI")])
2107
 
2108
(define_expand "rotlsi3"
2109
  [(parallel
2110
    [(set (match_operand:SI 0 "score_register_operand")
2111
          (rotate:SI (match_operand:SI 1 "score_register_operand")
2112
                     (match_operand:SI 2 "arith_operand")))
2113
     (clobber (reg:CC CC_REGNUM))])]
2114
  ""
2115
  ""
2116
)
2117
 
2118
(define_insn "*rotlsi3_score7"
2119
  [(set (match_operand:SI 0 "register_operand" "=d,d")
2120
        (rotate:SI (match_operand:SI 1 "register_operand" "d,d")
2121
                   (match_operand:SI 2 "arith_operand" "J,d")))
2122
   (clobber (reg:CC CC_REGNUM))]
2123
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2124
  "@
2125
   roli.c  %0, %1, %c2
2126
   rol.c   %0, %1, %2"
2127
  [(set_attr "type" "arith")
2128
   (set_attr "mode" "SI")])
2129
 
2130
(define_insn "*rotlsi3_score3"
2131
  [(set (match_operand:SI 0 "score_register_operand" "=d,d")
2132
        (rotate:SI (match_operand:SI 1 "score_register_operand" "d,d")
2133
                   (match_operand:SI 2 "arith_operand" "J,d")))
2134
   (clobber (reg:CC CC_REGNUM))]
2135
  "(TARGET_SCORE3)"
2136
  "@
2137
   roli.c\t%0, %1, %c2
2138
   rol.c\t%0, %1, %2"
2139
  [(set_attr "type" "arith")
2140
   (set_attr "length" "4,4")
2141
   (set_attr "mode" "SI")])
2142
 
2143
(define_expand "rotrsi3"
2144
  [(parallel
2145
    [(set (match_operand:SI 0 "score_register_operand")
2146
          (rotatert:SI (match_operand:SI 1 "score_register_operand")
2147
                       (match_operand:SI 2 "arith_operand")))
2148
     (clobber (reg:CC CC_REGNUM))])]
2149
  ""
2150
  ""
2151
)
2152
 
2153
(define_insn "*rotrsi3_score7"
2154
  [(set (match_operand:SI 0 "register_operand" "=d,d")
2155
        (rotatert:SI (match_operand:SI 1 "register_operand" "d,d")
2156
                     (match_operand:SI 2 "arith_operand" "J,d")))
2157
   (clobber (reg:CC CC_REGNUM))]
2158
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2159
  "@
2160
   rori.c  %0, %1, %c2
2161
   ror.c   %0, %1, %2"
2162
  [(set_attr "type" "arith")
2163
   (set_attr "mode" "SI")])
2164
 
2165
(define_insn "*rotrsi3_score3"
2166
  [(set (match_operand:SI 0 "score_register_operand" "=d,d")
2167
        (rotatert:SI (match_operand:SI 1 "score_register_operand" "d,d")
2168
                     (match_operand:SI 2 "arith_operand" "J,d")))
2169
   (clobber (reg:CC CC_REGNUM))]
2170
  "(TARGET_SCORE3)"
2171
  "@
2172
   rori.c\t%0, %1, %c2
2173
   ror.c\t%0, %1, %2"
2174
  [(set_attr "type" "arith")
2175
   (set_attr "length" "4,4")
2176
   (set_attr "mode" "SI")])
2177
 
2178
(define_expand "cbranchsi4"
2179
  [(set (reg:CC CC_REGNUM)
2180
        (compare:CC (match_operand:SI 1 "score_register_operand" "")
2181
                    (match_operand:SI 2 "arith_operand" "")))
2182
   (set (pc)
2183
        (if_then_else
2184
         (match_operator 0 "ordered_comparison_operator"
2185
                         [(reg:CC CC_REGNUM)
2186
                          (const_int 0)])
2187
         (label_ref (match_operand 3 "" ""))
2188
         (pc)))]
2189
  ""
2190
  "")
2191
 
2192
(define_insn "cbrancheqz"
2193
  [(set (pc) (if_then_else
2194
              (eq (match_operand:SI 0 "score_register_operand" "d")
2195
                  (const_int 0))
2196
              (label_ref (match_operand 1 "" ""))
2197
              (pc)))
2198
   (clobber (reg:CC CC_REGNUM))]
2199
  "(TARGET_SCORE3)"
2200
{
2201
  if (get_attr_length (insn) == 4)
2202
      return \"bcmpeqz\t%0, %1\";
2203
  else
2204
      return \"cmpi!\t%0, 0\;beq!\t%1\";
2205
}
2206
  [(set (attr "length")
2207
     (if_then_else
2208
       (and (ge (minus (match_dup 1) (pc)) (const_int -504))
2209
            (le (minus (match_dup 1) (pc)) (const_int 502)))
2210
       (const_int 4)
2211
       (const_int 6)))])
2212
 
2213
(define_insn "cbrancheq"
2214
  [(set (pc) (if_then_else
2215
              (eq (match_operand:SI 0 "score_register_operand" "d")
2216
                  (match_operand:SI 1 "score_register_operand" "d"))
2217
              (label_ref (match_operand 2 "" ""))
2218
              (pc)))
2219
   (clobber (reg:CC CC_REGNUM))]
2220
  "(TARGET_SCORE3)"
2221
{
2222
  if (get_attr_length (insn) == 4)
2223
      return \"bcmpeq\t%0, %1, %2\";
2224
  else
2225
      return \"cmp!\t%0, %1\;beq!\t%2\";
2226
}
2227
  [(set (attr "length")
2228
     (if_then_else
2229
       (and (ge (minus (match_dup 2) (pc)) (const_int -504))
2230
            (le (minus (match_dup 2) (pc)) (const_int 502)))
2231
       (const_int 4)
2232
       (const_int 6)))])
2233
 
2234
(define_insn "cbranchnez"
2235
  [(set (pc) (if_then_else
2236
              (ne (match_operand:SI 0 "score_register_operand" "d")
2237
                  (const_int 0))
2238
              (label_ref (match_operand 1 "" ""))
2239
              (pc)))
2240
   (clobber (reg:CC CC_REGNUM))]
2241
  "(TARGET_SCORE3)"
2242
{
2243
  if (get_attr_length (insn) == 4)
2244
      return \"bcmpnez\t%0, %1\";
2245
  else
2246
      return \"cmpi!\t%0, 0\;bne\t%1\";
2247
}
2248
  [(set (attr "length")
2249
     (if_then_else
2250
       (and (ge (minus (match_dup 1) (pc)) (const_int -504))
2251
            (le (minus (match_dup 1) (pc)) (const_int 502)))
2252
       (const_int 4)
2253
       (const_int 6)))])
2254
 
2255
(define_insn "cbranchne"
2256
  [(set (pc) (if_then_else
2257
              (ne (match_operand:SI 0 "score_register_operand" "d")
2258
                  (match_operand:SI 1 "score_register_operand" "d"))
2259
              (label_ref (match_operand 2 "" ""))
2260
              (pc)))
2261
   (clobber (reg:CC CC_REGNUM))]
2262
  "(TARGET_SCORE3)"
2263
{
2264
  if (get_attr_length (insn) == 4)
2265
      return \"bcmpne\t%0, %1, %2\";
2266
  else
2267
      return \"cmp!\t%0, %1\;bne\t%2\";
2268
}
2269
  [(set (attr "length")
2270
     (if_then_else
2271
       (and (ge (minus (match_dup 2) (pc)) (const_int -504))
2272
            (le (minus (match_dup 2) (pc)) (const_int 502)))
2273
       (const_int 4)
2274
       (const_int 6)))])
2275
 
2276
(define_insn "cmpsi_nz_score7"
2277
  [(set (reg:CC_NZ CC_REGNUM)
2278
        (compare:CC_NZ (match_operand:SI 0 "register_operand" "d,e,d")
2279
                       (match_operand:SI 1 "arith_operand" "L,e,d")))]
2280
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2281
  "@
2282
   cmpi.c  %0, %c1
2283
   cmp!    %0, %1
2284
   cmp.c   %0, %1"
2285
   [(set_attr "type" "cmp")
2286
    (set_attr "up_c" "yes")
2287
    (set_attr "mode" "SI")])
2288
 
2289
(define_insn "cmpsi_nz_score3"
2290
  [(set (reg:CC_NZ CC_REGNUM)
2291
        (compare:CC_NZ (match_operand:SI 0 "score_register_operand" "d,d,d")
2292
                       (match_operand:SI 1 "arith_operand" "O,L,d")))]
2293
  "(TARGET_SCORE3)"
2294
  "@
2295
   cmpi!\t%0, %c1
2296
   cmpi.c\t%0, %c1
2297
   cmp!\t %0, %1"
2298
   [(set_attr "type" "cmp")
2299
    (set_attr "length" "2,4,2")
2300
    (set_attr "up_c" "yes")
2301
    (set_attr "mode" "SI")])
2302
 
2303
(define_insn "cmpsi_n_score7"
2304
  [(set (reg:CC_N CC_REGNUM)
2305
        (compare:CC_N (match_operand:SI 0 "register_operand" "d,e,d")
2306
                      (match_operand:SI 1 "arith_operand" "L,e,d")))]
2307
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2308
  "@
2309
   cmpi.c  %0, %c1
2310
   cmp!    %0, %1
2311
   cmp.c   %0, %1"
2312
   [(set_attr "type" "cmp")
2313
    (set_attr "up_c" "yes")
2314
    (set_attr "mode" "SI")])
2315
 
2316
(define_insn "cmpsi_n_score3"
2317
  [(set (reg:CC_N CC_REGNUM)
2318
        (compare:CC_N (match_operand:SI 0 "score_register_operand" "d,d,d")
2319
                      (match_operand:SI 1 "arith_operand" "O,L,d")))]
2320
  "(TARGET_SCORE3)"
2321
  "@
2322
   cmpi!\t%0, %c1
2323
   cmpi.c\t%0, %c1
2324
   cmp!\t%0, %1"
2325
   [(set_attr "type" "cmp")
2326
    (set_attr "length" "2,4,2")
2327
    (set_attr "up_c" "yes")
2328
    (set_attr "mode" "SI")])
2329
 
2330
(define_insn "*cmpsi_to_addsi_score7"
2331
  [(set (reg:CC_NZ CC_REGNUM)
2332
        (compare:CC_NZ (match_operand:SI 1 "register_operand" "0,d")
2333
                       (neg:SI (match_operand:SI 2 "register_operand" "e,d"))))
2334
   (clobber (match_scratch:SI 0 "=e,d"))]
2335
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2336
  "@
2337
   add!    %0, %2
2338
   add.c   %0, %1, %2"
2339
   [(set_attr "type" "cmp")
2340
    (set_attr "up_c" "yes")
2341
    (set_attr "mode" "SI")])
2342
 
2343
(define_insn "*cmpsi_to_addsi_score3"
2344
  [(set (reg:CC_NZ CC_REGNUM)
2345
        (compare:CC_NZ (match_operand:SI 1 "score_register_operand" "d")
2346
                       (neg:SI (match_operand:SI 2 "score_register_operand" "d"))))
2347
   (clobber (match_scratch:SI 0 "=d"))]
2348
  "(TARGET_SCORE3)"
2349
  "add.c\t%0, %1, %2"
2350
  [(set_attr "type" "cmp")
2351
   (set_attr "length" "4")
2352
   (set_attr "up_c" "yes")
2353
   (set_attr "mode" "SI")])
2354
 
2355
(define_insn "cmpsi_cc_score7"
2356
  [(set (reg:CC CC_REGNUM)
2357
        (compare:CC (match_operand:SI 0 "register_operand" "d,e,d")
2358
                    (match_operand:SI 1 "arith_operand" "L,e,d")))]
2359
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2360
  "@
2361
   cmpi.c  %0, %c1
2362
   cmp!    %0, %1
2363
   cmp.c   %0, %1"
2364
  [(set_attr "type" "cmp")
2365
   (set_attr "up_c" "yes")
2366
   (set_attr "mode" "SI")])
2367
 
2368
(define_insn "cmpsi_cc_score3"
2369
  [(set (reg:CC CC_REGNUM)
2370
        (compare:CC (match_operand:SI 0 "score_register_operand" "d,d,d")
2371
                    (match_operand:SI 1 "arith_operand" "O,L,d")))]
2372
  "(TARGET_SCORE3)"
2373
  "@
2374
   cmpi!\t%0, %c1
2375
   cmpi.c\t%0, %c1
2376
   cmp!\t%0, %1"
2377
  [(set_attr "type" "cmp")
2378
   (set_attr "length" "2,4,2")
2379
   (set_attr "up_c" "yes")
2380
   (set_attr "mode" "SI")])
2381
 
2382
(define_insn "*branch_n_score7"
2383
  [(set (pc)
2384
        (if_then_else
2385
         (match_operator 0 "branch_n_operator"
2386
                         [(reg:CC_N CC_REGNUM)
2387
                          (const_int 0)])
2388
         (label_ref (match_operand 1 "" ""))
2389
         (pc)))]
2390
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2391
  "b%C0    %1"
2392
  [(set_attr "type" "branch")])
2393
 
2394
(define_insn "*branch_n_score3"
2395
  [(set (pc)
2396
        (if_then_else
2397
         (match_operator 0 "branch_n_operator"
2398
                         [(reg:CC_N CC_REGNUM)
2399
                          (const_int 0)])
2400
         (label_ref (match_operand 1 "" ""))
2401
         (pc)))]
2402
  "(TARGET_SCORE3)"
2403
  "b%C0\t%1"
2404
  [(set_attr "type" "branch")
2405
   (set_attr "length" "4")])
2406
 
2407
(define_insn "*branch_nz_score7"
2408
  [(set (pc)
2409
        (if_then_else
2410
         (match_operator 0 "branch_nz_operator"
2411
                         [(reg:CC_NZ CC_REGNUM)
2412
                          (const_int 0)])
2413
         (label_ref (match_operand 1 "" ""))
2414
         (pc)))]
2415
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2416
  "b%C0    %1"
2417
  [(set_attr "type" "branch")])
2418
 
2419
(define_insn "*branch_nz_score3"
2420
  [(set (pc)
2421
        (if_then_else
2422
         (match_operator 0 "branch_nz_operator"
2423
                         [(reg:CC_NZ CC_REGNUM)
2424
                          (const_int 0)])
2425
         (label_ref (match_operand 1 "" ""))
2426
         (pc)))]
2427
  "(TARGET_SCORE3)"
2428
  "b%C0\t%1"
2429
  [(set_attr "type" "branch")
2430
   (set_attr "length" "4")])
2431
 
2432
 
2433
(define_insn "*branch_cc_score7"
2434
  [(set (pc)
2435
        (if_then_else
2436
         (match_operator 0 "comparison_operator"
2437
                         [(reg:CC CC_REGNUM)
2438
                          (const_int 0)])
2439
         (label_ref (match_operand 1 "" ""))
2440
         (pc)))]
2441
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2442
  "b%C0    %1"
2443
  [(set_attr "type" "branch")])
2444
 
2445
(define_insn "*branch_cc_score3"
2446
  [(set (pc)
2447
        (if_then_else
2448
         (match_operator 0 "comparison_operator"
2449
                         [(reg:CC CC_REGNUM)
2450
                          (const_int 0)])
2451
         (label_ref (match_operand 1 "" ""))
2452
         (pc)))]
2453
  "(TARGET_SCORE3)"
2454
  "b%C0\t%1"
2455
  [(set_attr "type" "branch")
2456
   (set_attr "length" "4")])
2457
 
2458
(define_insn "jump"
2459
  [(set (pc)
2460
        (label_ref (match_operand 0 "" "")))]
2461
  ""
2462
{
2463
  if (!flag_pic)
2464
    return \"j\t%0\";
2465
  else
2466
    return \"b\t%0\";
2467
}
2468
  [(set_attr "type" "jump")
2469
   (set_attr "length" "4")])
2470
 
2471
(define_expand "sibcall"
2472
  [(parallel [(call (match_operand 0 "" "")
2473
                    (match_operand 1 "" ""))
2474
              (use (match_operand 2 "" ""))])]
2475
  ""
2476
{
2477
  score_call (operands, true);
2478
  DONE;
2479
})
2480
 
2481
(define_insn "sibcall_internal_score7"
2482
  [(call (mem:SI (match_operand:SI 0 "call_insn_operand" "t,Z"))
2483
         (match_operand 1 "" ""))
2484
   (clobber (reg:SI RT_REGNUM))]
2485
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)
2486
   && SIBLING_CALL_P (insn)"
2487
{
2488
  if (!flag_pic)
2489
    switch (which_alternative)
2490
      {
2491
      case 0: return \"br%S0\t%0\";
2492
      case 1: return \"j\t%0\";
2493
      default: gcc_unreachable ();
2494
      }
2495
  else
2496
    switch (which_alternative)
2497
      {
2498
      case 0: return \"mv\tr29, %0\;br\tr29\";
2499
      case 1: return \"la\tr29, %0\;br\tr29\";
2500
      default: gcc_unreachable ();
2501
      }
2502
}
2503
  [(set_attr "type" "call")])
2504
 
2505
(define_insn "sibcall_internal_score3"
2506
  [(call (mem:SI (match_operand:SI 0 "call_insn_operand" "t,Z"))
2507
         (match_operand 1 "" ""))
2508
   (clobber (reg:SI RT_REGNUM))]
2509
  "(TARGET_SCORE3) && (SIBLING_CALL_P (insn))"
2510
{
2511
  if (!flag_pic)
2512
    switch (which_alternative)
2513
      {
2514
      case 0: return \"br%S0\t%0\";
2515
      case 1: return \"j\t%0\";
2516
      default: gcc_unreachable ();
2517
      }
2518
  else
2519
    switch (which_alternative)
2520
      {
2521
      case 0: return \"mv!\tr29, %0\;br!\tr29\";
2522
      case 1: return \"ldi48\tr29, %0\;br!\tr29\";
2523
      default: gcc_unreachable ();
2524
      }
2525
}
2526
  [(set_attr "type" "call")
2527
   (set_attr "length" "4,8")])
2528
 
2529
(define_expand "sibcall_value"
2530
  [(parallel [(set (match_operand 0 "" "")
2531
              (call (match_operand 1 "" "") (match_operand 2 "" "")))
2532
              (use (match_operand 3 "" ""))])]
2533
  ""
2534
{
2535
  score_call_value (operands, true);
2536
  DONE;
2537
})
2538
 
2539
(define_insn "sibcall_value_internal_score7"
2540
  [(set (match_operand 0 "register_operand" "=d,d")
2541
        (call (mem:SI (match_operand:SI 1 "call_insn_operand" "t,Z"))
2542
              (match_operand 2 "" "")))
2543
   (clobber (reg:SI RT_REGNUM))]
2544
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)
2545
   && SIBLING_CALL_P (insn)"
2546
{
2547
  if (!flag_pic)
2548
    switch (which_alternative)
2549
      {
2550
      case 0: return \"br%S1\t%1\";
2551
      case 1: return \"j\t%1\";
2552
      default: gcc_unreachable ();
2553
      }
2554
  else
2555
    switch (which_alternative)
2556
      {
2557
      case 0: return \"mv\tr29, %1\;br\tr29\";
2558
      case 1: return \"la\tr29, %1\;br\tr29\";
2559
      default: gcc_unreachable ();
2560
      }
2561
}
2562
  [(set_attr "type" "call")])
2563
 
2564
(define_insn "sibcall_value_internal_score3"
2565
  [(set (match_operand 0 "score_register_operand" "=d,d")
2566
        (call (mem:SI (match_operand:SI 1 "call_insn_operand" "t,Z"))
2567
              (match_operand 2 "" "")))
2568
   (clobber (reg:SI RT_REGNUM))]
2569
  "(TARGET_SCORE3) && (SIBLING_CALL_P (insn))"
2570
{
2571
  if (!flag_pic)
2572
    switch (which_alternative)
2573
      {
2574
      case 0: return \"br%S1\t%1\";
2575
      case 1: return \"j\t%1\";
2576
      default: gcc_unreachable ();
2577
      }
2578
  else
2579
    switch (which_alternative)
2580
      {
2581
      case 0: return \"mv!\tr29, %1\;br!\tr29\";
2582
      case 1: return \"ldi48\tr29, %1\;br!\tr29\";
2583
      default: gcc_unreachable ();
2584
      }
2585
}
2586
  [(set_attr "length" "4,8")
2587
   (set_attr "type" "call")])
2588
 
2589
(define_expand "call"
2590
  [(parallel [(call (match_operand 0 "" "") (match_operand 1 "" ""))
2591
              (use (match_operand 2 "" ""))])]
2592
  ""
2593
{
2594
  score_call (operands, false);
2595
  DONE;
2596
})
2597
 
2598
(define_insn "call_internal_score7"
2599
  [(call (mem:SI (match_operand:SI 0 "call_insn_operand" "d,Z"))
2600
         (match_operand 1 "" ""))
2601
   (clobber (reg:SI RA_REGNUM))]
2602
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2603
{
2604
  if (!flag_pic)
2605
    switch (which_alternative)
2606
      {
2607
      case 0: return \"brl%S0\t%0\";
2608
      case 1: return \"jl\t%0\";
2609
      default: gcc_unreachable ();
2610
      }
2611
  else
2612
     switch (which_alternative)
2613
      {
2614
      case 0: return \"mv\tr29, %0\;brl\tr29\";
2615
      case 1: return \"la\tr29, %0\;brl\tr29\";
2616
      default: gcc_unreachable ();
2617
      }
2618
}
2619
  [(set_attr "type" "call")])
2620
 
2621
(define_insn "call_internal_score3"
2622
  [(call (mem:SI (match_operand:SI 0 "call_insn_operand" "d,Z"))
2623
         (match_operand 1 "" ""))
2624
   (clobber (reg:SI RA_REGNUM))]
2625
  "(TARGET_SCORE3)"
2626
{
2627
  if (!flag_pic)
2628
    switch (which_alternative)
2629
      {
2630
      case 0: return \"brl!\t%0\";
2631
      case 1: return \"jl\t%0\";
2632
      default: gcc_unreachable ();
2633
      }
2634
  else
2635
     switch (which_alternative)
2636
      {
2637
      case 0: return \"mv!\tr29, %0\;brl!\tr29\";
2638
      case 1: return \"ldi48\tr29, %0\;brl!\tr29\";
2639
      default: gcc_unreachable ();
2640
      }
2641
}
2642
  [(set_attr "length" "4,8")
2643
   (set_attr "type" "call")])
2644
 
2645
(define_expand "call_value"
2646
  [(parallel [(set (match_operand 0 "" "")
2647
                   (call (match_operand 1 "" "") (match_operand 2 "" "")))
2648
              (use (match_operand 3 "" ""))])]
2649
  ""
2650
{
2651
  score_call_value (operands, false);
2652
  DONE;
2653
})
2654
 
2655
(define_insn "call_value_internal_score7"
2656
  [(set (match_operand 0 "register_operand" "=d,d")
2657
        (call (mem:SI (match_operand:SI 1 "call_insn_operand" "d,Z"))
2658
              (match_operand 2 "" "")))
2659
   (clobber (reg:SI RA_REGNUM))]
2660
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2661
{
2662
  if (!flag_pic)
2663
    switch (which_alternative)
2664
      {
2665
      case 0: return \"brl%S1\t%1\";
2666
      case 1: return \"jl\t%1\";
2667
      default: gcc_unreachable ();
2668
      }
2669
  else
2670
    switch (which_alternative)
2671
      {
2672
      case 0: return \"mv\tr29, %1\;brl\tr29\";
2673
      case 1: return \"la\tr29, %1\;brl\tr29\";
2674
      default: gcc_unreachable ();
2675
      }
2676
}
2677
  [(set_attr "type" "call")])
2678
 
2679
(define_insn "call_value_internal_score3"
2680
  [(set (match_operand 0 "score_register_operand" "=d,d")
2681
        (call (mem:SI (match_operand:SI 1 "call_insn_operand" "d,Z"))
2682
              (match_operand 2 "" "")))
2683
   (clobber (reg:SI RA_REGNUM))]
2684
  "(TARGET_SCORE3)"
2685
{
2686
  if (!flag_pic)
2687
    switch (which_alternative)
2688
      {
2689
      case 0: return \"brl!\t%1\";
2690
      case 1: return \"jl\t%1\";
2691
      default: gcc_unreachable ();
2692
      }
2693
  else
2694
    switch (which_alternative)
2695
      {
2696
      case 0: return \"mv!\tr29, %1\;brl!\tr29\";
2697
      case 1: return \"ldi48\tr29, %1\;brl!\tr29\";
2698
      default: gcc_unreachable ();
2699
      }
2700
}
2701
  [(set_attr "length" "4,8")
2702
   (set_attr "type" "call")])
2703
 
2704
(define_expand "indirect_jump"
2705
  [(set (pc) (match_operand 0 "score_register_operand" "d"))]
2706
  ""
2707
{
2708
  rtx dest;
2709
  dest = operands[0];
2710
  if (GET_CODE (dest) != REG
2711
      || GET_MODE (dest) != Pmode)
2712
    operands[0] = copy_to_mode_reg (Pmode, dest);
2713
 
2714
  emit_jump_insn (gen_indirect_jump_internal_score (operands[0]));
2715
  DONE;
2716
})
2717
 
2718
(define_insn "indirect_jump_internal_score"
2719
  [(set (pc) (match_operand:SI 0 "score_register_operand" "d"))]
2720
  ""
2721
  "br%S0   %0"
2722
  [(set_attr "type" "jump")])
2723
 
2724
(define_expand "casesi"
2725
  [(match_operand:SI 0 "score_register_operand" "")   ; index to jump on
2726
   (match_operand:SI 1 "const_int_operand" "")  ; lower bound
2727
   (match_operand:SI 2 "const_int_operand" "")  ; total range
2728
   (match_operand:SI 3 "" "")                   ; table label
2729
   (match_operand:SI 4 "" "")]                  ; Out of range label
2730
  "TARGET_SCORE3"
2731
{
2732
  rtx reg;
2733
  if (operands[1] != const0_rtx)
2734
    {
2735
      reg = gen_reg_rtx (SImode);
2736
      emit_insn (gen_addsi3 (reg, operands[0],
2737
                             GEN_INT (-INTVAL (operands[1]))));
2738
      operands[0] = reg;
2739
    }
2740
 
2741
  if (!CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'L'))
2742
    operands[2] = force_reg (SImode, operands[2]);
2743
 
2744
  reg = gen_reg_rtx (SImode);
2745
  emit_jump_insn (gen_score3_casesi_internal (operands[0], operands[2],
2746
                                              operands[3], operands[4], reg));
2747
  DONE;
2748
})
2749
 
2750
(define_insn "score3_casesi_internal"
2751
  [(parallel [(set (pc)
2752
               (if_then_else
2753
                (leu (match_operand:SI 0 "score_register_operand" "e")
2754
                     (match_operand:SI 1 "arith_operand" "dL"))
2755
                (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
2756
                                 (label_ref (match_operand 2 "" ""))))
2757
                (label_ref (match_operand 3 "" ""))))
2758
              (clobber (reg:CC CC_REGNUM))
2759
              (clobber (match_operand:SI 4 "score_register_operand" "=e"))
2760
              (use (label_ref (match_dup 2)))])]
2761
  "TARGET_SCORE3 && !flag_pic"
2762
  "*
2763
   return score_output_casesi(operands);
2764
  "
2765
  [(set_attr "length" "20")])
2766
 
2767
(define_expand "tablejump"
2768
  [(set (pc)
2769
        (match_operand 0 "score_register_operand" "d"))
2770
   (use (label_ref (match_operand 1 "" "")))]
2771
  ""
2772
{
2773
  if (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)
2774
    emit_jump_insn (gen_tablejump_internal_score7 (operands[0], operands[1]));
2775
  else if (TARGET_SCORE3)
2776
    emit_jump_insn (gen_tablejump_internal_score3 (operands[0], operands[1]));
2777
 
2778
  DONE;
2779
})
2780
 
2781
(define_insn "tablejump_internal_score7"
2782
  [(set (pc)
2783
        (match_operand:SI 0 "register_operand" "d"))
2784
   (use (label_ref (match_operand 1 "" "")))]
2785
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2786
{
2787
  if (flag_pic)
2788
    return \"mv\tr29, %0\;.cpadd\tr29\;br\tr29\";
2789
  else
2790
    return \"br%S0\t%0\";
2791
}
2792
  [(set_attr "type" "jump")])
2793
 
2794
(define_insn "tablejump_internal_score3"
2795
  [(set (pc)
2796
        (match_operand:SI 0 "score_register_operand" "d"))
2797
   (use (label_ref (match_operand 1 "" "")))]
2798
  "(TARGET_SCORE3)"
2799
{
2800
  if (flag_pic)
2801
    return \"mv!\tr29, %0\;.cpadd\tr29\;br!\tr29\";
2802
  else
2803
    return \"br%S0\t%0\";
2804
}
2805
  [(set_attr "type" "jump")
2806
   (set_attr "length" "8")])
2807
 
2808
(define_expand "prologue"
2809
  [(const_int 1)]
2810
  ""
2811
{
2812
  score_prologue ();
2813
  DONE;
2814
})
2815
 
2816
(define_expand "epilogue"
2817
  [(const_int 2)]
2818
  ""
2819
{
2820
  score_epilogue (false);
2821
  DONE;
2822
})
2823
 
2824
(define_expand "sibcall_epilogue"
2825
  [(const_int 2)]
2826
  ""
2827
{
2828
  score_epilogue (true);
2829
  DONE;
2830
})
2831
 
2832
(define_insn "return_internal_score7"
2833
  [(return)
2834
   (use (match_operand 0 "pmode_register_operand" "d"))]
2835
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2836
  "br%S0\t%0")
2837
 
2838
(define_insn "return_internal_score3"
2839
  [(return)
2840
   (use (match_operand 0 "pmode_register_operand" "d"))]
2841
  "(TARGET_SCORE3)"
2842
  "br%S0\t%0"
2843
  [(set_attr "length" "4")])
2844
 
2845
(define_insn "nop"
2846
  [(const_int 0)]
2847
  ""
2848
  "#nop!"
2849
)
2850
 
2851
(define_insn "cpload_score7"
2852
  [(unspec_volatile:SI [(const_int 1)] CPLOAD)]
2853
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)
2854
   && flag_pic"
2855
  ".cpload\tr29"
2856
)
2857
 
2858
(define_insn "cpload_score3"
2859
  [(unspec_volatile:SI [(const_int 1)] CPLOAD)]
2860
  "(TARGET_SCORE3) && flag_pic"
2861
  ".cpload\tr29"
2862
  [(set_attr "length" "4")])
2863
 
2864
(define_insn "cprestore_use_fp_score7"
2865
  [(unspec_volatile:SI [(match_operand:SI 0 "" "")] CPRESTORE)
2866
   (use (reg:SI FP_REGNUM))]
2867
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)
2868
   && flag_pic"
2869
  ".cprestore\tr2, %0"
2870
)
2871
 
2872
(define_insn "cprestore_use_fp_score3"
2873
  [(unspec_volatile:SI [(match_operand:SI 0 "" "")] CPRESTORE)
2874
   (use (reg:SI FP_REGNUM))]
2875
  "(TARGET_SCORE3) && flag_pic"
2876
  ".cprestore\tr2, %0"
2877
  [(set_attr "length" "4")])
2878
 
2879
(define_insn "cprestore_use_sp_score7"
2880
  [(unspec_volatile:SI [(match_operand:SI 0 "" "")] CPRESTORE)
2881
   (use (reg:SI SP_REGNUM))]
2882
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)
2883
   && flag_pic"
2884
  ".cprestore\tr0, %0"
2885
)
2886
 
2887
(define_insn "cprestore_use_sp_score3"
2888
  [(unspec_volatile:SI [(match_operand:SI 0 "" "")] CPRESTORE)
2889
   (use (reg:SI SP_REGNUM))]
2890
  "(TARGET_SCORE3) && flag_pic"
2891
  ".cprestore\tr0, %0"
2892
  [(set_attr "length" "4")])
2893
 
2894
(define_expand "doloop_end"
2895
  [(use (match_operand 0 "" ""))    ; loop pseudo
2896
   (use (match_operand 1 "" ""))    ; iterations; zero if unknown
2897
   (use (match_operand 2 "" ""))    ; max iterations
2898
   (use (match_operand 3 "" ""))    ; loop level
2899
   (use (match_operand 4 "" ""))]   ; label
2900
  "!TARGET_NHWLOOP"
2901
{
2902
  if (INTVAL (operands[3]) > 1)
2903
    FAIL;
2904
 
2905
  if (GET_MODE (operands[0]) == SImode)
2906
    {
2907
      rtx sr0 = gen_rtx_REG (SImode, CN_REGNUM);
2908
      emit_jump_insn (gen_doloop_end_si (sr0, operands[4]));
2909
    }
2910
  else
2911
    FAIL;
2912
 
2913
  DONE;
2914
})
2915
 
2916
(define_insn "doloop_end_si"
2917
  [(set (pc)
2918
        (if_then_else
2919
         (ne (match_operand:SI 0 "sr0_operand" "")
2920
             (const_int 0))
2921
         (label_ref (match_operand 1 "" ""))
2922
         (pc)))
2923
   (set (match_dup 0)
2924
        (plus:SI (match_dup 0)
2925
                 (const_int -1)))
2926
   (clobber (reg:CC CC_REGNUM))]
2927
  "!TARGET_NHWLOOP"
2928
  "bcnz %1"
2929
  [(set_attr "type" "branch")
2930
   (set_attr "length" "4")])
2931
 
2932
(define_insn "pushsi_score7"
2933
  [(set (match_operand:SI 0 "push_operand" "=<")
2934
        (match_operand:SI 1 "register_operand" "d"))]
2935
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2936
  "push!\t%1, [r0]"
2937
  [(set_attr "type" "store")
2938
   (set_attr "mode" "SI")])
2939
 
2940
(define_insn "pushsi_score3"
2941
  [(set (match_operand:SI 0 "push_operand" "=<")
2942
        (match_operand:SI 1 "register_operand" "d"))]
2943
  "(TARGET_SCORE3)"
2944
  "push!\t%1"
2945
  [(set_attr "type" "store")
2946
   (set_attr "length" "2")
2947
   (set_attr "mode" "SI")])
2948
 
2949
(define_insn "popsi_score7"
2950
  [(set (match_operand:SI 0 "register_operand" "=d")
2951
        (match_operand:SI 1 "pop_operand" ">"))]
2952
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
2953
  "pop!\t%0, [r0]"
2954
  [(set_attr "type" "store")
2955
   (set_attr "mode" "SI")])
2956
 
2957
(define_insn "popsi_score3"
2958
  [(set (match_operand:SI 0 "register_operand" "=d")
2959
        (match_operand:SI 1 "pop_operand" ">"))]
2960
  "(TARGET_SCORE3)"
2961
  "pop!\t%0"
2962
  [(set_attr "type" "store")
2963
   (set_attr "length" "2")
2964
   (set_attr "mode" "SI")])
2965
 
2966
(define_expand "load_multiple"
2967
  [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
2968
                          (match_operand:SI 1 "" ""))
2969
                     (use (match_operand:SI 2 "" ""))
2970
                     (clobber (reg:SI 0))])]
2971
  "(TARGET_SCORE3)"
2972
{
2973
  int regno, count, i;
2974
 
2975
  if (GET_CODE (operands[2]) != CONST_INT
2976
      || INTVAL (operands[2]) < 2
2977
      || GET_CODE (operands[1]) != MEM
2978
      || XEXP (operands[1], 0) != stack_pointer_rtx
2979
      || GET_CODE (operands[0]) != REG)
2980
    FAIL;
2981
 
2982
  count = INTVAL (operands[2]);
2983
  regno = REGNO (operands[0]);
2984
 
2985
  operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
2986
 
2987
  for (i = 0; i < count; i++)
2988
    XVECEXP (operands[3], 0, i)
2989
      = gen_rtx_SET (VOIDmode,
2990
                     gen_rtx_REG (SImode, regno + i),
2991
                     gen_rtx_MEM (SImode, gen_rtx_POST_INC (SImode, stack_pointer_rtx)));
2992
})
2993
 
2994
(define_insn ""
2995
  [(match_parallel 0 "score_load_multiple_operation"
2996
    [(set (match_operand:SI 1 "register_operand" "=d")
2997
          (mem:SI (post_inc:SI (reg:SI SP_REGNUM))))])]
2998
  "(TARGET_SCORE3)"
2999
{
3000
  return score_rpop (operands);
3001
}
3002
  [(set_attr "length" "2")])
3003
 
3004
(define_expand "store_multiple"
3005
  [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
3006
                          (match_operand:SI 1 "" ""))
3007
                     (use (match_operand:SI 2 "" ""))
3008
                     (clobber (reg:SI 0))])]
3009
  "(TARGET_SCORE3)"
3010
{
3011
  int regno, count, i;
3012
 
3013
  if (GET_CODE (operands[2]) != CONST_INT
3014
      || INTVAL (operands[2]) < 2
3015
      || GET_CODE (operands[0]) != MEM
3016
      || XEXP (operands[0], 0) != stack_pointer_rtx
3017
      || GET_CODE (operands[1]) != REG)
3018
    FAIL;
3019
 
3020
  count = INTVAL (operands[2]);
3021
  regno = REGNO (operands[1]);
3022
 
3023
  operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
3024
 
3025
  for (i = 0; i < count; i++)
3026
    XVECEXP (operands[3], 0, i)
3027
      = gen_rtx_SET (VOIDmode,
3028
                 gen_rtx_MEM (SImode, gen_rtx_PRE_DEC (SImode, stack_pointer_rtx)),
3029
                 gen_rtx_REG (SImode, regno + i));
3030
})
3031
 
3032
(define_insn ""
3033
  [(match_parallel 0 "score_store_multiple_operation"
3034
    [(set (mem:SI (pre_dec:SI (reg:SI SP_REGNUM)))
3035
          (match_operand:SI 1 "register_operand" "d"))])]
3036
  "(TARGET_SCORE3)"
3037
{
3038
  return score_rpush (operands);
3039
}
3040
  [(set_attr "length" "2")])
3041
 
3042
(define_peephole2
3043
  [(set (match_operand:SI 0 "g32reg_operand" "")
3044
        (match_operand:SI 1 "loreg_operand" ""))
3045
   (set (match_operand:SI 2 "g32reg_operand" "")
3046
        (match_operand:SI 3 "hireg_operand" ""))]
3047
  ""
3048
  [(parallel
3049
       [(set (match_dup 0) (match_dup 1))
3050
        (set (match_dup 2) (match_dup 3))])])
3051
 
3052
(define_peephole2
3053
  [(set (match_operand:SI 0 "g32reg_operand" "")
3054
        (match_operand:SI 1 "hireg_operand" ""))
3055
   (set (match_operand:SI 2 "g32reg_operand" "")
3056
        (match_operand:SI 3 "loreg_operand" ""))]
3057
  ""
3058
  [(parallel
3059
       [(set (match_dup 2) (match_dup 3))
3060
        (set (match_dup 0) (match_dup 1))])])
3061
 
3062
(define_insn "movhilo"
3063
  [(parallel
3064
    [(set (match_operand:SI 0 "register_operand" "=d")
3065
          (match_operand:SI 1 "loreg_operand" ""))
3066
     (set (match_operand:SI 2 "register_operand" "=d")
3067
          (match_operand:SI 3 "hireg_operand" ""))])]
3068
  ""
3069
  "mfcehl\t%2, %0"
3070
  [(set_attr "type" "fce")
3071
   (set_attr "mode" "SI")])
3072
 
3073
(define_expand "movsicc"
3074
  [(set (match_operand:SI 0 "register_operand" "")
3075
        (if_then_else:SI (match_operator 1 "comparison_operator"
3076
                          [(reg:CC CC_REGNUM) (const_int 0)])
3077
                         (match_operand:SI 2 "register_operand" "")
3078
                         (match_operand:SI 3 "register_operand" "")))]
3079
  ""
3080
{
3081
  score_movsicc (operands);
3082
})
3083
 
3084
(define_insn "movsicc_internal_score7"
3085
  [(set (match_operand:SI 0 "register_operand" "=d")
3086
        (if_then_else:SI (match_operator 1 "comparison_operator"
3087
                          [(reg:CC CC_REGNUM) (const_int 0)])
3088
                         (match_operand:SI 2 "arith_operand" "d")
3089
                         (match_operand:SI 3 "arith_operand" "0")))]
3090
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
3091
  "mv%C1\t%0, %2"
3092
  [(set_attr "type" "cndmv")
3093
   (set_attr "mode" "SI")])
3094
 
3095
(define_insn "movsicc_internal_score3"
3096
  [(set (match_operand:SI 0 "register_operand" "=d")
3097
        (if_then_else:SI (match_operator 1 "comparison_operator"
3098
                          [(reg:CC CC_REGNUM) (const_int 0)])
3099
                         (match_operand:SI 2 "arith_operand" "d")
3100
                         (match_operand:SI 3 "arith_operand" "0")))]
3101
  "(TARGET_SCORE3)"
3102
  "mv%G1\t%0, %2"
3103
  [(set_attr "type" "cndmv")
3104
   (set_attr "length" "4")
3105
   (set_attr "mode" "SI")])
3106
 
3107
(define_insn "zero_extract_bittst_score7"
3108
  [(set (reg:CC_NZ CC_REGNUM)
3109
        (compare:CC_NZ (unspec:SI
3110
                        [(match_operand:SI 0 "register_operand" "*e,d")
3111
                         (match_operand:SI 1 "const_uimm5" "")]
3112
                        BITTST)
3113
                       (const_int 0)))]
3114
  "(TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)"
3115
  "@
3116
   bittst!\t%0, %c1
3117
   bittst.c\t%0, %c1"
3118
  [(set_attr "type" "arith")
3119
   (set_attr "up_c" "yes")
3120
   (set_attr "mode" "SI")])
3121
 
3122
(define_insn "zero_extract_bittst_score3"
3123
  [(set (reg:CC_NZ CC_REGNUM)
3124
        (compare:CC_NZ (unspec:SI
3125
                        [(match_operand:SI 0 "register_operand" "e,d")
3126
                         (match_operand:SI 1 "const_uimm5" "")]
3127
                        BITTST)
3128
                       (const_int 0)))]
3129
  "(TARGET_SCORE3)"
3130
  "@
3131
   bittst!\t%0, %c1
3132
   bittst.c\t%0, %c1"
3133
  [(set_attr "type" "arith")
3134
   (set_attr "length" "2,4")
3135
   (set_attr "up_c" "yes")
3136
   (set_attr "mode" "SI")])
3137
 
3138
(define_expand "extzv"
3139
  [(set (match_operand:SI 0 "register_operand" "")
3140
        (zero_extract (match_operand:SI 1 "memory_operand" "")
3141
                      (match_operand:SI 2 "immediate_operand" "")
3142
                      (match_operand:SI 3 "immediate_operand" "")))]
3143
  "((TARGET_SCORE5 || TARGET_SCORE7 || TARGET_SCORE7D)
3144
    && (!TARGET_LITTLE_ENDIAN) && (TARGET_ULS))
3145
   || (TARGET_SCORE3 && TARGET_ULS)"
3146
{
3147
  if (score_unaligned_load (operands))
3148
    DONE;
3149
  else
3150
    FAIL;
3151
})
3152
 
3153
(define_expand "insv"
3154
  [(set (zero_extract (match_operand:SI 0 "memory_operand" "")
3155
                      (match_operand:SI 1 "immediate_operand" "")
3156
                      (match_operand:SI 2 "immediate_operand" ""))
3157
        (match_operand:SI 3 "register_operand" ""))]
3158
  "((TARGET_SCORE5 || TARGET_SCORE7 || TARGET_SCORE7D)
3159
    && (!TARGET_LITTLE_ENDIAN) && (TARGET_ULS))
3160
   || (TARGET_SCORE3 && TARGET_ULS)"
3161
{
3162
  if (score_unaligned_store (operands))
3163
    DONE;
3164
  else
3165
    FAIL;
3166
})
3167
 
3168
(define_expand "extv"
3169
  [(set (match_operand:SI 0 "register_operand" "")
3170
        (sign_extract (match_operand:SI 1 "memory_operand" "")
3171
                      (match_operand:SI 2 "immediate_operand" "")
3172
                      (match_operand:SI 3 "immediate_operand" "")))]
3173
  "((TARGET_SCORE5 || TARGET_SCORE7 || TARGET_SCORE7D)
3174
    && (!TARGET_LITTLE_ENDIAN) && (TARGET_ULS))
3175
   || (TARGET_SCORE3 && TARGET_ULS)"
3176
{
3177
  if (score_unaligned_load (operands))
3178
    DONE;
3179
  else
3180
    FAIL;
3181
})
3182
 
3183
(define_expand "movmemsi"
3184
  [(parallel [(set (match_operand:BLK 0 "general_operand")
3185
                   (match_operand:BLK 1 "general_operand"))
3186
              (use (match_operand:SI 2 ""))
3187
              (use (match_operand:SI 3 "const_int_operand"))])]
3188
  "((TARGET_SCORE5 || TARGET_SCORE7 || TARGET_SCORE7D)
3189
     && (TARGET_ULS))
3190
    || (TARGET_SCORE3 && TARGET_ULS)"
3191
{
3192
  if (score_block_move (operands))
3193
    DONE;
3194
  else
3195
    FAIL;
3196
})
3197
 
3198
(define_insn "move_lbu_a"
3199
  [(set (match_operand:SI 0 "register_operand" "=d")
3200
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3201
                 (match_operand:SI 2 "const_simm12" "")))
3202
   (set (match_operand:QI 3 "register_operand" "=d")
3203
        (mem:QI (match_dup 1)))]
3204
  ""
3205
  "lbu\t%3, [%1]+, %2"
3206
  [(set_attr "type" "load")
3207
   (set_attr "length" "4")
3208
   (set_attr "mode" "QI")])
3209
 
3210
(define_insn "move_lhu_a"
3211
  [(set (match_operand:SI 0 "register_operand" "=d")
3212
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3213
                 (match_operand:SI 2 "const_simm12" "")))
3214
   (set (match_operand:HI 3 "register_operand" "=d")
3215
        (mem:HI (match_dup 1)))]
3216
  ""
3217
  "lhu\t%3, [%1]+, %2"
3218
  [(set_attr "type" "load")
3219
   (set_attr "length" "4")
3220
   (set_attr "mode" "HI")])
3221
 
3222
(define_insn "move_lw_a"
3223
  [(set (match_operand:SI 0 "register_operand" "=d")
3224
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3225
                 (match_operand:SI 2 "const_simm12" "")))
3226
   (set (match_operand:SI 3 "register_operand" "=d")
3227
        (mem:SI (match_dup 1)))]
3228
  ""
3229
  "lw\t%3, [%1]+, %2"
3230
  [(set_attr "type" "load")
3231
   (set_attr "length" "4")
3232
   (set_attr "mode" "SI")])
3233
 
3234
(define_insn "move_sb_a"
3235
  [(set (match_operand:SI 0 "register_operand" "=d")
3236
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3237
                 (match_operand:SI 2 "const_simm12" "")))
3238
   (set (mem:QI (match_dup 1))
3239
        (match_operand:QI 3 "register_operand" "d"))]
3240
  ""
3241
  "sb\t%3, [%1]+, %2"
3242
  [(set_attr "type" "store")
3243
   (set_attr "length" "4")
3244
   (set_attr "mode" "QI")])
3245
 
3246
(define_insn "move_sh_a"
3247
  [(set (match_operand:SI 0 "register_operand" "=d")
3248
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3249
                 (match_operand:SI 2 "const_simm12" "")))
3250
   (set (mem:HI (match_dup 1))
3251
        (match_operand:HI 3 "register_operand" "d"))]
3252
  ""
3253
  "sh\t%3, [%1]+, %2"
3254
  [(set_attr "type" "store")
3255
   (set_attr "length" "4")
3256
   (set_attr "mode" "HI")])
3257
 
3258
(define_insn "move_sw_a"
3259
  [(set (match_operand:SI 0 "register_operand" "=d")
3260
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3261
                 (match_operand:SI 2 "const_simm12" "")))
3262
   (set (mem:SI (match_dup 1))
3263
        (match_operand:SI 3 "register_operand" "d"))]
3264
  ""
3265
  "sw\t%3, [%1]+, %2"
3266
  [(set_attr "type" "store")
3267
   (set_attr "length" "4")
3268
   (set_attr "mode" "SI")])
3269
 
3270
(define_insn "move_lbu_b"
3271
  [(set (match_operand:SI 0 "register_operand" "=d")
3272
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3273
                 (match_operand:SI 2 "const_simm12" "")))
3274
   (set (match_operand:QI 3 "register_operand" "=d")
3275
        (mem:QI (plus:SI (match_dup 1)
3276
                         (match_dup 2))))]
3277
  ""
3278
  "lbu\t%3, [%1, %2]+"
3279
  [(set_attr "type" "load")
3280
   (set_attr "length" "4")
3281
   (set_attr "mode" "QI")])
3282
 
3283
(define_insn "move_lhu_b"
3284
  [(set (match_operand:SI 0 "register_operand" "=d")
3285
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3286
                 (match_operand:SI 2 "const_simm12" "")))
3287
   (set (match_operand:HI 3 "register_operand" "=d")
3288
        (mem:HI (plus:SI (match_dup 1)
3289
                         (match_dup 2))))]
3290
  ""
3291
  "lhu\t%3, [%1, %2]+"
3292
  [(set_attr "type" "load")
3293
   (set_attr "length" "4")
3294
   (set_attr "mode" "HI")])
3295
 
3296
(define_insn "move_lw_b"
3297
  [(set (match_operand:SI 0 "register_operand" "=d")
3298
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3299
                 (match_operand:SI 2 "const_simm12" "")))
3300
   (set (match_operand:SI 3 "register_operand" "=d")
3301
        (mem:SI (plus:SI (match_dup 1)
3302
                         (match_dup 2))))]
3303
  ""
3304
  "lw\t%3, [%1, %2]+"
3305
  [(set_attr "type" "load")
3306
   (set_attr "length" "4")
3307
   (set_attr "mode" "SI")])
3308
 
3309
(define_insn "move_sb_b"
3310
  [(set (match_operand:SI 0 "register_operand" "=d")
3311
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3312
                 (match_operand:SI 2 "const_simm12" "")))
3313
   (set (mem:QI (plus:SI (match_dup 1)
3314
                         (match_dup 2)))
3315
        (match_operand:QI 3 "register_operand" "d"))]
3316
  ""
3317
  "sb\t%3, [%1, %2]+"
3318
  [(set_attr "type" "store")
3319
   (set_attr "length" "4")
3320
   (set_attr "mode" "QI")])
3321
 
3322
(define_insn "move_sh_b"
3323
  [(set (match_operand:SI 0 "register_operand" "=d")
3324
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3325
                 (match_operand:SI 2 "const_simm12" "")))
3326
   (set (mem:HI (plus:SI (match_dup 1)
3327
                         (match_dup 2)))
3328
        (match_operand:HI 3 "register_operand" "d"))]
3329
  ""
3330
  "sh\t%3, [%1, %2]+"
3331
  [(set_attr "type" "store")
3332
   (set_attr "length" "4")
3333
   (set_attr "mode" "HI")])
3334
 
3335
(define_insn "move_sw_b"
3336
  [(set (match_operand:SI 0 "register_operand" "=d")
3337
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3338
                 (match_operand:SI 2 "const_simm12" "")))
3339
   (set (mem:SI (plus:SI (match_dup 1)
3340
                         (match_dup 2)))
3341
        (match_operand:SI 3 "register_operand" "d"))]
3342
  ""
3343
  "sw\t%3, [%1, %2]+"
3344
  [(set_attr "type" "store")
3345
   (set_attr "length" "4")
3346
   (set_attr "mode" "SI")])
3347
 
3348
(define_insn "move_lcb"
3349
  [(set (match_operand:SI 0 "register_operand" "=d")
3350
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3351
                 (const_int 4)))
3352
   (set (reg:SI LC_REGNUM)
3353
        (unspec:SI [(mem:BLK (match_dup 1))] LCB))]
3354
  "((TARGET_SCORE5 || TARGET_SCORE7 || TARGET_SCORE7D)
3355
     && (!TARGET_LITTLE_ENDIAN) && (TARGET_ULS))
3356
    || (TARGET_SCORE3 && TARGET_ULS)"
3357
  "lcb\t[%1]+"
3358
  [(set_attr "type" "load")
3359
   (set_attr "length" "4")
3360
   (set_attr "mode" "SI")])
3361
 
3362
(define_insn "move_lcw"
3363
  [(set (match_operand:SI 0 "register_operand" "=d")
3364
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3365
                 (const_int 4)))
3366
   (set (match_operand:SI 2 "register_operand" "=d")
3367
        (unspec:SI [(mem:BLK (match_dup 1))
3368
                    (reg:SI LC_REGNUM)] LCW))
3369
   (set (reg:SI LC_REGNUM)
3370
        (unspec:SI [(mem:BLK (match_dup 1))] LCB))]
3371
  "((TARGET_SCORE5 || TARGET_SCORE7 || TARGET_SCORE7D)
3372
     && (!TARGET_LITTLE_ENDIAN) && (TARGET_ULS))
3373
    || (TARGET_SCORE3 && TARGET_ULS)"
3374
  "lcw\t%2, [%1]+"
3375
  [(set_attr "type" "load")
3376
   (set_attr "length" "4")
3377
   (set_attr "mode" "SI")])
3378
 
3379
(define_insn "move_lce"
3380
  [(set (match_operand:SI 0 "register_operand" "=d")
3381
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3382
                 (const_int 4)))
3383
   (set (match_operand:SI 2 "register_operand" "=d")
3384
        (unspec:SI [(mem:BLK (match_dup 1))
3385
                    (reg:SI LC_REGNUM)] LCE))]
3386
  "((TARGET_SCORE5 || TARGET_SCORE7 || TARGET_SCORE7D)
3387
     && (!TARGET_LITTLE_ENDIAN) && (TARGET_ULS))
3388
    || (TARGET_SCORE3 && TARGET_ULS)"
3389
  "lce\t%2, [%1]+"
3390
  [(set_attr "type" "load")
3391
   (set_attr "length" "4")
3392
   (set_attr "mode" "SI")])
3393
 
3394
(define_insn "move_scb"
3395
  [(set (match_operand:SI 0 "register_operand" "=d")
3396
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3397
                 (const_int 4)))
3398
   (set (mem:BLK (match_dup 1))
3399
        (unspec:BLK [(match_operand:SI 2 "register_operand" "d")] SCB))
3400
   (set (reg:SI SC_REGNUM)
3401
        (unspec:SI [(match_dup 2)] SCLC))]
3402
  "((TARGET_SCORE5 || TARGET_SCORE7 || TARGET_SCORE7D)
3403
     && (!TARGET_LITTLE_ENDIAN) && (TARGET_ULS))
3404
    || (TARGET_SCORE3 && TARGET_ULS)"
3405
  "scb\t%2, [%1]+"
3406
  [(set_attr "type" "store")
3407
   (set_attr "length" "4")
3408
   (set_attr "mode" "SI")])
3409
 
3410
(define_insn "move_scw"
3411
  [(set (match_operand:SI 0 "register_operand" "=d")
3412
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3413
                 (const_int 4)))
3414
   (set (mem:BLK (match_dup 1))
3415
        (unspec:BLK [(match_operand:SI 2 "register_operand" "d")
3416
                     (reg:SI SC_REGNUM)] SCW))
3417
   (set (reg:SI SC_REGNUM)
3418
        (unspec:SI [(match_dup 2)] SCLC))]
3419
  "((TARGET_SCORE5 || TARGET_SCORE7 || TARGET_SCORE7D)
3420
     && (!TARGET_LITTLE_ENDIAN) && (TARGET_ULS))
3421
    || (TARGET_SCORE3 && TARGET_ULS)"
3422
  "scw\t%2, [%1]+"
3423
  [(set_attr "type" "store")
3424
   (set_attr "length" "4")
3425
   (set_attr "mode" "SI")])
3426
 
3427
(define_insn "move_sce"
3428
  [(set (match_operand:SI 0 "register_operand" "=d")
3429
        (plus:SI (match_operand:SI 1 "register_operand" "0")
3430
                 (const_int 4)))
3431
   (set (mem:BLK (match_dup 1))
3432
        (unspec:BLK [(reg:SI SC_REGNUM)] SCE))]
3433
  "((TARGET_SCORE5 || TARGET_SCORE7 || TARGET_SCORE7D)
3434
     && (!TARGET_LITTLE_ENDIAN) && (TARGET_ULS))
3435
    || (TARGET_SCORE3 && TARGET_ULS)"
3436
  "sce     [%1]+"
3437
  [(set_attr "type" "store")
3438
   (set_attr "length" "4")
3439
   (set_attr "mode" "SI")])
3440
 
3441
(define_insn "andsi3_extzh"
3442
  [(set (match_operand:SI 0 "register_operand" "=d")
3443
        (and:SI (match_operand:SI 1 "register_operand" "d")
3444
                (const_int 65535)))]
3445
  ""
3446
  "extzh\t%0, %1"
3447
  [(set_attr "type" "arith")
3448
   (set_attr "length" "4")
3449
   (set_attr "mode" "SI")])
3450
 
3451
(define_insn "clzsi2"
3452
  [(set (match_operand:SI 0 "register_operand" "=d")
3453
        (clz:SI (match_operand:SI 1 "register_operand" "d")))]
3454
  "(TARGET_SCORE7D || TARGET_SCORE3)"
3455
  "clz\t%0, %1"
3456
  [(set_attr "type" "arith")
3457
   (set_attr "mode" "SI")])
3458
 
3459
(define_insn "smaxsi3"
3460
  [(set (match_operand:SI 0 "register_operand" "=d")
3461
        (smax:SI (match_operand:SI 1 "register_operand" "d")
3462
                 (match_operand:SI 2 "register_operand" "d")))]
3463
  "(TARGET_SCORE7D || TARGET_SCORE3D)"
3464
  "max\t%0, %1, %2"
3465
  [(set_attr "type" "arith")
3466
   (set_attr "mode" "SI")])
3467
 
3468
(define_insn "sminsi3"
3469
  [(set (match_operand:SI 0 "register_operand" "=d")
3470
        (smin:SI (match_operand:SI 1 "register_operand" "d")
3471
                 (match_operand:SI 2 "register_operand" "d")))]
3472
  "(TARGET_SCORE7D || TARGET_SCORE3D)"
3473
  "min\t%0, %1, %2"
3474
  [(set_attr "type" "arith")
3475
   (set_attr "mode" "SI")])
3476
 
3477
(define_insn "abssi2"
3478
  [(set (match_operand:SI 0 "register_operand" "=d")
3479
        (abs:SI (match_operand:SI 1 "register_operand" "d")))]
3480
  "(TARGET_SCORE7D || TARGET_SCORE3D)"
3481
  "abs\t%0, %1"
3482
  [(set_attr "type" "arith")
3483
   (set_attr "mode" "SI")])
3484
 
3485
(define_insn "sffs"
3486
  [(set (match_operand:SI 0 "register_operand" "=d")
3487
        (unspec:SI [(match_operand:SI 1 "register_operand" "d")] SFFS))]
3488
  "(TARGET_SCORE7D || TARGET_SCORE3D)"
3489
  "bitrev\t%0, %1, r0\;clz\t%0, %0\;addi\t%0, 0x1"
3490
  [(set_attr "type" "arith")
3491
   (set_attr "mode" "SI")])
3492
 
3493
(define_expand "ffssi2"
3494
  [(set (match_operand:SI 0 "register_operand")
3495
        (ffs:SI (match_operand:SI 1 "register_operand")))]
3496
  "(TARGET_SCORE7D || TARGET_SCORE3D)"
3497
{
3498
  emit_insn (gen_sffs (operands[0], operands[1]));
3499
  emit_insn (gen_rtx_SET (VOIDmode, gen_rtx_REG (CC_NZmode, CC_REGNUM),
3500
                          gen_rtx_COMPARE (CC_NZmode, operands[0],
3501
                                           GEN_INT (33))));
3502
  if (TARGET_SCORE7D)
3503
    emit_insn (gen_movsicc_internal_score7 (operands[0],
3504
               gen_rtx_fmt_ee (EQ, VOIDmode, operands[0], GEN_INT (33)),
3505
               GEN_INT (0),
3506
               operands[0]));
3507
  else
3508
    emit_insn (gen_movsicc_internal_score3 (operands[0],
3509
               gen_rtx_fmt_ee (EQ, VOIDmode, operands[0], GEN_INT (33)),
3510
               GEN_INT (0),
3511
               operands[0]));
3512
  DONE;
3513
})
3514
 
3515
(define_peephole2
3516
  [(set (match_operand:SI 0 "loreg_operand" "")
3517
        (match_operand:SI 1 "register_operand" ""))
3518
   (set (match_operand:SI 2 "hireg_operand" "")
3519
        (match_operand:SI 3 "register_operand" ""))]
3520
  "(TARGET_SCORE7D || TARGET_SCORE3D)"
3521
  [(parallel
3522
       [(set (match_dup 0) (match_dup 1))
3523
        (set (match_dup 2) (match_dup 3))])])
3524
 
3525
(define_peephole2
3526
  [(set (match_operand:SI 0 "hireg_operand" "")
3527
        (match_operand:SI 1 "register_operand" ""))
3528
   (set (match_operand:SI 2 "loreg_operand" "")
3529
        (match_operand:SI 3 "register_operand" ""))]
3530
  "(TARGET_SCORE7D || TARGET_SCORE3D)"
3531
  [(parallel
3532
       [(set (match_dup 2) (match_dup 3))
3533
        (set (match_dup 0) (match_dup 1))])])
3534
 
3535
(define_insn "movtohilo"
3536
  [(parallel
3537
       [(set (match_operand:SI 0 "loreg_operand" "=l")
3538
             (match_operand:SI 1 "register_operand" "d"))
3539
        (set (match_operand:SI 2 "hireg_operand" "=h")
3540
             (match_operand:SI 3 "register_operand" "d"))])]
3541
  "(TARGET_SCORE7D || TARGET_SCORE3D)"
3542
  "mtcehl\t%3, %1"
3543
  [(set_attr "type" "fce")
3544
   (set_attr "mode" "SI")])
3545
 
3546
(define_insn "mulsi3addsi"
3547
  [(set (match_operand:SI 0 "register_operand" "=l,l,d")
3548
        (plus:SI (mult:SI (match_operand:SI 2 "register_operand" "d,d,d")
3549
                          (match_operand:SI 3 "register_operand" "d,d,d"))
3550
                 (match_operand:SI 1 "register_operand" "0,d,l")))
3551
   (clobber (reg:SI HI_REGNUM))]
3552
  "(TARGET_SCORE7D || TARGET_SCORE3D)"
3553
  "@
3554
   mad\t%2, %3
3555
   mtcel%S1\t%1\;mad\t%2, %3
3556
   mad\t%2, %3\;mfcel%S0\t%0"
3557
  [(set_attr "mode" "SI")])
3558
 
3559
(define_insn "mulsi3subsi"
3560
  [(set (match_operand:SI 0 "register_operand" "=l,l,d")
3561
        (minus:SI (match_operand:SI 1 "register_operand" "0,d,l")
3562
                  (mult:SI (match_operand:SI 2 "register_operand" "d,d,d")
3563
                           (match_operand:SI 3 "register_operand" "d,d,d"))))
3564
   (clobber (reg:SI HI_REGNUM))]
3565
  "(TARGET_SCORE7D || TARGET_SCORE3D)"
3566
  "@
3567
   msb\t%2, %3
3568
   mtcel%S1\t%1\;msb\t%2, %3
3569
   msb\t%2, %3\;mfcel%S0\t%0"
3570
  [(set_attr "mode" "SI")])
3571
 
3572
(define_insn "mulsidi3adddi"
3573
  [(set (match_operand:DI 0 "register_operand" "=x")
3574
        (plus:DI (mult:DI
3575
                  (sign_extend:DI (match_operand:SI 2 "register_operand" "%d"))
3576
                  (sign_extend:DI (match_operand:SI 3 "register_operand" "d")))
3577
                 (match_operand:DI 1 "register_operand" "0")))]
3578
  "(TARGET_SCORE7D || TARGET_SCORE3D)"
3579
  "mad\t%2, %3"
3580
  [(set_attr "mode" "DI")])
3581
 
3582
(define_insn "umulsidi3adddi"
3583
  [(set (match_operand:DI 0 "register_operand" "=x")
3584
        (plus:DI (mult:DI
3585
                  (zero_extend:DI (match_operand:SI 2 "register_operand" "%d"))
3586
                  (zero_extend:DI (match_operand:SI 3 "register_operand" "d")))
3587
                 (match_operand:DI 1 "register_operand" "0")))]
3588
  "(TARGET_SCORE7D || TARGET_SCORE3D)"
3589
  "madu\t%2, %3"
3590
  [(set_attr "mode" "DI")])
3591
 
3592
(define_insn "mulsidi3subdi"
3593
  [(set (match_operand:DI 0 "register_operand" "=x")
3594
        (minus:DI
3595
         (match_operand:DI 1 "register_operand" "0")
3596
         (mult:DI
3597
          (sign_extend:DI (match_operand:SI 2 "register_operand" "%d"))
3598
          (sign_extend:DI (match_operand:SI 3 "register_operand" "d")))))]
3599
  "(TARGET_SCORE7D || TARGET_SCORE3D)"
3600
  "msb\t%2, %3"
3601
  [(set_attr "mode" "DI")])
3602
 
3603
(define_insn "umulsidi3subdi"
3604
  [(set (match_operand:DI 0 "register_operand" "=x")
3605
        (minus:DI
3606
         (match_operand:DI 1 "register_operand" "0")
3607
         (mult:DI (zero_extend:DI
3608
                   (match_operand:SI 2 "register_operand" "%d"))
3609
                  (zero_extend:DI
3610
                   (match_operand:SI 3 "register_operand" "d")))))]
3611
  "(TARGET_SCORE7D || TARGET_SCORE3D)"
3612
  "msbu\t%2, %3"
3613
  [(set_attr "mode" "DI")])
3614
 

powered by: WebSVN 2.1.0

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