This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Cray T3E support


2001-07-11  Roman Lechtchinsky  <rl@cs.tu-berlin.de>
+ static void unicosmk_output_deferred_case_vectors PARAMS ((FILE *));
+ static void unicosmk_gen_dsib PARAMS ((unsigned long *imaskP));
+ static void unicosmk_output_ssib PARAMS ((FILE *, const char *));
+ static int unicosmk_need_dex PARAMS ((rtx));

Declarations should be protected by #ifdef if their
definitions are.

+ /* Alphas are operated in big endian mode on the Cray T3E.  */
+ 
+ #undef BITS_BIG_ENDIAN
+ #undef BYTES_BIG_ENDIAN
+ #undef WORDS_BIG_ENDIAN
+ #define BITS_BIG_ENDIAN 1
+ #define BYTES_BIG_ENDIAN 1
+ #define WORDS_BIG_ENDIAN 1

You know, BITS_BIG_ENDIAN needn't follow BYTES_BIG_ENDIAN.
In fact, it appears that quite a lot of the ugliness of
the port would go away if BITS_BIG_ENDIAN were left as 0.

!       if (! ASSEMBLER_DIALECT && alpha_fptm >= ALPHA_FPTM_SU)
|  	fputs ("su", file);

This can't be right at all.  You can't just treat addt
and addt/su the same.  Is is that the assembler really
wants the slash?  If so, we can work around that -- the
slash is also accepted by other alpha assemblers.

I don't think there's any need whatsoever for multiple
assembler dialects.

! 	    emit_insn (gen_probe_stack (GEN_INT (TARGET_UNICOSMK
! 						 ? -probed + 64
! 						 : -probed)));

What is this for?  It definitely seems wrong.  If correct,
these sort of magicks ought to be commented.

!   else if (!TARGET_UNICOSMK && !flag_inhibit_size_directive)
|     {
|       fprintf (file, "\t.frame $%d,",

This is wrong.  -finhibit-size_directive exists so that one 
can do disgusting things hand mucking about with assembler
files.  It needn't produce totally Correct Output.

+   /* The Unicos/Mk assembler uses different register names. Instead of trying
+      to support them, we simply use micro definitions.  */

Why not change REGISTER_NAMES?

+   fputs ("\t.repeat (gcc@n@bytes - gcc@here) / 4\n", file);
+   fputs ("\tbis r31,r31,r31\n", file);

FWIW, for ev4 you're better off emitting pairs of

	bis r31,r31,31
	ldq_u r31,0(r31)

If you're going to use just one, ev5 prefers the
later; ev6 doesn't care either way.

+   /* Open a dummy section. We always need to be inside a section for the
+      section-switching code to work correctly.
+      ??? This should be a module id or something like that. I still have to
+      figure out what the rules for those are.  */

Can't the section-swtiching code know you havn't started
a section yet?  This seems silly.


+ #if HOST_BITS_PER_INT == 32
  #define REG_CLASS_CONTENTS	\
    { {0, 0}, {0x08000000, 0}, {~0, 0x80000000}, {0, 0x7fffffff}, {~0, ~0} }
+ #else /* HOST_BITS_PER_INT == 64 */
+ #define REG_CLASS_CONTENTS	\
+   { {0}, {0x08000000}, {0x80000000ffffffff}, {0x7fffffff00000000}, {~0} }
+ #endif

This is incorrect.  There should always be exactly 32 bits
per unit here -- I thought this was documented.  The bug is
in init_reg_sets.

+ ;; There is no mull instruction on the Cray T3E

WHAT!?!  Not even by a different name?  That is just _so_ broken.

And I suppose the restriction against putting data in code sections
means you can't synthesize this instruction with .long or the like...

+ (define_expand "divsi3_umk"
+   [(set (match_dup 3)
+ 	(sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
+    (set (match_dup 4)
+ 	(sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
+    (set (match_dup 5)
+ 	(div:DI (match_dup 3) (match_dup 4)))
+    (set (match_operand:SI 0 "nonimmediate_operand" "")
+ 	(subreg:SI (match_dup 5) 4))]

Um, I thought you were calling a library routine with normal
calling conventions?

!    fmov %1,%0
!    {fmov |cpys %1,}%1,%0

No need for assembler dialects, just change it.  Add a 
comment about unicos not knowing the "fmov" alias.

!   "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && ! TARGET_UNICOSMK

I guess we really should add a TARGET_OSF...

+ (define_split
+   [(set (match_operand:DI 0 "register_operand" "")
+ 	(match_operand:DI 1 "symbol_operand" ""))]
+   "TARGET_UNICOSMK && reload_completed"
+   [(set (match_dup 0)
+ 	(unspec:DI [(match_dup 1)] 7))
+    (set (match_dup 0)
+ 	(ashift:DI (match_dup 0) (const_int 32)))
+    (set (match_dup 0)
+ 	(plus:DI (match_dup 0)
+ 		 (unspec:DI [(match_dup 1)] 8)))
+    (set (match_dup 0)
+ 	(plus:DI (match_dup 0)
+ 		 (unspec:DI [(match_dup 1)] 9)))]

Don't bother putting anything here if you're going to just
implement it all in C anyway.

  (define_insn "*exception_receiver_1"
    [(unspec_volatile [(const_int 0)] 7)]
!   "! TARGET_LD_BUGGY_LDGP && ! TARGET_UNICOSMK"

Unnecessary -- you've already prevented it's generation at
exception_receiver.

+ /* Disable software floating point emulation because it requires a 16-bit
+    type which we do not have.  */
+ 
+ #undef REAL_ARITHMETIC

You could arrange for real.c to use attribute((mode(HI))) when
building with gcc.  That would fix this:

+ /* We have to define these because we do not use the floating-point
+    emulation. Unfortunately, atof does not accept hex literals.  */ 
+ 
+ #define REAL_VALUE_ATOF(x,s) atof(x)
+ #define REAL_VALUE_HTOF(x,s) atof(x)

+ /* Allocation boundary (in *bits*) for the code of a function. Functions
+    should be cache-aligned on the T3E.  */
+ 
+ #undef FUNCTION_BOUNDARY
+ #define FUNCTION_BOUNDARY 256

This is incorrect.  See how override_options sets align_functions.

+ /* The following two definitions are consistent with those in alpha.c except
+    that we include the frame pointer ($15) in both classes as it can't be
+    used as a general-purpose register even in functions which don't need a
+    frame pointer.  */

Why not handle this change with CONDITIONAL_REGISTER_USAGE?

+ /* We need this because -O2 sometimes tries to eliminate $15 loads/stores.  */
+ #undef CONDITIONAL_REGISTER_USAGE
+ #define CONDITIONAL_REGISTER_USAGE				\
+   do { global_regs[15] = 1; } while(0)

I'm not sure I completely understand this, but I'll let it go for
the moment.  However, you should only either need this or 

+ #define EPILOGUE_USES(REGNO)  ((REGNO) == 26 || (REGNO) == 15)

this, but not both.  Actually, as a guess I'll suggest you only
need EPILOGUE_USES, but you need your call patterns to USE r15.

+ /* Would have worked, only the stack doesn't seem to be executable

See how other ports call __enable_execute_stack.

+ #define ASM_OUTPUT_DOUBLE(FILE,VALUE)			\
+   do { int t[2];					\
+        REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t);	\
+        fprintf (FILE, "\t.quad ^X%x\n", t[0]);		\
+   } while(0)

This is incorrect for cross-compiling to unicos.

+ #define ASM_OUTPUT_FLOAT(FILE,VALUE)			\
+   do { int t;						\
+        REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t);	\
+        fprintf (FILE, "\t.long ^X%x\n", (t >> 32) & 0xffffffff);\
+   } while(0)

Likewise.

+ /* We can't output case vectors in the same section as the function code
+    because CAM doesn't allow data definitions in code sections. Thus, we
+    simply record the case vectors and put them in a separate section after
+    the function.  */
+ 
+ #define ASM_OUTPUT_ADDR_VEC(LAB,VEC) \
+   unicosmk_defer_case_vector ((LAB),(VEC))

We should add some generic support for this -- sparc has code to
do case vector deferral as well.

+ /* This is necessary because the standard library contains a function
+    named target.  */
+ 
+ #define target unicosmk_target

This isn't needed anymore -- target has been renamed targetm.



r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]