[ARC] Add JLI support

Programming / Compilers / GCC - claziss [138bc75d-0d04-0410-961f-82ee72b054a4] - 26 January 2018 11:33 EST

The ARCv2 ISA provides the JLI instruction, which is two-byte instructions that can be used to reduce code size in an application. To make use of it, we provide two new function attributes 'jli_always' and 'jli_fixed' which will force the compiler to call the indicated function using a jli_s instruction. The compiler also generates the entries in the JLI table for the case when we use 'jli_always' attribute. In the case of 'jli_fixed' the compiler assumes a fixed position of the function into JLI table. Thus, the user needs to provide an assembly file with the JLI table for the final link. This is usefully when we want to have a table in ROM and a second table in the RAM memory.

The jli instruction usage can be also forced without the need to annotate the source code via '-mjli-always' command.

gcc/ 2018-01-26 Claudiu Zissulescu John Eric Martin

- config/arc/arc-protos.h: Add arc_is_jli_call_p proto.
- config/arc/arc.c (_arc_jli_section): New struct. (arc_jli_section): New type. (rc_jli_sections): New static variable. (arc_handle_jli_attribute): New function. (arc_attribute_table): Add jli_always and jli_fixed attribute. (arc_file_end): New function. (TARGET_ASM_FILE_END): Define. (arc_print_operand): Reuse 'S' letter for JLI output instruction. (arc_add_jli_section): New function. (jli_call_scan): Likewise. (arc_reorg): Call jli_call_scan. (arc_output_addsi): Remove 'S' from printing asm operand. (arc_is_jli_call_p): New function.
- config/arc/arc.md (movqi_insn): Remove 'S' from printing asm operand. (movhi_insn): Likewise. (movsi_insn): Likewise. (movsi_set_cc_insn): Likewise. (loadqi_update): Likewise. (load_zeroextendqisi_update): Likewise. (load_signextendqisi_update): Likewise. (loadhi_update): Likewise. (load_zeroextendhisi_update): Likewise. (load_signextendhisi_update): Likewise. (loadsi_update): Likewise. (loadsf_update): Likewise. (movsicc_insn): Likewise. (bset_insn): Likewise. (bxor_insn): Likewise. (bclr_insn): Likewise. (bmsk_insn): Likewise. (bicsi3_insn): Likewise. (cmpsi_cc_c_insn): Likewise. (movsi_ne): Likewise. (movsi_cond_exec): Likewise. (clrsbsi2): Likewise. (norm_f): Likewise. (normw): Likewise. (swap): Likewise. (divaw): Likewise. (flag): Likewise. (sr): Likewise. (kflag): Likewise. (ffs): Likewise. (ffs_f): Likewise. (fls): Likewise. (call_i): Remove 'S' asm letter, add jli instruction. (call_value_i): Likewise.
- config/arc/arc.op (mjli-always): New option.
- config/arc/constraints.md (Cji): New constraint.
- config/arc/fpx.md (addsf3_fpx): Remove 'S' from printing asm operand. (subsf3_fpx): Likewise. (mulsf3_fpx): Likewise.
- config/arc/simdext.md (vendrec_insn): Remove 'S' from printing asm operand.
- doc/extend.texi (ARC): Document 'jli-always' and 'jli-fixed' function attrbutes.
- doc/invoke.texi (ARC): Document mjli-always option.

gcc/testsuite 2018-01-26 Claudiu Zissulescu

- gcc.target/arc/jli-1.c: New file.
- gcc.target/arc/jli-2.c: Likewise.

a15f063bc9c [ARC] Add JLI support.
gcc/ChangeLog | 64 ++++++++++
gcc/config/arc/arc-protos.h | 2 +
gcc/config/arc/arc.c | 220 ++++++++++++++++++++++++++++++++++-
gcc/config/arc/arc.md | 128 ++++++++++----------
gcc/config/arc/arc.opt | 4 +
gcc/config/arc/constraints.md | 6 +
gcc/config/arc/elf.h | 3 +
gcc/config/arc/fpx.md | 18 +--
gcc/config/arc/linux.h | 1 +
gcc/config/arc/simdext.md | 2 +-
gcc/doc/extend.texi | 13 +++
gcc/doc/invoke.texi | 7 +-
gcc/testsuite/ChangeLog | 5 +
gcc/testsuite/gcc.target/arc/jli-1.c | 19 +++
gcc/testsuite/gcc.target/arc/jli-2.c | 19 +++
15 files changed, 430 insertions(+), 81 deletions(-)

Upstream: gcc.gnu.org


  • Share