comparison gcc/config/spu/spu.h @ 67:f6334be47118

update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 22 Mar 2011 17:18:12 +0900
parents 77e2b8dfacca
children 04ced10e8804
comparison
equal deleted inserted replaced
65:65488c3d617d 67:f6334be47118
1 /* Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 1 /* Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
2 2
3 This file is free software; you can redistribute it and/or modify it under 3 This file is free software; you can redistribute it and/or modify it under
4 the terms of the GNU General Public License as published by the Free 4 the terms of the GNU General Public License as published by the Free
5 Software Foundation; either version 3 of the License, or (at your option) 5 Software Foundation; either version 3 of the License, or (at your option)
6 any later version. 6 any later version.
18 /* Run-time Target */ 18 /* Run-time Target */
19 #define TARGET_CPU_CPP_BUILTINS() spu_cpu_cpp_builtins(pfile) 19 #define TARGET_CPU_CPP_BUILTINS() spu_cpu_cpp_builtins(pfile)
20 20
21 #define TARGET_VERSION fprintf (stderr, " (spu %s)", __DATE__); 21 #define TARGET_VERSION fprintf (stderr, " (spu %s)", __DATE__);
22 22
23 #define OVERRIDE_OPTIONS spu_override_options()
24 #define C_COMMON_OVERRIDE_OPTIONS spu_c_common_override_options() 23 #define C_COMMON_OVERRIDE_OPTIONS spu_c_common_override_options()
25 24
26 #define OPTIMIZATION_OPTIONS(level,size) \
27 spu_optimization_options(level,size)
28
29 #define INIT_EXPANDERS spu_init_expanders() 25 #define INIT_EXPANDERS spu_init_expanders()
30
31 extern int target_flags;
32 extern const char *spu_fixed_range_string;
33 26
34 /* Which processor to generate code or schedule for. */ 27 /* Which processor to generate code or schedule for. */
35 enum processor_type 28 enum processor_type
36 { 29 {
37 PROCESSOR_CELL, 30 PROCESSOR_CELL,
70 32 here because (of some reason I can't remember.) */ 63 32 here because (of some reason I can't remember.) */
71 #define BITS_PER_WORD 128 64 #define BITS_PER_WORD 128
72 65
73 #define UNITS_PER_WORD (BITS_PER_WORD/BITS_PER_UNIT) 66 #define UNITS_PER_WORD (BITS_PER_WORD/BITS_PER_UNIT)
74 67
75 /* We never actually change UNITS_PER_WORD, but defining this causes 68 /* When building libgcc, we need to assume 4 words per units even
76 libgcc to use some different sizes of types when compiling. */ 69 though UNITS_PER_WORD is 16, because the SPU has basically a 32-bit
77 #define MIN_UNITS_PER_WORD 4 70 instruction set although register size is 128 bits. In particular,
71 this causes libgcc to contain __divdi3 instead of __divti3 etc.
72 However, we allow this default to be re-defined on the command
73 line, so that we can use the LIB2_SIDITI_CONV_FUNCS mechanism
74 to get (in addition) TImode versions of some routines. */
75 #ifndef LIBGCC2_UNITS_PER_WORD
76 #define LIBGCC2_UNITS_PER_WORD 4
77 #endif
78 78
79 #define POINTER_SIZE 32 79 #define POINTER_SIZE 32
80 80
81 #define PARM_BOUNDARY 128 81 #define PARM_BOUNDARY 128
82 82
172 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 172 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
173 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 173 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
174 1, 1, 1 \ 174 1, 1, 1 \
175 } 175 }
176 176
177 #define CONDITIONAL_REGISTER_USAGE \
178 spu_conditional_register_usage()
179
180 177
181 /* Values in Registers */ 178 /* Values in Registers */
182 179
183 #define HARD_REGNO_NREGS(REGNO, MODE) \ 180 #define HARD_REGNO_NREGS(REGNO, MODE) \
184 ((GET_MODE_BITSIZE(MODE)+MAX_FIXED_MODE_SIZE-1)/MAX_FIXED_MODE_SIZE) 181 ((GET_MODE_BITSIZE(MODE)+MAX_FIXED_MODE_SIZE-1)/MAX_FIXED_MODE_SIZE)
230 #define INT_REG_OK_FOR_INDEX_P(X,STRICT) \ 227 #define INT_REG_OK_FOR_INDEX_P(X,STRICT) \
231 ((!(STRICT) || REGNO_OK_FOR_INDEX_P (REGNO (X)))) 228 ((!(STRICT) || REGNO_OK_FOR_INDEX_P (REGNO (X))))
232 #define INT_REG_OK_FOR_BASE_P(X,STRICT) \ 229 #define INT_REG_OK_FOR_BASE_P(X,STRICT) \
233 ((!(STRICT) || REGNO_OK_FOR_BASE_P (REGNO (X)))) 230 ((!(STRICT) || REGNO_OK_FOR_BASE_P (REGNO (X))))
234 231
235 #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
236
237 #define CLASS_MAX_NREGS(CLASS, MODE) \ 232 #define CLASS_MAX_NREGS(CLASS, MODE) \
238 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) 233 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
239 234
240 /* GCC assumes that modes are in the lowpart of a register, which is 235 /* GCC assumes that modes are in the lowpart of a register, which is
241 only true for SPU. */ 236 only true for SPU. */
243 ((GET_MODE_SIZE (FROM) > 4 || GET_MODE_SIZE (TO) > 4) \ 238 ((GET_MODE_SIZE (FROM) > 4 || GET_MODE_SIZE (TO) > 4) \
244 && (GET_MODE_SIZE (FROM) < 16 || GET_MODE_SIZE (TO) < 16) \ 239 && (GET_MODE_SIZE (FROM) < 16 || GET_MODE_SIZE (TO) < 16) \
245 && GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO)) 240 && GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO))
246 241
247 #define REGISTER_TARGET_PRAGMAS() do { \ 242 #define REGISTER_TARGET_PRAGMAS() do { \
243 c_register_addr_space ("__ea", ADDR_SPACE_EA); \
248 targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \ 244 targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \
249 }while (0); 245 }while (0);
250 246
251 247
252 /* Frame Layout */ 248 /* Frame Layout */
331 327
332 #define REG_PARM_STACK_SPACE(FNDECL) 0 328 #define REG_PARM_STACK_SPACE(FNDECL) 0
333 329
334 #define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1 330 #define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
335 331
336 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) (0)
337
338 332
339 /* Register Arguments */ 333 /* Register Arguments */
340
341 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
342 (spu_function_arg((CUM),(MODE),(TYPE),(NAMED)))
343 334
344 #define CUMULATIVE_ARGS int 335 #define CUMULATIVE_ARGS int
345 336
346 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) \ 337 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) \
347 ((CUM) = 0) 338 ((CUM) = 0)
348
349 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
350 ((CUM) += \
351 (TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST ? 1 \
352 : (MODE) == BLKmode ? ((int_size_in_bytes(TYPE)+15) / 16) \
353 : (MODE) == VOIDmode ? 1 \
354 : HARD_REGNO_NREGS(CUM,MODE))
355
356 339
357 /* The SPU ABI wants 32/64-bit types at offset 0 in the quad-word on the 340 /* The SPU ABI wants 32/64-bit types at offset 0 in the quad-word on the
358 stack. 8/16-bit types should be at offsets 3/2 respectively. */ 341 stack. 8/16-bit types should be at offsets 3/2 respectively. */
359 #define FUNCTION_ARG_OFFSET(MODE, TYPE) \ 342 #define FUNCTION_ARG_OFFSET(MODE, TYPE) \
360 (((TYPE) && INTEGRAL_TYPE_P (TYPE) && GET_MODE_SIZE (MODE) < 4) \ 343 (((TYPE) && INTEGRAL_TYPE_P (TYPE) && GET_MODE_SIZE (MODE) < 4) \
421 404
422 #define BRANCH_COST(speed_p, predictable_p) spu_branch_cost 405 #define BRANCH_COST(speed_p, predictable_p) spu_branch_cost
423 406
424 #define SLOW_BYTE_ACCESS 0 407 #define SLOW_BYTE_ACCESS 0
425 408
426 #define MOVE_RATIO(speed) 32 409 #define MOVE_RATIO(speed) ((speed)? 32 : 4)
427 410
428 #define NO_FUNCTION_CSE 411 #define NO_FUNCTION_CSE
429 412
430 413
431 /* Sections */ 414 /* Sections */
444 /* File Framework */ 427 /* File Framework */
445 428
446 #define ASM_APP_ON "" 429 #define ASM_APP_ON ""
447 430
448 #define ASM_APP_OFF "" 431 #define ASM_APP_OFF ""
449
450 #define ASM_OUTPUT_SOURCE_FILENAME(STREAM, NAME) \
451 do { fprintf (STREAM, "\t.file\t"); \
452 output_quoted_string (STREAM, NAME); \
453 fprintf (STREAM, "\n"); \
454 } while (0)
455 432
456 433
457 /* Uninitialized Data */ 434 /* Uninitialized Data */
458 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ 435 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
459 ( fputs (".comm ", (FILE)), \ 436 ( fputs (".comm ", (FILE)), \
505 482
506 #define LOCAL_LABEL_PREFIX "." 483 #define LOCAL_LABEL_PREFIX "."
507 484
508 #define USER_LABEL_PREFIX "" 485 #define USER_LABEL_PREFIX ""
509 486
487 #define ASM_COMMENT_START "#"
488
510 489
511 /* Dispatch Tables */ 490 /* Dispatch Tables */
512 491
513 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ 492 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
514 fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL) 493 fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
521 500
522 #define ASM_OUTPUT_ALIGN(FILE,LOG) \ 501 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
523 do { if (LOG!=0) fprintf (FILE, "\t.align\t%d\n", (LOG)); } while (0) 502 do { if (LOG!=0) fprintf (FILE, "\t.align\t%d\n", (LOG)); } while (0)
524 503
525 504
526 /* Model costs for the vectorizer. */
527
528 /* Cost of conditional branch. */
529 #ifndef TARG_COND_BRANCH_COST
530 #define TARG_COND_BRANCH_COST 6
531 #endif
532
533 /* Cost of any scalar operation, excluding load and store. */
534 #ifndef TARG_SCALAR_STMT_COST
535 #define TARG_SCALAR_STMT_COST 1
536 #endif
537
538 /* Cost of scalar load. */
539 #undef TARG_SCALAR_LOAD_COST
540 #define TARG_SCALAR_LOAD_COST 2 /* load + rotate */
541
542 /* Cost of scalar store. */
543 #undef TARG_SCALAR_STORE_COST
544 #define TARG_SCALAR_STORE_COST 10
545
546 /* Cost of any vector operation, excluding load, store,
547 or vector to scalar operation. */
548 #undef TARG_VEC_STMT_COST
549 #define TARG_VEC_STMT_COST 1
550
551 /* Cost of vector to scalar operation. */
552 #undef TARG_VEC_TO_SCALAR_COST
553 #define TARG_VEC_TO_SCALAR_COST 1
554
555 /* Cost of scalar to vector operation. */
556 #undef TARG_SCALAR_TO_VEC_COST
557 #define TARG_SCALAR_TO_VEC_COST 1
558
559 /* Cost of aligned vector load. */
560 #undef TARG_VEC_LOAD_COST
561 #define TARG_VEC_LOAD_COST 1
562
563 /* Cost of misaligned vector load. */
564 #undef TARG_VEC_UNALIGNED_LOAD_COST
565 #define TARG_VEC_UNALIGNED_LOAD_COST 2
566
567 /* Cost of vector store. */
568 #undef TARG_VEC_STORE_COST
569 #define TARG_VEC_STORE_COST 1
570
571 /* Cost of vector permutation. */
572 #ifndef TARG_VEC_PERMUTE_COST
573 #define TARG_VEC_PERMUTE_COST 1
574 #endif
575
576
577 /* Misc */ 505 /* Misc */
578 506
579 #define CASE_VECTOR_MODE SImode 507 #define CASE_VECTOR_MODE SImode
580 508
581 #define MOVE_MAX 16 509 #define MOVE_MAX 16
587 #define Pmode SImode 515 #define Pmode SImode
588 516
589 #define FUNCTION_MODE QImode 517 #define FUNCTION_MODE QImode
590 518
591 #define NO_IMPLICIT_EXTERN_C 1 519 #define NO_IMPLICIT_EXTERN_C 1
592
593 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
594 520
595 /* Canonicalize a comparison from one we don't have to one we do have. */ 521 /* Canonicalize a comparison from one we don't have to one we do have. */
596 #define CANONICALIZE_COMPARISON(CODE,OP0,OP1) \ 522 #define CANONICALIZE_COMPARISON(CODE,OP0,OP1) \
597 do { \ 523 do { \
598 if (((CODE) == LE || (CODE) == LT || (CODE) == LEU || (CODE) == LTU)) \ 524 if (((CODE) == LE || (CODE) == LT || (CODE) == LEU || (CODE) == LTU)) \
606 532
607 533
608 /* Address spaces. */ 534 /* Address spaces. */
609 #define ADDR_SPACE_EA 1 535 #define ADDR_SPACE_EA 1
610 536
611 /* Named address space keywords. */
612 #define TARGET_ADDR_SPACE_KEYWORDS ADDR_SPACE_KEYWORD ("__ea", ADDR_SPACE_EA)
613
614 537
615 /* Builtins. */ 538 /* Builtins. */
616 539
617 enum spu_builtin_type 540 enum spu_builtin_type
618 { 541 {
623 B_HINT, 546 B_HINT,
624 B_OVERLOAD, 547 B_OVERLOAD,
625 B_INTERNAL 548 B_INTERNAL
626 }; 549 };
627 550
628 struct GTY(()) spu_builtin_description 551 struct spu_builtin_description
629 { 552 {
630 int fcode; 553 int fcode;
631 int icode; 554 int icode;
632 const char *name; 555 const char *name;
633 enum spu_builtin_type type; 556 enum spu_builtin_type type;
634 557
635 /* The first element of parm is always the return type. The rest 558 /* The first element of parm is always the return type. The rest
636 are a zero terminated list of parameters. */ 559 are a zero terminated list of parameters. */
637 int parm[5]; 560 int parm[5];
638
639 tree fndecl;
640 }; 561 };
641 562
642 extern struct spu_builtin_description spu_builtins[]; 563 extern struct spu_builtin_description spu_builtins[];
643 564