[PATCH] Add new model m32r2 of Renesas M32R.

Nick Clifton nickc@redhat.com
Tue Dec 16 14:55:00 GMT 2003
Hi Kazuhiro,

Ok - I am attaching a patch which I think takes care of all of these
issues.  With this patch applied I get the following results.  (I have
included some notes about the results as well).  This is the first
test case:

  % cat parallel.s
	.text
	.global parallel
  parallel:
	mv r1,r0 || mv r2,r1

First of all, I just tried assembling it normally:
        
  % m32r-elf-gas parallel.s
  parallel1.s:4: Error: 'mv r1,r0||mv r2,r1': only the NOP instruction \
   can be issued in parallel on the m32r 
  
In this case no output file is produced.  The point here is that this
patch only applies when the assembler is operating in m32rx or m32r2
mode. 

  % m32r-elf-gas -m32rx parallel.s
  parallel.s:4: Warning: mv r1,r0||mv r2,r1: output of 1st instruction \
   is the same as an input to 2nd instruction - is this intentional ?
  
In this case an output file is produced.  So the default behaviour for
the assembler is to produce a warning message.
      
  % m32r-elf-gcc -m32rx -c parallel.s

In this case an output file is produced.  This shows that the default
behaviour for the compiler is to invoke the assembler with the -Wnp
option so that the warning message is suppressed.

  % m32r-elf-gas -m32rx -Ep parallel.s
  parallel.s:4: Warning: mv r1,r0||mv r2,r1: output of 1st instruction \
   is the same as an input to 2nd instruction - is this intentional ? 

In this case an output file is produced.  This shows how the -Ep
no longer has any affect on the warning message about input and output
operands overlapping.  I believe that this is what you wanted ?

  % m32r-elf-gas -m32rx -Enp parallel.s
  parallel.s:4: Warning: mv r1,r0||mv r2,r1: output of 1st instruction \
   is the same as an input to 2nd instruction - is this intentional ? 

Similarly the -Enp switch has no effect on this test case.

Now if we look at the second test case:

  % cat parallel.s
	.text
	.global parallel
  parallel:
	mv r1,r0 || mv r1,r2

and assemble it without any special switches:

  % m32r-elf-gas -m32rx parallel.s
  parallel.s:4: Error: 'mv r1,r0||mv r1,r2': instructions write to the \
   same destination register. 

we get the expected error message, and no output file.  If we try to
suppress the message using -Wnp we get:

  % m32r-elf-gas -m32rx -Wnp parallel.s
  parallel.s:4: Error: 'mv r1,r0||mv r1,r2': instructions write to the \
   same destination register. 

ie no effect.  The -Wnp option has no effect because this is definitely
an illegal instruction combination.  If however we use the -Enp
switch:

  % m32r-elf-gas -m32rx -Enp parallel.s

it assembles, and produces an output file


Are you happy with this behaviour ?
Would you like me to install the patch ?

Cheers
        Nick
-------------------------------------------------------------------------
gas/ChangeLog
2003-12-16  Nick Clifton  <nickc@redhat.com>

	* config/tc-m32r.c (md_parse_option): Separate the
	warn_explicit and error_explicit parallel conflicts options.
        (md_show_usage): Update descriptions of these options.
        (can_make_parallel): Do not run checks for overlapping
	destinations if error_explicit_parallel_conflicts is false.
        (assemble_two_insns): Ignore error_explicit_parallel_conflicts
        * doc/c-m32r.texi: Update descriptions of the options.
        
gas/testsuite/ChangeLog
2003-12-16  Nick Clifton  <nickc@redhat.com>

	* gas/m32r/error.exp: Add parallel.s
        * gas/m32r/parallel.s: New file: Test warning and error
        messages produced for parallel conflicts.

Index: gas/config/tc-m32r.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m32r.c,v
retrieving revision 1.32
diff -c -3 -p -r1.32 tc-m32r.c
*** gas/config/tc-m32r.c	3 Dec 2003 17:38:45 -0000	1.32
--- gas/config/tc-m32r.c	16 Dec 2003 13:05:56 -0000
*************** static int enable_special_float = 0;
*** 117,123 ****
  static int warn_explicit_parallel_conflicts = 1;
  
  /* Non-zero if the programmer should receive an error message when an
!    explicit parallel instruction might have constraint violations.  */
  static int error_explicit_parallel_conflicts = 1;
  
  /* Non-zero if insns can be made parallel.  */
--- 117,125 ----
  static int warn_explicit_parallel_conflicts = 1;
  
  /* Non-zero if the programmer should receive an error message when an
!    explicit parallel instruction defintely does have constraint violations.
!    The ability to suppress this error message is intended only for hardware
!    vendors testing the chip.  It is distinct from the -Wnp switch.  */ 
  static int error_explicit_parallel_conflicts = 1;
  
  /* Non-zero if insns can be made parallel.  */
*************** md_parse_option (c, arg)
*** 318,339 ****
  
      case OPTION_WARN_PARALLEL:
        warn_explicit_parallel_conflicts = 1;
-       error_explicit_parallel_conflicts = 0;
        break;
  
      case OPTION_NO_WARN_PARALLEL:
        warn_explicit_parallel_conflicts = 0;
-       error_explicit_parallel_conflicts = 0;
        break;
  
      case OPTION_ERROR_PARALLEL:
-       warn_explicit_parallel_conflicts = 1;
        error_explicit_parallel_conflicts = 1;
        break;
  
      case OPTION_NO_ERROR_PARALLEL:
        error_explicit_parallel_conflicts = 0;
-       warn_explicit_parallel_conflicts = 0;
        break;
  
      case OPTION_SPECIAL:
--- 320,337 ----
*************** md_show_usage (stream)
*** 406,416 ****
    fprintf (stream, _("\
    -warn-explicit-parallel-conflicts     warn when parallel instructions\n"));
    fprintf (stream, _("\
!                                          violate contraints\n"));
    fprintf (stream, _("\
    -no-warn-explicit-parallel-conflicts  do not warn when parallel\n"));
    fprintf (stream, _("\
!                                          instructions violate contraints\n"));
    fprintf (stream, _("\
    -Wp                     synonym for -warn-explicit-parallel-conflicts\n"));
    fprintf (stream, _("\
--- 404,414 ----
    fprintf (stream, _("\
    -warn-explicit-parallel-conflicts     warn when parallel instructions\n"));
    fprintf (stream, _("\
!                                          might violate contraints\n"));
    fprintf (stream, _("\
    -no-warn-explicit-parallel-conflicts  do not warn when parallel\n"));
    fprintf (stream, _("\
!                                          instructions might violate contraints\n"));
    fprintf (stream, _("\
    -Wp                     synonym for -warn-explicit-parallel-conflicts\n"));
    fprintf (stream, _("\
*************** md_show_usage (stream)
*** 418,428 ****
    fprintf (stream, _("\
    -error-explicit-parallel-conflicts     error when parallel instructions\n"));
    fprintf (stream, _("\
!                                          violate contraints\n"));
    fprintf (stream, _("\
    -no-error-explicit-parallel-conflicts  do not error when parallel\n"));
    fprintf (stream, _("\
!                                          instructions violate contraints\n"));
    fprintf (stream, _("\
    -Ep                     synonym for -error-explicit-parallel-conflicts\n"));
    fprintf (stream, _("\
--- 416,426 ----
    fprintf (stream, _("\
    -error-explicit-parallel-conflicts     error when parallel instructions\n"));
    fprintf (stream, _("\
!                                          definitely violate contraints\n"));
    fprintf (stream, _("\
    -no-error-explicit-parallel-conflicts  do not error when parallel\n"));
    fprintf (stream, _("\
!                                          instructions definitely violate contraints\n"));
    fprintf (stream, _("\
    -Ep                     synonym for -error-explicit-parallel-conflicts\n"));
    fprintf (stream, _("\
*************** can_make_parallel (a, b)
*** 869,876 ****
        || CGEN_FIELDS_BITSIZE (&b->fields) != 16)
      abort ();
  
!   if (first_writes_to_seconds_operands (a, b, TRUE))
!     return _("Instructions write to the same destination register.");
  
    a_pipe = CGEN_INSN_ATTR_VALUE (a->insn, CGEN_INSN_PIPE);
    b_pipe = CGEN_INSN_ATTR_VALUE (b->insn, CGEN_INSN_PIPE);
--- 867,875 ----
        || CGEN_FIELDS_BITSIZE (&b->fields) != 16)
      abort ();
  
!   if (error_explicit_parallel_conflicts
!       && first_writes_to_seconds_operands (a, b, TRUE))
!     return _("instructions write to the same destination register.");
  
    a_pipe = CGEN_INSN_ATTR_VALUE (a->insn, CGEN_INSN_PIPE);
    b_pipe = CGEN_INSN_ATTR_VALUE (b->insn, CGEN_INSN_PIPE);
*************** assemble_two_insns (str, str2, parallel_
*** 1154,1170 ****
  
    if (parallel_p && warn_explicit_parallel_conflicts)
      {
-       void (* func)(const char *, ...);
- 
-       func = error_explicit_parallel_conflicts ? as_bad : as_warn;
- 
        if (first_writes_to_seconds_operands (&first, &second, FALSE))
  	/* xgettext:c-format  */
! 	func (_("%s: output of 1st instruction is the same as an input to 2nd instruction - is this intentional ?"), str2);
  
        if (first_writes_to_seconds_operands (&second, &first, FALSE))
  	/* xgettext:c-format  */
! 	func (_("%s: output of 2nd instruction is the same as an input to 1st instruction - is this intentional ?"), str2);
      }
  
    if (!parallel_p
--- 1153,1165 ----
  
    if (parallel_p && warn_explicit_parallel_conflicts)
      {
        if (first_writes_to_seconds_operands (&first, &second, FALSE))
  	/* xgettext:c-format  */
! 	as_warn (_("%s: output of 1st instruction is the same as an input to 2nd instruction - is this intentional ?"), str2);
  
        if (first_writes_to_seconds_operands (&second, &first, FALSE))
  	/* xgettext:c-format  */
! 	as_warn (_("%s: output of 2nd instruction is the same as an input to 1st instruction - is this intentional ?"), str2);
      }
  
    if (!parallel_p

Index: gas/doc/c-m32r.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/c-m32r.texi,v
retrieving revision 1.7
diff -c -3 -p -r1.7 c-m32r.texi
*** gas/doc/c-m32r.texi	3 Dec 2003 17:38:46 -0000	1.7
--- gas/doc/c-m32r.texi	16 Dec 2003 13:05:57 -0000
*************** questionable parallel instructions are e
*** 119,145 ****
  This is a shorter synonym for the @emph{-no-warn-explicit-parallel-conflicts}
  option.
  
- @item -error-explicit-parallel-conflicts
- @cindex @samp{-error-explicit-parallel-conflicts} option, M32RX
- This option performs the same thing as the
- @emph{-warn-explicit-parallel-conflicts} expcept that instead of
- warning messages being produced, error messages will be produced.  If
- any error messages are generated then GAS will not produce an output
- file.
- 
  @item -no-error-explicit-parallel-conflicts
  @cindex @samp{-no-error-explicit-parallel-conflicts} option, M32RX
! This option disables a previously enabled
! @emph{-error-explicit-parallel-conflicts} option.
  
! @item -Ep
! @cindex @samp{-Ep} option, M32RX
! This is a shorter synonym for the @emph{-error-explicit-parallel-conflicts}
! option.
  
  @item -Enp
  @cindex @samp{-Enp} option, M32RX
  This is a shorter synonym for the @emph{-no-error-explicit-parallel-conflicts}
  option.
  
  @item -warn-unmatched-high
--- 119,145 ----
  This is a shorter synonym for the @emph{-no-warn-explicit-parallel-conflicts}
  option.
  
  @item -no-error-explicit-parallel-conflicts
  @cindex @samp{-no-error-explicit-parallel-conflicts} option, M32RX
! This option stops the compiler from producing an error message when
! two parallel operations write to the same destination register.  This
! ability is provided for hardware vendors testing chip designs and
! should not be used under normal circumstances.
  
! @item -error-explicit-parallel-conflicts
! @cindex @samp{-error-explicit-parallel-conflicts} option, M32RX
! This option restores the assembler's default behaviour of reporting
! error messages when two parallel instructions write to the same
! destination register.
  
  @item -Enp
  @cindex @samp{-Enp} option, M32RX
  This is a shorter synonym for the @emph{-no-error-explicit-parallel-conflicts}
+ option.
+ 
+ @item -Ep
+ @cindex @samp{-Ep} option, M32RX
+ This is a shorter synonym for the @emph{-error-explicit-parallel-conflicts}
  option.
  
  @item -warn-unmatched-high
  
Index: gas/testsuite/gas/m32r/error.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/m32r/error.exp,v
retrieving revision 1.1
diff -c -3 -p -r1.1 error.exp
*** gas/testsuite/gas/m32r/error.exp	5 Oct 1999 01:27:35 -0000	1.1
--- gas/testsuite/gas/m32r/error.exp	16 Dec 2003 13:05:58 -0000
*************** if [istarget m32r-*-*] {
*** 9,14 ****
--- 9,15 ----
      dg-runtest "$srcdir/$subdir/wrongsize.s" "" ""
      dg-runtest "$srcdir/$subdir/interfere.s" "" ""
      dg-runtest "$srcdir/$subdir/outofrange.s" "" ""
+     dg-runtest "$srcdir/$subdir/parallel.s" "" ""
  
      dg-finish

*** /dev/null	2003-01-30 10:24:37.000000000 +0000
--- gas/testsuite/gas/m32r/parallel.s	2003-12-16 12:58:08.000000000 +0000
***************
*** 0 ****
--- 1,14 ----
+ ; Test error messages where parallel instructions conflict
+ 
+ ; { dg-options "-m32rx" }
+ ; { dg-do assemble { target m32r-*-* } }
+ 
+ 	.text
+ 	.global parallel
+ parallel:
+ 	mv r1,r0 || mv r2,r1
+ 	; { dg-warning "output of 1st instruction" "parallel output overlaps input" { target *-*-* } { 9 } }
+ 	mv r1,r0 || mv r0,r2
+ 	; { dg-warning "output of 2nd instruction" "parallel output overlaps input" { target *-*-* } { 11 } }
+ 	mv r1,r0 || mv r1,r2
+ 	; { dg-error "instructions write to the same destination register" "parallel overlapping destinations" { target *-*-* } { 13 } }
        



More information about the Binutils mailing list