This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH] Add new model m32r2 of Renesas M32R.
Hi Nick,
At the first, I think that gas should behave the following.
Ex1) mv r1,r0 || mv r2,r1
Default behavior) Report warning and generate the code.
Warning: mv r1,r0||mv r2,r1: output of 1st instruction is the same as an
input to 2nd instruction
Use -Wnp) Not report warning and generate the code. (Compiler uses this
option.)
Ex2) mv r1,r0 || mv r1,r2
Default behavior) Report error and not generate the code.
Error: 'mv r1,r0||mv r1,r2': Instructions write to the same destination
register.
Use -Enp) Not report error and generate the WRONG code. (for illegal
execution test for chip)
> % m32r-elf-gas parallel.s -m32rx
> parallel.s:4: Error: mv r1,r0||mv r2,r1: output of 1st instruction is
the same as an input to 2nd instruction
> parallel.s:5: Error: 'mv r1,r0||mv r1,r2': Instructions write to the
same destination register.
The error for line 4 is not good because this case is not wrong code.
The value of an input to 2nd instruction is always kept before execution of
1st instruction.
The error for line 5 is good.
> % m32r-elf-gas parallel.s -m32rx -Ep
> parallel.s:4: Error: mv r1,r0||mv r2,r1: output of 1st instruction is
the same as an input to 2nd instruction
> parallel.s:5: Error: 'mv r1,r0||mv r1,r2': Instructions write to the
same destination register.
Ditto.
> % m32r-elf-gas parallel.s -m32rx -Enp
> parallel.s:5: Error: 'mv r1,r0||mv r1,r2': Instructions write to the
same destination register.
NG. We want to generate the WRONG code with -Enp. We don't need to report
error.
So general users should not use this option. Maybe We (Developper of chips)
need this option only.
> % m32r-elf-gas parallel.s -m32rx -Wp
> parallel.s:4: Warning: mv r1,r0||mv r2,r1: output of 1st instruction is
the same as an input to 2nd instruction
> parallel.s:5: Error: 'mv r1,r0||mv r1,r2': Instructions write to the
same destination register.
Ok.
> % m32r-elf-gas parallel.s -m32rx -Wnp
> parallel.s:5: Error: 'mv r1,r0||mv r1,r2': Instructions write to the
same destination register.
Ok.
Kazuhiro Inaoka
> Hi Kazuhiro,
>
> >> Where are the error messages ? If error_explicit_parallel_conflicts
> >> is true, then shouldn't an error message be generated rather than a
> >> warning ?
> > If error_explicit_parallel_conflicts is true, then any error will happen
any
> > where.
> >
> >> > + if ( check_outputs && !error_explicit_parallel_conflicts )
> >> > + return 0;
> >>
> >> What is the purpose of this ? It appears to mean that if
> >> error_explicit_parallel_conflicts is not true, then the code will not
> >> check for parallel conflicts, even if warn_explicit_parallel_conflicts
> >> it true.
> > This means that if error_explicit_parallel_conflicts is not true,
> > then the code will not check for any parallel conflicts.
> > This code will be wrong for general users, but we use it for error case
> > to test of developing chips. (same destination register .etc)
> > If they use -no-error-explicit-parallel-conflicts option, the code will
not
> > work.
> >
> > The case of parallel warning works correctly.
> > mv r1,r0 || mv r2,r1
> > Warning: output of 1st instruction is the same as an input to 2nd
> > instruction - is this intentional?
> >
> > The case of parallel error doesn't work.
> > mv r1,r0 || mv r1,r2
> > Error: Instructions write to the same destination register.
>
>
> I am sorry, but I still do not understand this. Surely the assembler
> is generating the correct error message for the "mv r1,r0 || mv r1,r2"
> test ? The two move instructions are writing to the same destination
> register.
>
> At the moment, (without applying your latest patches) I get the
> following (slightly trimmed) results when compiling this test program:
>
> % cat parallel.s
> .text
> .global parallel
> parallel:
> mv r1,r0 || mv r2,r1
> mv r1,r0 || mv r1,r2
>
> % m32r-elf-gas parallel.s -m32rx
> parallel.s:4: Error: mv r1,r0||mv r2,r1: output of 1st instruction is
the same as an input to 2nd instruction
> parallel.s:5: Error: 'mv r1,r0||mv r1,r2': Instructions write to the
same destination register.
>
> % m32r-elf-gas parallel.s -m32rx -Ep
> parallel.s:4: Error: mv r1,r0||mv r2,r1: output of 1st instruction is
the same as an input to 2nd instruction
> parallel.s:5: Error: 'mv r1,r0||mv r1,r2': Instructions write to the
same destination register.
>
> % m32r-elf-gas parallel.s -m32rx -Enp
> parallel.s:5: Error: 'mv r1,r0||mv r1,r2': Instructions write to the
same destination register.
>
> % m32r-elf-gas parallel.s -m32rx -Wp
> parallel.s:4: Warning: mv r1,r0||mv r2,r1: output of 1st instruction is
the same as an input to 2nd instruction
> parallel.s:5: Error: 'mv r1,r0||mv r1,r2': Instructions write to the
same destination register.
>
> % m32r-elf-gas parallel.s -m32rx -Wnp
> parallel.s:5: Error: 'mv r1,r0||mv r1,r2': Instructions write to the
same destination register.
>
> This appears to be correct to me. In all case the move instructions
> at line 5 are flagged as an error. By default the move instructions
> at line 4 are also flagged as errors, but if the -Enp or -Wnp switches
> are used they are ignored and if the -Wp switch is used, they are
> flagged as a warning, not an error.
>
> How do you think that the assembler should behave ?
>
> Cheers
> Nick