Bug 81268 - [avr] Support __gcc_isr pseudo-instruction for more efficient ISR prologues
Summary: [avr] Support __gcc_isr pseudo-instruction for more efficient ISR prologues
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: unknown
: P5 enhancement
Target Milestone: 8.0
Assignee: Georg-Johann Lay
URL:
Keywords: missed-optimization
Depends on:
Blocks: 20296
  Show dependency treegraph
 
Reported: 2017-06-30 19:54 UTC by Georg-Johann Lay
Modified: 2017-09-14 18:59 UTC (History)
0 users

See Also:
Host:
Target: avr
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Georg-Johann Lay 2017-06-30 19:54:16 UTC
GNU assembler supports the __gcc_isr pseudo-instruction, cf.

https://sourceware.org/bugzilla/show_bug.cgi?id=21683

This can be used up reduce overhead in ISR prologues and epilogues due to GCC's modeling of TMP_REG and ZERO_REG as fixed regs und using cc0 to model SREG.
Comment 1 Georg-Johann Lay 2017-07-10 09:49:50 UTC
Author: gjl
Date: Mon Jul 10 09:49:18 2017
New Revision: 250093

URL: https://gcc.gnu.org/viewcvs?rev=250093&root=gcc&view=rev
Log:
gcc/
	Better ISR prologues by supporting GASes __gcc_isr pseudo insn.
	PR target/20296
	PR target/81268
	* configure.ac [target=avr]: Add GAS check for -mgcc-isr.
	(HAVE_AS_AVR_MGCCISR_OPTION):  If so, AC_DEFINE it.
	* config.in: Regenerate.
	* configure: Regenerate.
	* doc/extend.texi (AVR Function Attributes) <no_gccisr>: Document it.
	* doc/invoke.texi (AVR Options) <-mgas-isr-prologues>: Document it.
	* config/avr/avr.opt (-mgas-isr-prologues): New option and...
	(TARGET_GASISR_PROLOGUES): ...target mask.
	* common/config/avr/avr-common.c
	(avr_option_optimization_table) [OPT_LEVELS_1_PLUS_NOT_DEBUG]:
	Set -mgas-isr-prologues.
	* config/avr/avr-passes.def (avr_pass_pre_proep): Add
	INSERT_PASS_BEFORE for it.
	* config/avr/avr-protos.h (make_avr_pass_pre_proep): New proto.
	* config/avr/avr.c (avr_option_override)
	[!HAVE_AS_AVR_MGCCISR_OPTION]: Unset TARGET_GASISR_PROLOGUES.
	(avr_no_gccisr_function_p, avr_hregs_split_reg): New static functions.
	(avr_attribute_table) <no_gccisr>: Add new function attribute.
	(avr_set_current_function) <is_no_gccisr>: Init machine field.
	(avr_pass_data_pre_proep, avr_pass_pre_proep): New pass data
	and rtl_opt_pass.
	(make_avr_pass_pre_proep): New function.
	(emit_push_sfr) <treg>: Add argument to function and use it
	instead of TMP_REG.
	(avr_expand_prologue) [machine->gasisr.maybe]: Emit gasisr insn
	and set machine->gasisr.yes.
	(avr_expand_epilogue) [machine->gasisr.yes]: Similar.
	(avr_asm_function_end_prologue) [machine->gasisr.yes]: Add
	__gcc_isr.n_pushed to .L__stack_usage.
	(TARGET_ASM_FINAL_POSTSCAN_INSN): Define to...
	(avr_asm_final_postscan_insn): ...this new static function.
	* config/avr/avr.h (machine_function)
	<is_no_gccisr, use_L__stack_usage>: New fields.
	<gasisr, gasisr.yes, gasisr.maybe, gasisr.regno>: New fields.
	* config/avr/avr.md (UNSPECV_GASISR): Add unspecv enum.
	(GASISR_Prologue, GASISR_Epilogue, GASISR_Done): New define_constants.
	(gasisr, *gasisr): New expander and insn.
	* config/avr/gen-avr-mmcu-specs.c (print_mcu)
	[HAVE_AS_AVR_MGCCISR_OPTION]: Print asm_gccisr spec.
	* config/avr/specs.h (ASM_SPEC) <asm_gccisr>: Add sub spec.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/common/config/avr/avr-common.c
    trunk/gcc/config.in
    trunk/gcc/config/avr/avr-passes.def
    trunk/gcc/config/avr/avr-protos.h
    trunk/gcc/config/avr/avr.c
    trunk/gcc/config/avr/avr.h
    trunk/gcc/config/avr/avr.md
    trunk/gcc/config/avr/avr.opt
    trunk/gcc/config/avr/gen-avr-mmcu-specs.c
    trunk/gcc/config/avr/specs.h
    trunk/gcc/configure
    trunk/gcc/configure.ac
    trunk/gcc/doc/extend.texi
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/gcc.target/avr/isr-test.h
Comment 2 Georg-Johann Lay 2017-07-10 10:00:26 UTC
Added in v8.
Comment 3 Eric Gallager 2017-08-17 22:19:36 UTC
Redoing https://gcc.gnu.org/ml/gcc-bugs/2017-08/msg01469.html

--- Comment #3 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Author: gjl
Date: Mon Aug 14 09:14:16 2017
New Revision: 251085

URL: https://gcc.gnu.org/viewcvs?rev=251085&root=gcc&view=rev
Log:
gcc/
        PR target/81754
        PR target/81268
        * config/avr/avr.opt (mgas-isr-prologues): New Var
        avr_gasisr_prologues.
        * config/avr/avr.md (gasisr, *gasisr): Use it instead of
        TARGET_GASISR_PROLOGUES.
        * config/avr/avr.c (avr_option_override): Same.
        (avr_pass_pre_proep::execute): Same.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/avr/avr.c
    trunk/gcc/config/avr/avr.md
    trunk/gcc/config/avr/avr.opt
Comment 4 Georg-Johann Lay 2017-08-18 11:22:46 UTC
(In reply to Eric Gallager from comment #3)
> Redoing https://gcc.gnu.org/ml/gcc-bugs/2017-08/msg01469.html

I guess due to some server crash / glitch?

> New Revision: 251085
> 
> URL: https://gcc.gnu.org/viewcvs?rev=251085&root=gcc&view=rev
> Log:
> gcc/
>         PR target/81754
>         PR target/81268

Shouldn't this also result in a respective auto-comment to PR81754?
Comment 5 Eric Gallager 2017-08-18 11:32:27 UTC
(In reply to Georg-Johann Lay from comment #4)
> (In reply to Eric Gallager from comment #3)
> > Redoing https://gcc.gnu.org/ml/gcc-bugs/2017-08/msg01469.html
> 
> I guess due to some server crash / glitch?
> 

Yeah, see the mailing lists about it.

> > New Revision: 251085
> > 
> > URL: https://gcc.gnu.org/viewcvs?rev=251085&root=gcc&view=rev
> > Log:
> > gcc/
> >         PR target/81754
> >         PR target/81268
> 
> Shouldn't this also result in a respective auto-comment to PR81754?

That one must have gotten lost, too...
Comment 6 Aldy Hernandez 2017-09-13 16:57:06 UTC
Author: aldyh
Date: Wed Sep 13 16:56:35 2017
New Revision: 252421

URL: https://gcc.gnu.org/viewcvs?rev=252421&root=gcc&view=rev
Log:
gcc/
	PR target/81754
	PR target/81268
	* config/avr/avr.opt (mgas-isr-prologues): New Var
	avr_gasisr_prologues.
	* config/avr/avr.md (gasisr, *gasisr): Use it instead of
	TARGET_GASISR_PROLOGUES.
	* config/avr/avr.c (avr_option_override): Same.
	(avr_pass_pre_proep::execute): Same.

Modified:
    branches/range-gen2/gcc/ChangeLog
    branches/range-gen2/gcc/config/avr/avr.c
    branches/range-gen2/gcc/config/avr/avr.md
    branches/range-gen2/gcc/config/avr/avr.opt
Comment 7 Georg-Johann Lay 2017-09-14 16:06:17 UTC
(In reply to Aldy Hernandez from comment #6)
> Author: aldyh
> Date: Wed Sep 13 16:56:35 2017
> New Revision: 252421
> 
> URL: https://gcc.gnu.org/viewcvs?rev=252421&root=gcc&view=rev
> Log:
> gcc/
> 	PR target/81754
> 	PR target/81268
> 	* config/avr/avr.opt (mgas-isr-prologues): New Var
> 	avr_gasisr_prologues.
> 	* config/avr/avr.md (gasisr, *gasisr): Use it instead of
> 	TARGET_GASISR_PROLOGUES.
> 	* config/avr/avr.c (avr_option_override): Same.
> 	(avr_pass_pre_proep::execute): Same.
> 
> Modified:
>     branches/range-gen2/gcc/ChangeLog
>     branches/range-gen2/gcc/config/avr/avr.c
>     branches/range-gen2/gcc/config/avr/avr.md
>     branches/range-gen2/gcc/config/avr/avr.opt

Hi, are changes to some provate branches (presumably by merging trunk or some release branch into it) supposed to trigger bugzilla entries?
Comment 8 Eric Gallager 2017-09-14 18:59:22 UTC
(In reply to Georg-Johann Lay from comment #7)
> (In reply to Aldy Hernandez from comment #6)
> > Author: aldyh
> > Date: Wed Sep 13 16:56:35 2017
> > New Revision: 252421
> > 
> > URL: https://gcc.gnu.org/viewcvs?rev=252421&root=gcc&view=rev
> > Log:
> > gcc/
> > 	PR target/81754
> > 	PR target/81268
> > 	* config/avr/avr.opt (mgas-isr-prologues): New Var
> > 	avr_gasisr_prologues.
> > 	* config/avr/avr.md (gasisr, *gasisr): Use it instead of
> > 	TARGET_GASISR_PROLOGUES.
> > 	* config/avr/avr.c (avr_option_override): Same.
> > 	(avr_pass_pre_proep::execute): Same.
> > 
> > Modified:
> >     branches/range-gen2/gcc/ChangeLog
> >     branches/range-gen2/gcc/config/avr/avr.c
> >     branches/range-gen2/gcc/config/avr/avr.md
> >     branches/range-gen2/gcc/config/avr/avr.opt
> 
> Hi, are changes to some provate branches (presumably by merging trunk or
> some release branch into it) supposed to trigger bugzilla entries?

I was wondering this myself; might be worth sending an email to the gcc mailing list asking about it