This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


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

RFA: new command line switch for MIPS assembler


Hi Ulf,

:  > 	* doc/c-mips.texi (MIPS Opts): Document the new command line
:  > 	switch.
: 
: I don't understand from reading the documentation whether the option
: is enabled or disabled by default.  It's just confusing to me.

OK - I have rewritten the documentation to try to make this clearer.

:  >   
:  > + static int enable_float_construction = 1;
:  > + 
:  >   /* Non-zero if any .set noreorder directives were used.  */
:  >   
:  >   static int mips_any_noreorder;
: 
: A comment wouldn't hurt here.  I'd prefer an option with the name
: mips_no_float_construction and then default to not set, but that's
: just a personal opinion.

OK, all three of these things have been done.

:  > + #define OPTION_CONSTRUCT_FLOATS (OPTION_MD_BASE + 39)
:  > +   {"construct-floats", no_argument, NULL, OPTION_CONSTRUCT_FLOATS},
:  > + 
:  > + #define OPTION_NO_CONSTRUCT_FLOATS (OPTION_MD_BASE + 40)
:  > +   {"no-construct-floats", no_argument, NULL, OPTION_NO_CONSTRUCT_FLOATS},
:  > + 
:  >   #define OPTION_CALL_SHARED (OPTION_MD_BASE + 7)
:  >   #define OPTION_NON_SHARED (OPTION_MD_BASE + 8)
:  >   #define OPTION_XGOT (OPTION_MD_BASE + 19)
: 
: I don't think reusing the magic number for another option is a good
: idea, or am I missing something?

Oops - my bad.  I imported patch from an old branch which did not have
a magic number 39...

Revised patch below.  Is it OK to apply ?

Cheers
	Nick

2000-07-14  Nick Clifton  <nickc@cygnus.com>

	* config/tc-mips.c (mips_disable_float_construction): New
	static variable.  Set to true if doubles should not be
	constructed by loading two single width fp registers with
	halves of the value.
	(mips_ip): Test mips_disable_float_construction.
	(md_longopts): Add command line switches --construct-floats
	and --no-construct-floats.
	(md_parse_option): Parse new command line options.
	(md_show_usage): Describe new command line options.

	* doc/c-mips.texi: Document new command line options.

Index: config/tc-mips.c
===================================================================
RCS file: /cvs/src//src/gas/config/tc-mips.c,v
retrieving revision 1.21
diff -p -r1.21 tc-mips.c
*** tc-mips.c	2000/07/07 16:58:24	1.21
--- tc-mips.c	2000/07/14 21:05:09
*************** static int mips_big_got;
*** 313,318 ****
--- 313,326 ----
     instructions.  */
  static int mips_trap;
  
+ /* 1 if double width floating point constants should not be constructed
+    by a assembling two single width halves into two single width floating
+    point registers which just happen to alias the double width destination
+    register.  On some architectures this aliasing can be disabled by a bit
+    in the status register, and the settin gof this bit cannot be determined
+    automatically at assemble time.  */
+ static int mips_disable_float_construction;
+ 
  /* Non-zero if any .set noreorder directives were used.  */
  
  static int mips_any_noreorder;
*************** mips_ip (str, ip)
*** 7601,7606 ****
--- 7609,7615 ----
  		      imm_expr.X_add_number = bfd_getb32 (temp);
  		  }
  		else if (length > 4
+ 			 && ! mips_disble_float_construction
  			 && ((temp[0] == 0 && temp[1] == 0)
  			     || (temp[2] == 0 && temp[3] == 0))
  			 && ((temp[4] == 0 && temp[5] == 0)
*************** struct option md_longopts[] = {
*** 8866,8871 ****
--- 8875,8886 ----
  #define OPTION_NO_M7000_HILO_FIX (OPTION_MD_BASE + 40)
    {"no-fix-7000", no_argument, NULL, OPTION_NO_M7000_HILO_FIX},
  
+ #define OPTION_CONSTRUCT_FLOATS (OPTION_MD_BASE + 41)
+   {"construct-floats", no_argument, NULL, OPTION_CONSTRUCT_FLOATS},
+ 
+ #define OPTION_NO_CONSTRUCT_FLOATS (OPTION_MD_BASE + 42)
+   {"no-construct-floats", no_argument, NULL, OPTION_NO_CONSTRUCT_FLOATS},
+ 
  #define OPTION_CALL_SHARED (OPTION_MD_BASE + 7)
  #define OPTION_NON_SHARED (OPTION_MD_BASE + 8)
  #define OPTION_XGOT (OPTION_MD_BASE + 19)
*************** md_parse_option (c, arg)
*** 8896,8901 ****
--- 8911,8924 ----
  {
    switch (c)
      {
+     case OPTION_CONSTRUCT_FLOATS:
+       mips_disable_float_construction = 0;
+       break;
+       
+     case OPTION_NO_CONSTRUCT_FLOATS:
+       mips_disable_float_construction = 1;
+       break;
+       
      case OPTION_TRAP:
        mips_trap = 1;
        break;
*************** MIPS options:\n\
*** 9338,9343 ****
--- 9361,9367 ----
    fprintf(stream, _("\
  -O0			remove unneeded NOPs, do not swap branches\n\
  -O			remove unneeded NOPs and swap branches\n\
+ --[no-]construct-floats [dis]allow floating point values to be constructed\n\
  --trap, --no-break	trap exception on div by 0 and mult overflow\n\
  --break, --no-trap	break exception on div by 0 and mult overflow\n"));
  #ifdef OBJ_ELF

Index: doc/c-mips.texi
===================================================================
RCS file: /cvs/src//src/gas/doc/c-mips.texi,v
retrieving revision 1.5
diff -p -r1.5 c-mips.texi
*** c-mips.texi	2000/06/16 19:11:27	1.5
--- c-mips.texi	2000/07/14 21:05:09
*************** other assemblers, which use it to turn o
*** 151,156 ****
--- 151,171 ----
  @sc{gnu} @code{@value{AS}}, there is no need for @samp{-nocpp}, because the
  @sc{gnu} assembler itself never runs the C preprocessor.
  
+ @item --construct-floats
+ @itemx --no-construct-floats
+ @cindex --construct-floats
+ @cindex --no-construct-floats
+ The @code{--no-construct-floats} option disables the construction of
+ double width floating point constants by loading the two halves of the
+ value into the two single width floating point registers that make up
+ the double width register.  This feature is useful if the processor
+ support the FR bit in its status  register, and this bit is known (by
+ the programmer) to be set.  This bit prevents the aliasing of the double
+ width register by the single width registers.
+ 
+ By default @code {--construct-floats} is selected, allowing construction
+ of these floating point constants.
+ 
  @item --trap
  @itemx --no-break
  @c FIXME!  (1) reflect these options (next item too) in option summaries;



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