Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in src/patchsets/gcc/3.4.6/gentoo: 90_all_mips-add-march-r10k.patch
Date: Sun, 29 Mar 2015 19:21:49
Message-Id: 20150329192145.BFD4E14CB8@oystercatcher.gentoo.org
1 vapier 15/03/29 19:21:45
2
3 Added: 90_all_mips-add-march-r10k.patch
4 Log:
5 import patch from gcc FILESDIR
6
7 Revision Changes Path
8 1.1 src/patchsets/gcc/3.4.6/gentoo/90_all_mips-add-march-r10k.patch
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/3.4.6/gentoo/90_all_mips-add-march-r10k.patch?rev=1.1&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/3.4.6/gentoo/90_all_mips-add-march-r10k.patch?rev=1.1&content-type=text/plain
12
13 Index: 90_all_mips-add-march-r10k.patch
14 ===================================================================
15 # Patch forward-ported from a gcc-3.0.x patch that adds -march=r10000 and
16 # -mtune=r10000 support to gcc (Allows the compiler to generate code to
17 # take advantage of R10k's second ALU, perform shifts, etc..
18 #
19 # Needs re-porting to DFA in gcc-4.0 - Any Volunteers? :)
20
21 --- gcc-3.4.1.orig/gcc/config/mips/mips.c
22 +++ gcc-3.4.1/gcc/config/mips/mips.c
23 @@ -707,6 +707,7 @@ const struct mips_cpu_info mips_cpu_info
24
25 /* MIPS IV */
26 { "r8000", PROCESSOR_R8000, 4 },
27 + { "r10000", PROCESSOR_R10000, 4 },
28 { "vr5000", PROCESSOR_R5000, 4 },
29 { "vr5400", PROCESSOR_R5400, 4 },
30 { "vr5500", PROCESSOR_R5500, 4 },
31 @@ -9401,6 +9402,9 @@ mips_issue_rate (void)
32 {
33 switch (mips_tune)
34 {
35 + case PROCESSOR_R10000:
36 + return 4;
37 +
38 case PROCESSOR_R5400:
39 case PROCESSOR_R5500:
40 case PROCESSOR_R7000:
41 --- gcc-3.4.1.orig/gcc/config/mips/mips.h
42 +++ gcc-3.4.1/gcc/config/mips/mips.h
43 @@ -66,6 +66,7 @@ enum processor_type {
44 PROCESSOR_R7000,
45 PROCESSOR_R8000,
46 PROCESSOR_R9000,
47 + PROCESSOR_R10000,
48 PROCESSOR_SB1,
49 PROCESSOR_SR71000
50 };
51 --- gcc-3.4.1.orig/gcc/config/mips/mips.md
52 +++ gcc-3.4.1/gcc/config/mips/mips.md
53 @@ -103,6 +103,7 @@
54 ;; arith integer arithmetic instruction
55 ;; darith double precision integer arithmetic instructions
56 ;; const load constant
57 +;; shift integer shift
58 ;; imul integer multiply
59 ;; imadd integer multiply-add
60 ;; idiv integer divide
61 @@ -120,7 +121,7 @@
62 ;; multi multiword sequence (or user asm statements)
63 ;; nop no operation
64 (define_attr "type"
65 - "unknown,branch,jump,call,load,store,prefetch,prefetchx,move,condmove,xfer,hilo,const,arith,darith,imul,imadd,idiv,icmp,fadd,fmul,fmadd,fdiv,fabs,fneg,fcmp,fcvt,fsqrt,frsqrt,multi,nop"
66 + "unknown,branch,jump,call,load,store,prefetch,prefetchx,move,condmove,xfer,hilo,const,arith,darith,shift,imul,imadd,idiv,icmp,fadd,fmul,fmadd,fdiv,fabs,fneg,fcmp,fcvt,fsqrt,frsqrt,multi,nop"
67 (cond [(eq_attr "jal" "!unset") (const_string "call")
68 (eq_attr "got" "load") (const_string "load")]
69 (const_string "unknown")))
70 @@ -214,7 +215,7 @@
71 ;; Attribute describing the processor. This attribute must match exactly
72 ;; with the processor_type enumeration in mips.h.
73 (define_attr "cpu"
74 - "default,4kc,5kc,20kc,m4k,r3000,r3900,r6000,r4000,r4100,r4111,r4120,r4300,r4600,r4650,r5000,r5400,r5500,r7000,r8000,r9000,sb1,sr71000"
75 + "default,4kc,5kc,20kc,m4k,r3000,r3900,r6000,r4000,r4100,r4111,r4120,r4300,r4600,r4650,r5000,r5400,r5500,r7000,r8000,r9000,r10000,sb1,sr71000"
76 (const (symbol_ref "mips_tune")))
77
78 ;; The type of hardware hazard associated with this instruction.
79 @@ -305,12 +306,12 @@
80
81 (define_function_unit "memory" 1 0
82 (and (eq_attr "type" "load")
83 - (eq_attr "cpu" "!r3000,r3900,r4600,r4650,r4100,r4120,r4300,r5000"))
84 + (eq_attr "cpu" "!r3000,r3900,r4600,r4650,r4100,r4120,r4300,r5000,r10000"))
85 3 0)
86
87 (define_function_unit "memory" 1 0
88 (and (eq_attr "type" "load")
89 - (eq_attr "cpu" "r3000,r3900,r4600,r4650,r4100,r4120,r4300,r5000"))
90 + (eq_attr "cpu" "r3000,r3900,r4600,r4650,r4100,r4120,r4300,r5000,r10000"))
91 2 0)
92
93 (define_function_unit "memory" 1 0 (eq_attr "type" "store") 1 0)
94 @@ -323,7 +324,7 @@
95
96 (define_function_unit "imuldiv" 1 0
97 (and (eq_attr "type" "imul,imadd")
98 - (eq_attr "cpu" "!r3000,r3900,r4000,r4600,r4650,r4100,r4120,r4300,r5000"))
99 + (eq_attr "cpu" "!r3000,r3900,r4000,r4600,r4650,r4100,r4120,r4300,r5000,r10000"))
100 17 17)
101
102 ;; On them mips16, we want to stronly discourage a mult from appearing
103 @@ -375,7 +376,7 @@
104
105 (define_function_unit "imuldiv" 1 0
106 (and (eq_attr "type" "idiv")
107 - (eq_attr "cpu" "!r3000,r3900,r4000,r4600,r4650,r4100,r4120,r4300,r5000"))
108 + (eq_attr "cpu" "!r3000,r3900,r4000,r4600,r4650,r4100,r4120,r4300,r5000,r10000"))
109 38 38)
110
111 (define_function_unit "imuldiv" 1 0
112 @@ -424,6 +425,40 @@
113 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r5000")))
114 68 68)
115
116 +;; R10000 has 2 integer ALUs
117 +(define_function_unit "alu" 2 0
118 + (and (eq_attr "type" "arith,darith,shift")
119 + (eq_attr "cpu" "r10000"))
120 + 1 0)
121 +
122 +;; Only ALU1 can do shifts. We model shifts as an additional unit
123 +(define_function_unit "alu1" 1 0
124 + (and (eq_attr "type" "shift")
125 + (eq_attr "cpu" "r10000"))
126 + 1 0)
127 +
128 +;; only ALU2 does multiplications and divisions
129 +(define_function_unit "alu2" 1 0
130 + (and (eq_attr "type" "imul")
131 + (and (eq_attr "mode" "SI") (eq_attr "cpu" "r10000")))
132 + 6 6)
133 +
134 +(define_function_unit "alu2" 1 0
135 + (and (eq_attr "type" "imul")
136 + (and (eq_attr "mode" "DI") (eq_attr "cpu" "r10000")))
137 + 10 10)
138 +
139 +(define_function_unit "alu2" 1 0
140 + (and (eq_attr "type" "idiv")
141 + (and (eq_attr "mode" "SI") (eq_attr "cpu" "r10000")))
142 + 35 35)
143 +
144 +(define_function_unit "alu2" 1 0
145 + (and (eq_attr "type" "idiv")
146 + (and (eq_attr "mode" "DI") (eq_attr "cpu" "r10000")))
147 + 67 67)
148 +
149 +
150 ;; The R4300 does *NOT* have a separate Floating Point Unit, instead
151 ;; the FP hardware is part of the normal ALU circuitry. This means FP
152 ;; instructions affect the pipe-line, and no functional unit
153 @@ -432,11 +467,11 @@
154 ;; instructions to be processed in the "imuldiv" unit.
155
156 (define_function_unit "adder" 1 1
157 - (and (eq_attr "type" "fcmp") (eq_attr "cpu" "!r3000,r3900,r6000,r4300,r5000"))
158 + (and (eq_attr "type" "fcmp") (eq_attr "cpu" "!r3000,r3900,r6000,r4300,r5000,r10000"))
159 3 0)
160
161 (define_function_unit "adder" 1 1
162 - (and (eq_attr "type" "fcmp") (eq_attr "cpu" "r3000,r3900,r6000"))
163 + (and (eq_attr "type" "fcmp") (eq_attr "cpu" "r3000,r3900,r6000,r10000"))
164 2 0)
165
166 (define_function_unit "adder" 1 1
167 @@ -444,7 +479,7 @@
168 1 0)
169
170 (define_function_unit "adder" 1 1
171 - (and (eq_attr "type" "fadd") (eq_attr "cpu" "!r3000,r3900,r6000,r4300"))
172 + (and (eq_attr "type" "fadd") (eq_attr "cpu" "!r3000,r3900,r6000,r4300,r10000"))
173 4 0)
174
175 (define_function_unit "adder" 1 1
176 @@ -456,6 +491,10 @@
177 3 0)
178
179 (define_function_unit "adder" 1 1
180 + (and (eq_attr "type" "fadd,fmadd") (eq_attr "cpu" "r10000"))
181 + 2 0)
182 +
183 +(define_function_unit "adder" 1 1
184 (and (eq_attr "type" "fabs,fneg")
185 (eq_attr "cpu" "!r3000,r3900,r4600,r4650,r4300,r5000"))
186 2 0)
187 @@ -467,7 +506,7 @@
188 (define_function_unit "mult" 1 1
189 (and (eq_attr "type" "fmul")
190 (and (eq_attr "mode" "SF")
191 - (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300,r5000")))
192 + (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300,r5000,r10000")))
193 7 0)
194
195 (define_function_unit "mult" 1 1
196 @@ -487,7 +526,7 @@
197
198 (define_function_unit "mult" 1 1
199 (and (eq_attr "type" "fmul")
200 - (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r3000,r3900,r6000,r4300,r5000")))
201 + (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r3000,r3900,r6000,r4300,r5000,r10000")))
202 8 0)
203
204 (define_function_unit "mult" 1 1
205 @@ -500,10 +539,14 @@
206 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r6000")))
207 6 0)
208
209 +(define_function_unit "mult" 1 1
210 + (and (eq_attr "type" "fmul,fmadd") (eq_attr "cpu" "r10000"))
211 + 2 0)
212 +
213 (define_function_unit "divide" 1 1
214 (and (eq_attr "type" "fdiv")
215 (and (eq_attr "mode" "SF")
216 - (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300,r5000")))
217 + (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300,r5000,r10000")))
218 23 0)
219
220 (define_function_unit "divide" 1 1
221 @@ -529,7 +572,7 @@
222 (define_function_unit "divide" 1 1
223 (and (eq_attr "type" "fdiv")
224 (and (eq_attr "mode" "DF")
225 - (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300")))
226 + (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300,r10000")))
227 36 0)
228
229 (define_function_unit "divide" 1 1
230 @@ -547,10 +590,21 @@
231 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4600,r4650")))
232 61 0)
233
234 +;; divisions keep multiplier busy on R10000
235 +(define_function_unit "mult" 1 1
236 + (and (eq_attr "type" "fdiv")
237 + (and (eq_attr "mode" "SF") (eq_attr "cpu" "r10000")))
238 + 12 14)
239 +
240 +(define_function_unit "mult" 1 1
241 + (and (eq_attr "type" "fdiv")
242 + (and (eq_attr "mode" "DF") (eq_attr "cpu" "r10000")))
243 + 19 21)
244 +
245 ;;; ??? Is this number right?
246 (define_function_unit "divide" 1 1
247 (and (eq_attr "type" "fsqrt,frsqrt")
248 - (and (eq_attr "mode" "SF") (eq_attr "cpu" "!r4600,r4650,r4300,r5000")))
249 + (and (eq_attr "mode" "SF") (eq_attr "cpu" "!r4600,r4650,r4300,r5000,r10000")))
250 54 0)
251
252 (define_function_unit "divide" 1 1
253 @@ -566,7 +620,7 @@
254 ;;; ??? Is this number right?
255 (define_function_unit "divide" 1 1
256 (and (eq_attr "type" "fsqrt,frsqrt")
257 - (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r4600,r4650,r4300,r5000")))
258 + (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r4600,r4650,r4300,r5000,r10000")))
259 112 0)
260
261 (define_function_unit "divide" 1 1
262 @@ -579,6 +633,17 @@
263 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r5000")))
264 36 0)
265
266 +;; sqrt is executed by multiplier on R10000
267 +(define_function_unit "mult" 1 1
268 + (and (eq_attr "type" "fsqrt")
269 + (and (eq_attr "mode" "SF") (eq_attr "cpu" "r10000")))
270 + 18 20)
271 +
272 +(define_function_unit "mult" 1 1
273 + (and (eq_attr "type" "fsqrt")
274 + (and (eq_attr "mode" "DF") (eq_attr "cpu" "r10000")))
275 + 33 35)
276 +
277 ;; R4300 FP instruction classes treated as part of the "imuldiv"
278 ;; functional unit:
279
280 @@ -3157,7 +3222,7 @@ dsrl\t%3,%3,1\n\
281 "@
282 sll\t%0,%1,0
283 sw\t%1,%0"
284 - [(set_attr "type" "darith,store")
285 + [(set_attr "type" "shift,store")
286 (set_attr "mode" "SI")
287 (set_attr "extended_mips16" "yes,*")])
288
289 @@ -3191,7 +3256,7 @@ dsrl\t%3,%3,1\n\
290 (match_operand:DI 2 "small_int" "I"))))]
291 "TARGET_64BIT && !TARGET_MIPS16 && INTVAL (operands[2]) >= 32"
292 "dsra\t%0,%1,%2"
293 - [(set_attr "type" "darith")
294 + [(set_attr "type" "shift")
295 (set_attr "mode" "SI")])
296
297 (define_insn ""
298 @@ -3200,7 +3265,7 @@ dsrl\t%3,%3,1\n\
299 (const_int 32))))]
300 "TARGET_64BIT && !TARGET_MIPS16"
301 "dsra\t%0,%1,32"
302 - [(set_attr "type" "darith")
303 + [(set_attr "type" "shift")
304 (set_attr "mode" "SI")])
305
306
307 @@ -5241,7 +5306,7 @@ dsrl\t%3,%3,1\n\
308
309 return "sll\t%0,%1,%2";
310 }
311 - [(set_attr "type" "arith")
312 + [(set_attr "type" "shift")
313 (set_attr "mode" "SI")])
314
315 (define_insn "ashlsi3_internal1_extend"
316 @@ -5255,7 +5320,7 @@ dsrl\t%3,%3,1\n\
317
318 return "sll\t%0,%1,%2";
319 }
320 - [(set_attr "type" "arith")
321 + [(set_attr "type" "shift")
322 (set_attr "mode" "DI")])
323
324
325 @@ -5273,7 +5338,7 @@ dsrl\t%3,%3,1\n\
326
327 return "sll\t%0,%1,%2";
328 }
329 - [(set_attr "type" "arith")
330 + [(set_attr "type" "shift")
331 (set_attr "mode" "SI")
332 (set_attr_alternative "length"
333 [(const_int 4)
334 @@ -5374,7 +5439,7 @@ sll\t%L0,%L1,%2\n\
335 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
336 return "sll\t%M0,%L1,%2\;move\t%L0,%.";
337 }
338 - [(set_attr "type" "darith")
339 + [(set_attr "type" "shift")
340 (set_attr "mode" "DI")
341 (set_attr "length" "8")])
342
343 @@ -5429,7 +5494,7 @@ sll\t%L0,%L1,%2\n\
344
345 return "sll\t%M0,%M1,%2\;srl\t%3,%L1,%4\;or\t%M0,%M0,%3\;sll\t%L0,%L1,%2";
346 }
347 - [(set_attr "type" "darith")
348 + [(set_attr "type" "shift")
349 (set_attr "mode" "DI")
350 (set_attr "length" "16")])
351
352 @@ -5513,7 +5578,7 @@ sll\t%L0,%L1,%2\n\
353
354 return "dsll\t%0,%1,%2";
355 }
356 - [(set_attr "type" "arith")
357 + [(set_attr "type" "shift")
358 (set_attr "mode" "DI")])
359
360 (define_insn ""
361 @@ -5530,7 +5595,7 @@ sll\t%L0,%L1,%2\n\
362
363 return "dsll\t%0,%1,%2";
364 }
365 - [(set_attr "type" "arith")
366 + [(set_attr "type" "shift")
367 (set_attr "mode" "DI")
368 (set_attr_alternative "length"
369 [(const_int 4)
370 @@ -5591,7 +5656,7 @@ sll\t%L0,%L1,%2\n\
371
372 return "sra\t%0,%1,%2";
373 }
374 - [(set_attr "type" "arith")
375 + [(set_attr "type" "shift")
376 (set_attr "mode" "SI")])
377
378 (define_insn "ashrsi3_internal2"
379 @@ -5608,7 +5673,7 @@ sll\t%L0,%L1,%2\n\
380
381 return "sra\t%0,%1,%2";
382 }
383 - [(set_attr "type" "arith")
384 + [(set_attr "type" "shift")
385 (set_attr "mode" "SI")
386 (set_attr_alternative "length"
387 [(const_int 4)
388 @@ -5705,7 +5770,7 @@ sra\t%M0,%M1,%2\n\
389 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
390 return "sra\t%L0,%M1,%2\;sra\t%M0,%M1,31";
391 }
392 - [(set_attr "type" "darith")
393 + [(set_attr "type" "shift")
394 (set_attr "mode" "DI")
395 (set_attr "length" "8")])
396
397 @@ -5760,7 +5825,7 @@ sra\t%M0,%M1,%2\n\
398
399 return "srl\t%L0,%L1,%2\;sll\t%3,%M1,%4\;or\t%L0,%L0,%3\;sra\t%M0,%M1,%2";
400 }
401 - [(set_attr "type" "darith")
402 + [(set_attr "type" "shift")
403 (set_attr "mode" "DI")
404 (set_attr "length" "16")])
405
406 @@ -5844,7 +5909,7 @@ sra\t%M0,%M1,%2\n\
407
408 return "dsra\t%0,%1,%2";
409 }
410 - [(set_attr "type" "arith")
411 + [(set_attr "type" "shift")
412 (set_attr "mode" "DI")])
413
414 (define_insn ""
415 @@ -5858,7 +5923,7 @@ sra\t%M0,%M1,%2\n\
416
417 return "dsra\t%0,%2";
418 }
419 - [(set_attr "type" "arith")
420 + [(set_attr "type" "shift")
421 (set_attr "mode" "DI")
422 (set_attr_alternative "length"
423 [(const_int 4)
424 @@ -5918,7 +5983,7 @@ sra\t%M0,%M1,%2\n\
425
426 return "srl\t%0,%1,%2";
427 }
428 - [(set_attr "type" "arith")
429 + [(set_attr "type" "shift")
430 (set_attr "mode" "SI")])
431
432 (define_insn "lshrsi3_internal2"
433 @@ -5935,7 +6000,7 @@ sra\t%M0,%M1,%2\n\
434
435 return "srl\t%0,%1,%2";
436 }
437 - [(set_attr "type" "arith")
438 + [(set_attr "type" "shift")
439 (set_attr "mode" "SI")
440 (set_attr_alternative "length"
441 [(const_int 4)
442 @@ -6056,7 +6121,7 @@ srl\t%M0,%M1,%2\n\
443 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
444 return "srl\t%L0,%M1,%2\;move\t%M0,%.";
445 }
446 - [(set_attr "type" "darith")
447 + [(set_attr "type" "shift")
448 (set_attr "mode" "DI")
449 (set_attr "length" "8")])
450
451 @@ -6111,7 +6176,7 @@ srl\t%M0,%M1,%2\n\
452
453 return "srl\t%L0,%L1,%2\;sll\t%3,%M1,%4\;or\t%L0,%L0,%3\;srl\t%M0,%M1,%2";
454 }
455 - [(set_attr "type" "darith")
456 + [(set_attr "type" "shift")
457 (set_attr "mode" "DI")
458 (set_attr "length" "16")])
459
460 @@ -6195,7 +6260,7 @@ srl\t%M0,%M1,%2\n\
461
462 return "dsrl\t%0,%1,%2";
463 }
464 - [(set_attr "type" "arith")
465 + [(set_attr "type" "shift")
466 (set_attr "mode" "DI")])
467
468 (define_insn ""
469 @@ -6209,7 +6274,7 @@ srl\t%M0,%M1,%2\n\
470
471 return "dsrl\t%0,%2";
472 }
473 - [(set_attr "type" "arith")
474 + [(set_attr "type" "shift")
475 (set_attr "mode" "DI")
476 (set_attr_alternative "length"
477 [(const_int 4)