Message ID | 1435062156-28097-2-git-send-email-cederman@gaisler.com |
---|---|
State | New |
Headers | show |
Instead of introducing a new option which may conflict with an existing one, is it not possible to simply use -mno-user-mode? On 23/06/15 14:22, Daniel Cederman wrote: > The muser-mode flag causes the CASA instruction for LEON3 to use the > user mode ASI. This is the correct behavior for almost all LEON3 targets. > For this reason it makes sense to make user mode the default. This patch > adds a flag for supervisor mode that can be used on the very few LEON3 targets > that requires CASA to use the supervisor ASI. > > gcc/ChangeLog: > > 2015-06-22 Daniel Cederman <cederman@gaisler.com> > > * config/sparc/sparc.opt: Add supervisor mode flag (-msv-mode) and > make user mode the default > * config/sparc/sync.md: Only use supervisor ASI for CASA when in > supervisor mode > * doc/invoke.texi: Document msv-mode flag
On Tue, Jun 23, 2015 at 02:22:34PM +0200, Daniel Cederman wrote: > The muser-mode flag causes the CASA instruction for LEON3 to use the > user mode ASI. This is the correct behavior for almost all LEON3 targets. > For this reason it makes sense to make user mode the default. This patch > adds a flag for supervisor mode that can be used on the very few LEON3 targets > that requires CASA to use the supervisor ASI. Why are you adding a new option and without deprecation removing a previously accepted (at least since 4.8) option? For just changing the default, you really don't need to add a new option or remove -mno-user-mode, just change the default, which can be done e.g. by checking if the bit has been explicitly set and if not, use the desired default, or if you want to change the Mask() name, just make it InverseMask, but keep the options as they are. Jakub
On 2015-06-23 14:34, Jakub Jelinek wrote: > On Tue, Jun 23, 2015 at 02:22:34PM +0200, Daniel Cederman wrote: >> The muser-mode flag causes the CASA instruction for LEON3 to use the >> user mode ASI. This is the correct behavior for almost all LEON3 targets. >> For this reason it makes sense to make user mode the default. This patch >> adds a flag for supervisor mode that can be used on the very few LEON3 targets >> that requires CASA to use the supervisor ASI. > > Why are you adding a new option and without deprecation removing a > previously accepted (at least since 4.8) option? > For just changing the default, you really don't need to add a new option > or remove -mno-user-mode, just change the default, which can be done > e.g. by checking if the bit has been explicitly set and if not, use the > desired default, or if you want to change the Mask() name, just > make it InverseMask, but keep the options as they are. > > Jakub > How does one check if the bit has been explicitly set? It was not obvious to me, which is why I took a similar approach to a patch I found for another CPU target. If it is possible to change the default without adding another flag then that is obviously better and I will update my patch. Best regards, Daniel Cederman
On Tue, Jun 23, 2015 at 02:48:45PM +0200, Daniel Cederman wrote: > How does one check if the bit has been explicitly set? It was not obvious to if (TARGET_USER_MODE_P (target_flags_explicit)) > me, which is why I took a similar approach to a patch I found for another > CPU target. If it is possible to change the default without adding another > flag then that is obviously better and I will update my patch. Or you can just change the default target_flags, supposedly with TargetVariable int target_flags = MASK_USER_MODE in the opt file, there are really many possibilities. Jakub
On 2015-06-23 14:58, Jakub Jelinek wrote: > On Tue, Jun 23, 2015 at 02:48:45PM +0200, Daniel Cederman wrote: >> How does one check if the bit has been explicitly set? It was not obvious to > > if (TARGET_USER_MODE_P (target_flags_explicit)) > >> me, which is why I took a similar approach to a patch I found for another >> CPU target. If it is possible to change the default without adding another >> flag then that is obviously better and I will update my patch. > > Or you can just change the default target_flags, supposedly with > TargetVariable > int target_flags = MASK_USER_MODE > in the opt file, there are really many possibilities. > > Jakub > Thanks! I went with your suggestion in the previous mail and removed the new -msv-mode option and inversed the user mode mask. Best regards, Daniel Cederman
diff --git a/gcc/config/sparc/sparc.opt b/gcc/config/sparc/sparc.opt index 93d24a6..5c7f546 100644 --- a/gcc/config/sparc/sparc.opt +++ b/gcc/config/sparc/sparc.opt @@ -113,9 +113,13 @@ mrelax Target Optimize tail call instructions in assembler and linker +msv-mode +Target RejectNegative Report Mask(SV_MODE) +Generate code that can only run in supervisor mode + muser-mode -Target Report Mask(USER_MODE) -Do not generate code that can only run in supervisor mode +Target RejectNegative Report InverseMask(SV_MODE) +Do not generate code that can only run in supervisor mode (default) mcpu= Target RejectNegative Joined Var(sparc_cpu_and_features) Enum(sparc_processor_type) Init(PROCESSOR_V7) diff --git a/gcc/config/sparc/sync.md b/gcc/config/sparc/sync.md index 7d00b10..2fabff5 100644 --- a/gcc/config/sparc/sync.md +++ b/gcc/config/sparc/sync.md @@ -222,10 +222,10 @@ UNSPECV_CAS))] "TARGET_LEON3" { - if (TARGET_USER_MODE) - return "casa\t%1 0xa, %2, %0"; /* ASI for user data space. */ - else + if (TARGET_SV_MODE) return "casa\t%1 0xb, %2, %0"; /* ASI for supervisor data space. */ + else + return "casa\t%1 0xa, %2, %0"; /* ASI for user data space. */ } [(set_attr "type" "multi")]) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index b99ab1c..211e8e9 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1008,7 +1008,7 @@ See RS/6000 and PowerPC Options. -mhard-quad-float -msoft-quad-float @gol -mstack-bias -mno-stack-bias @gol -munaligned-doubles -mno-unaligned-doubles @gol --muser-mode -mno-user-mode @gol +-muser-mode -msv-mode @gol -mv8plus -mno-v8plus -mvis -mno-vis @gol -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol -mcbcond -mno-cbcond @gol @@ -21300,13 +21300,16 @@ Specifying this option avoids some rare compatibility problems with code generated by other compilers. It is not the default because it results in a performance loss, especially for floating-point code. +@item -msv-mode +@opindex msv-mode +Generate code that can only run in supervisor mode. This is relevant +only for the @code{casa} instruction emitted for the LEON3 processor. + @item -muser-mode -@itemx -mno-user-mode @opindex muser-mode -@opindex mno-user-mode Do not generate code that can only run in supervisor mode. This is relevant -only for the @code{casa} instruction emitted for the LEON3 processor. The -default is @option{-mno-user-mode}. +only for the @code{casa} instruction emitted for the LEON3 processor. This +is the default. @item -mno-faster-structs @itemx -mfaster-structs