|
Message
From: Scott Furman<sfurman@r...>
Date: Tue Jan 27 07:32:43 CET 2004
Subject: [openrisc] gcc-3.2.3 bugs after merge
Skipped content of type multipart/alternative-------------- next part -------------- Index: gcc/config/or32/or32.c =================================================================== RCS file: /export/CVS/dave/tools/src/gcc-3.1/gcc/config/or32/or32.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -c -r1.1.1.1 -r1.2 *** gcc/config/or32/or32.c 2 Aug 2003 02:44:28 -0000 1.1.1.1 --- gcc/config/or32/or32.c 2 Aug 2003 04:56:59 -0000 1.2 *************** *** 377,382 **** --- 377,388 ---- default: abort (); } + else if (code == 'H') { + if (GET_CODE (x) == REG) + fprintf (file, "%s", reg_names[REGNO (x) + 1]); + else + abort(); + } else if (GET_CODE (x) == REG) fprintf (file, "%s", reg_names[REGNO (x)]); else if (GET_CODE (x) == MEM) *************** *** 387,389 **** --- 393,526 ---- output_addr_const (file, x); } } + + /*---------------------------------------------------------------------------*/ + /* Generate assembler code for a movdi/movdf */ + + char * + or1k_output_move_double(operands) + rtx *operands; + { + rtx xoperands[3]; + switch (GET_CODE (operands[0])) { + case REG: + if (GET_CODE (operands[1]) == REG) + { + if (REGNO (operands[0]) == REGNO (operands[1]) + 1) + { + output_asm_insn ("\tl.or \t%H0, %H1, r0", operands); + output_asm_insn ("\tl.or \t%0, %1, r0", operands); + return ""; + } + else + { + output_asm_insn ("\tl.or \t%0, %1, r0", operands); + output_asm_insn ("\tl.or \t%H0, %H1, r0", operands); + return ""; + } + } + else if (GET_CODE (operands[1]) == MEM) + { + xoperands[1] = XEXP (operands[1], 0); + if (GET_CODE (xoperands[1]) == REG) + { + xoperands[0] = operands[0]; + if (REGNO (xoperands[0]) == REGNO (xoperands[1])) + { + output_asm_insn ("\tl.lwz \t%H0, 4(%1)", xoperands); + output_asm_insn ("\tl.lwz \t%0, 0(%1)", xoperands); + return ""; + } + else + { + output_asm_insn ("\tl.lwz \t%0, 0(%1)", xoperands); + output_asm_insn ("\tl.lwz \t%H0, 4(%1)", xoperands); + return ""; + } + } + else if (GET_CODE (xoperands[1]) == PLUS) + { + if (GET_CODE (xoperands[2] = XEXP (xoperands[1], 1)) == REG) + { + xoperands[0] = operands[0]; + xoperands[1] = XEXP (xoperands[1], 0); + if (REGNO (xoperands[0]) == REGNO (xoperands[2])) + { + output_asm_insn ("\tl.lwz \t%H0, %1+4(%2)", xoperands); + output_asm_insn ("\tl.lwz \t%0, %1(%2)", xoperands); + return ""; + } + else + { + output_asm_insn ("\tl.lwz \t%0, %1(%2)", xoperands); + output_asm_insn ("\tl.lwz \t%H0, %1+4(%2)", xoperands); + return ""; + } + } + else if (GET_CODE (xoperands[2] = XEXP (xoperands[1], 0)) == REG) + { + xoperands[0] = operands[0]; + xoperands[1] = XEXP (xoperands[1], 1); + if (REGNO (xoperands[0]) == REGNO (xoperands[2])) + { + output_asm_insn ("\tl.lwz \t%H0, %1+4(%2)", xoperands);
+ output_asm_insn ("\tl.lwz \t%0, %1(%2)", xoperands);
+ return "";
+ }
+ else
+ {
+ output_asm_insn ("\tl.lwz \t%0, %1(%2)", xoperands);
+ output_asm_insn ("\tl.lwz \t%H0, %1+4(%2)", xoperands);
+ return "";
+ }
+ }
+ else abort ();
+ }
+ else abort ();
+ }
+ else if (GET_CODE (operands[1]) == CONST_INT)
+ {
+ if (INTVAL (operands[1]) < 0)
+ output_asm_insn ("\tl.addi \t%0, r0, -1", operands);
+ else
+ output_asm_insn ("\tl.or \t%0, r0, r0", operands);
+ output_asm_insn ("\tl.movhi \t%H0, hi(%1)", operands);
+ output_asm_insn ("\tl.ori \t%H0, %H0, lo(%1)", operands);
+ return "";
+ }
+ else abort ();
+ case MEM:
+ xoperands[0] = XEXP (operands[0], 0);
+ if (GET_CODE (xoperands[0]) == REG)
+ {
+ xoperands[1] = operands[1];
+ output_asm_insn ("\tl.sw \t0(%0), %1", xoperands);
+ output_asm_insn ("\tl.sw \t4(%0), %H1", xoperands);
+ return "";
+ }
+ else if (GET_CODE (xoperands[0]) == PLUS)
+ {
+ if (GET_CODE (xoperands[1] = XEXP (xoperands[0], 1)) == REG)
+ {
+ xoperands[0] = XEXP (xoperands[0], 0);
+ xoperands[2] = operands[1];
+ output_asm_insn ("\tl.sw \t%0(%1), %2", xoperands);
+ output_asm_insn ("\tl.sw \t%0+4(%1), %H2", xoperands);
+ return "";
+ }
+ else if (GET_CODE (xoperands[1] = XEXP (xoperands[0], 0)) == REG)
+ {
+ xoperands[0] = XEXP (xoperands[0], 1);
+ xoperands[2] = operands[1];
+ output_asm_insn ("\tl.sw \t%0(%1), %2", xoperands);
+ output_asm_insn ("\tl.sw \t%0+4(%1), %H2", xoperands);
+ return "";
+ }
+ else abort ();
+ }
+ else abort ();
+ default:
+ abort ();
+ }
+ }
+
Index: gcc/config/or32/or32.h
===================================================================
RCS file: /export/CVS/dave/tools/src/gcc-3.1/gcc/config/or32/or32.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 or32.h
*** gcc/config/or32/or32.h 2 Aug 2003 02:44:28 -0000 1.1.1.1
--- gcc/config/or32/or32.h 27 Jan 2004 05:42:37 -0000
***************
*** 268,274 ****
#define FRAME_POINTER_REQUIRED 0
/* Debug without frame pointer */
! #define CAN_DEBUG_WITHOUT_FP 1
#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
{ int regno; \
--- 268,274 ----
#define FRAME_POINTER_REQUIRED 0
/* Debug without frame pointer */
! /* #define CAN_DEBUG_WITHOUT_FP 1 */
#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
{ int regno; \
***************
*** 291,297 ****
/* Register in which address to store a structure value
is passed to a function. */
! #define STRUCT_VALUE_REGNUM 0
/* Define the classes of registers for register constraints in the
machine description. Also define ranges of constants.
--- 291,300 ----
/* Register in which address to store a structure value
is passed to a function. */
! /*#define STRUCT_VALUE_REGNUM 0*/
!
! /* Pass address of result struct to callee as "invisible" first argument */
! #define STRUCT_VALUE 0
/* Define the classes of registers for register constraints in the
machine description. Also define ranges of constants.
***************
*** 459,479 ****
otherwise, FUNC is 0. */
/* Return value is in R11. */
!
! #define FUNCTION_VALUE(VALTYPE, FUNC) \
! gen_rtx (REG, TYPE_MODE (VALTYPE), GP_ARG_RETURN)
/* Define how to find the value returned by a library function
assuming the value has mode MODE. */
/* Return value is in R11. */
! #define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, GP_ARG_RETURN)
/* Define this if PCC uses the nonreentrant convention for returning
structure and union values. */
! #define PCC_STATIC_STRUCT_RETURN
/* 1 if N is a possible register number for a function value.
R3 to R8 are possible (set to 1 in CALL_USED_REGISTERS) */
--- 462,486 ----
otherwise, FUNC is 0. */
/* Return value is in R11. */
! #define FUNCTION_VALUE(VALTYPE, FUNC) LIBCALL_VALUE (TYPE_MODE (VALTYPE))
/* Define how to find the value returned by a library function
assuming the value has mode MODE. */
/* Return value is in R11. */
! #define LIBCALL_VALUE(MODE) \
! gen_rtx (REG, \
! ((GET_MODE_CLASS (MODE) != MODE_INT \
! || GET_MODE_SIZE (MODE) >= 4) \
! ? (MODE) \
! : SImode), \
! GP_ARG_RETURN)
/* Define this if PCC uses the nonreentrant convention for returning
structure and union values. */
! /*#define PCC_STATIC_STRUCT_RETURN */
/* 1 if N is a possible register number for a function value.
R3 to R8 are possible (set to 1 in CALL_USED_REGISTERS) */
***************
*** 513,541 ****
((CUM) = 0)
/* Define intermediate macro to compute the size (in registers) of an argument
! for the or1k. */
!
! #define OR1K_ARG_SIZE(MODE, TYPE, NAMED) \
! ((MODE) != BLKmode \
! ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \
! : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
!
! /* Define this to make a argumet copy and pass argument by reference */
#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
! OR1K_ARG_SIZE((MODE), (TYPE), (NAMED)) > 1
/* Update the data in CUM to advance over an argument
of mode MODE and data type TYPE.
(TYPE is null for libcalls where that information may not be available.) */
! #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
! if (MUST_PASS_IN_STACK (MODE, TYPE)) \
! (CUM) = GP_ARG_NUM_REG; \
! else \
! (CUM) += OR1K_ARG_SIZE (MODE, TYPE, NAMED)
! /* Define where to put the arguments to a function.
Value is zero to push the argument on the stack,
or a hard register in which to store the argument.
--- 520,585 ----
((CUM) = 0)
/* Define intermediate macro to compute the size (in registers) of an argument
! for the or1k. */
+ /* The ROUND_ADVANCE* macros are local to this file. */
+ /* Round SIZE up to a word boundary. */
+ #define ROUND_ADVANCE(SIZE) \
+ (((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
+
+ /* Round arg MODE/TYPE up to the next word boundary. */
+ #define ROUND_ADVANCE_ARG(MODE, TYPE) \
+ ((MODE) == BLKmode \
+ ? ROUND_ADVANCE (int_size_in_bytes (TYPE)) \
+ : ROUND_ADVANCE (GET_MODE_SIZE (MODE)))
+
+ /* Round CUM up to the necessary point for argument MODE/TYPE. */
+ /* This is either rounded to nearest reg or nearest double-reg boundary */
+ #define ROUND_ADVANCE_CUM(CUM, MODE, TYPE) \
+ ((((MODE) == BLKmode ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) \
+ > BITS_PER_WORD) \
+ ? (((CUM) + 1) & ~1) \
+ : (CUM))
+
+ /* A C expression that indicates when an argument must be passed by
+ reference. If nonzero for an argument, a copy of that argument is
+ made in memory and a pointer to the argument is passed instead of
+ the argument itself. The pointer is passed in whatever way is
+ appropriate for passing a pointer to that type. */
+ /* All aggregates and arguments greater than 8 bytes are passed this way. */
#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
! (TYPE \
! && (AGGREGATE_TYPE_P (TYPE) \
! || int_size_in_bytes (TYPE) > 8))
/* Update the data in CUM to advance over an argument
of mode MODE and data type TYPE.
(TYPE is null for libcalls where that information may not be available.) */
! /* Update the data in CUM to advance over an argument
! of mode MODE and data type TYPE.
! (TYPE is null for libcalls where that information may not be available.) */
! #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
! ((CUM) = (ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) \
! + ROUND_ADVANCE_ARG ((MODE), (TYPE))))
! /* Return boolean indicating arg of type TYPE and mode MODE will be passed in
! a reg. This includes arguments that have to be passed by reference as the
! pointer to them is passed in a reg if one is available (and that is what
! we're given).
! When passing arguments NAMED is always 1. When receiving arguments NAMED
! is 1 for each argument except the last in a stdarg/varargs function. In
! a stdarg function we want to treat the last named arg as named. In a
! varargs function we want to treat the last named arg (which is
! `__builtin_va_alist') as unnamed.
! This macro is only used in this file. */
! #define PASS_IN_REG_P(CUM, MODE, TYPE, NAMED) \
! ((NAMED) \
! && ((ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) \
! + ROUND_ADVANCE_ARG ((MODE), (TYPE)) \
! <= GP_ARG_NUM_REG)))
!
! /* Determine where to put an argument to a function.
Value is zero to push the argument on the stack,
or a hard register in which to store the argument.
***************
*** 547,566 ****
the preceding args and about the function being called.
NAMED is nonzero if this argument is a named parameter
(otherwise it is an extra parameter matching an ellipsis). */
!
! #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
! (((CUM) < GP_ARG_NUM_REG && TYPE != void_type_node && !MUST_PASS_IN_STACK (MODE, TYPE) && (NAMED)) \
! ? gen_rtx_REG ((MODE), (CUM) + GP_ARG_MIN_REG) \
: 0)
/* For an arg passed partly in registers and partly in memory,
this is the number of registers used.
For args passed entirely in registers or entirely in memory, zero. */
! #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
! ((CUM) < GP_ARG_NUM_REG && \
! GP_ARG_NUM_REG < (CUM) + OR1K_ARG_SIZE (MODE, TYPE, NAMED) \
! ? GP_ARG_NUM_REG - (CUM) : 0)
/* Output assembler code to FILE to increment profiler label # LABELNO
for profiling a function entry. */
--- 591,608 ----
the preceding args and about the function being called.
NAMED is nonzero if this argument is a named parameter
(otherwise it is an extra parameter matching an ellipsis). */
! /* On the ARC the first MAX_ARC_PARM_REGS args are normally in registers
! and the rest are pushed. */
! #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
! (PASS_IN_REG_P ((CUM), (MODE), (TYPE), (NAMED)) \
! ? gen_rtx_REG ((MODE), ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) + GP_ARG_MIN_REG) \
: 0)
/* For an arg passed partly in registers and partly in memory,
this is the number of registers used.
For args passed entirely in registers or entirely in memory, zero. */
! #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
/* Output assembler code to FILE to increment profiler label # LABELNO
for profiling a function entry. */
***************
*** 729,738 ****
/* #define CASE_VECTOR_PC_RELATIVE 1 */
/* Specify the tree operation to be used to convert reals to integers. */
! /* #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR */
/* This is the kind of divide that is easiest to do in the general case. */
! /* #define EASY_DIV_EXPR TRUNC_DIV_EXPR */
/* Define this as 1 if `char' should by default be signed; else as 0. */
#define DEFAULT_SIGNED_CHAR 1
--- 771,780 ----
/* #define CASE_VECTOR_PC_RELATIVE 1 */
/* Specify the tree operation to be used to convert reals to integers. */
! #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
/* This is the kind of divide that is easiest to do in the general case. */
! #define EASY_DIV_EXPR TRUNC_DIV_EXPR
/* Define this as 1 if `char' should by default be signed; else as 0. */
#define DEFAULT_SIGNED_CHAR 1
***************
*** 1149,1158 ****
/* Define the parentheses used to group arithmetic operations
in assembler code. */
- /*
#define ASM_OPEN_PAREN "("
#define ASM_CLOSE_PAREN ")"
- */
/* Macro for %code validation. Returns nonzero if valid. */
#define PRINT_OPERAND_PUNCT_VALID_P(code) print_operand_punct_valid_p(code)
--- 1191,1198 ----
Index: gcc/config/or32/or32.md
===================================================================
RCS file: /export/CVS/dave/tools/src/gcc-3.1/gcc/config/or32/or32.md,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** gcc/config/or32/or32.md 2 Aug 2003 02:44:28 -0000 1.1.1.1
--- gcc/config/or32/or32.md 2 Aug 2003 04:56:59 -0000 1.2
***************
*** 153,175 ****
;; Moves
;;
! (define_insn "movdf" [(set (match_operand:DF 0 "general_operand" "=r,r,m")
! (match_operand:DF 1 "general_operand" "r,m,r"))]
! ""
! "*
! switch(which_alternative)
! {
! case 0:
! return \"l.addi \\t%0,%1,0\\t # fake insn for handling DF\";
! case 1:
! return \"l.lwz \\t%0,%1\\t # fake insn for handling DF\";
! case 2:
! return \"l.sw \\t%0,%1\\t # fake insn for handling DF\";
! default:
! return \"invalid alternative\";
! }"
! [(set_attr "type" "move,load,store")
! (set_attr "length" "1,1,1")])
(define_insn "movsf"
[(set (match_operand:SF 0 "general_operand" "=r,r,m")
--- 153,193 ----
;; Moves
;;
! (define_insn "movdi"
! [(set (match_operand:DI 0 "nonimmediate_operand" "=r, r, m, r")
! (match_operand:DI 1 "general_operand" " r, m, r, i"))]
! ""
! "*
! return or1k_output_move_double (operands);
! "
! [(set_attr "length" "2,2,2,3")])
!
! (define_insn "movdf"
! [(set (match_operand:DF 0 "nonimmediate_operand" "=r, r, m, r")
! (match_operand:DF 1 "general_operand" " r, m, r, i"))]
! ""
! "*
! return or1k_output_move_double (operands);
! "
! [(set_attr "length" "2,2,2,3")])
!
! ;; (define_insn "movdf" [(set (match_operand:DF 0 "general_operand" "=r,r,m")
! ;; (match_operand:DF 1 "general_operand" "r,m,r"))]
! ;; ""
! ;; "*
! ;; switch(which_alternative)
! ;; {
! ;; case 0:
! ;; return \"l.addi \\t%0,%1,0\\t # fake insn for handling DF\";
! ;; case 1:
! ;; return \"l.lwz \\t%0,%1\\t # fake insn for handling DF\";
! ;; case 2:
! ;; return \"l.sw \\t%0,%1\\t # fake insn for handling DF\";
! ;; default:
! ;; return \"invalid alternative\";
! ;; }"
! ;; [(set_attr "type" "move,load,store")
! ;; (set_attr "length" "1,1,1")])
(define_insn "movsf"
[(set (match_operand:SF 0 "general_operand" "=r,r,m")
***************
*** 600,606 ****
[(set (match_operand:SI 0 "register_operand" "=r")
(mult:SI (match_operand:SI 1 "register_operand" "r")
(match_operand:SI 2 "register_operand" "r")))]
! "TARGET_HARD_MUL"
"l.mul \\t%0,%1,%2"
[(set_attr "type" "mul")
(set_attr "length" "1")])
--- 618,624 ----
[(set (match_operand:SI 0 "register_operand" "=r")
(mult:SI (match_operand:SI 1 "register_operand" "r")
(match_operand:SI 2 "register_operand" "r")))]
! ""
"l.mul \\t%0,%1,%2"
[(set_attr "type" "mul")
(set_attr "length" "1")])
|
 |