Commit 9f532472 by Claudiu Zissulescu Committed by Claudiu Zissulescu

[ARC] Use -G option to control sdata behavior

gcc/
2017-04-24  Claudiu Zissulescu  <claziss@synopsys.com>

	* config.gcc: Use g.opt for arc.
	* config/arc/arc.c (LEGITIMATE_SCALED_ADDRESS_P): Deleted,
	functionality moved to ...
	(legitimate_scaled_address_p): New function, ...here.
	(LEGITIMATE_SMALL_DATA_OFFSET_P): New define.
	(LEGITIMATE_SMALL_DATA_ADDRESS_P): Use the above define.
	(legitimate_offset_address_p): Delete TARGET_NO_SDATA_SET
	condition.
	(arc_override_options): Handle G option.
	(arc_output_pic_addr_const): Correct function definition.
	(arc_legitimate_address_p): Use legitimate_scaled_address_p.
	(arc_decl_anon_ns_mem_p): Delete.
	(arc_in_small_data_p): Overhaul this function to take into
	consideration the value given via G option.
	(arc_rewrite_small_data_1): Renamed and corrected old
	arc_rewrite_small_data function.
	(arc_rewrite_small_data): New function.
	(small_data_pattern): Don't use pic_offset_table_rtx.
	* config/arc/arc.h (CC1_SPEC): Recognize G option.
	* config/arc/simdext.md (movmisalignv2hi): Use
	prepare_move_operands function.
	(mov*): Likewise.
	(movmisalign*): Likewise.

gcc/testsuite/
2017-04-24  Claudiu Zissulescu  <claziss@synopsys.com>

	* gcc.target/arc/sdata-5.c: New test.
	* gcc.target/arc/arc700-stld-hazard.c: Update test options.

Fix test

From-SVN: r251564
parent b6fb7933
2017-08-31 Claudiu Zissulescu <claziss@synopsys.com> 2017-08-31 Claudiu Zissulescu <claziss@synopsys.com>
* config.gcc: Use g.opt for arc.
* config/arc/arc.c (LEGITIMATE_SCALED_ADDRESS_P): Deleted,
functionality moved to ...
(legitimate_scaled_address_p): New function, ...here.
(LEGITIMATE_SMALL_DATA_OFFSET_P): New define.
(LEGITIMATE_SMALL_DATA_ADDRESS_P): Use the above define.
(legitimate_offset_address_p): Delete TARGET_NO_SDATA_SET
condition.
(arc_override_options): Handle G option.
(arc_output_pic_addr_const): Correct function definition.
(arc_legitimate_address_p): Use legitimate_scaled_address_p.
(arc_decl_anon_ns_mem_p): Delete.
(arc_in_small_data_p): Overhaul this function to take into
consideration the value given via G option.
(arc_rewrite_small_data_1): Renamed and corrected old
arc_rewrite_small_data function.
(arc_rewrite_small_data): New function.
(small_data_pattern): Don't use pic_offset_table_rtx.
* config/arc/arc.h (CC1_SPEC): Recognize G option.
* config/arc/simdext.md (movmisalignv2hi): Use
prepare_move_operands function.
(mov*): Likewise.
(movmisalign*): Likewise.
* doc/invoke.texi (ARC options): Document -G option.
2017-08-31 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc-protos.h (compact_sda_memory_operand): Update * config/arc/arc-protos.h (compact_sda_memory_operand): Update
prototype. prototype.
* config/arc/arc.c (arc_print_operand): Output scalled address for * config/arc/arc.c (arc_print_operand): Output scalled address for
......
...@@ -318,7 +318,7 @@ arc*-*-*) ...@@ -318,7 +318,7 @@ arc*-*-*)
cpu_type=arc cpu_type=arc
c_target_objs="arc-c.o" c_target_objs="arc-c.o"
cxx_target_objs="arc-c.o" cxx_target_objs="arc-c.o"
extra_options="${extra_options} arc/arc-tables.opt" extra_options="${extra_options} arc/arc-tables.opt g.opt"
extra_headers="arc-simd.h" extra_headers="arc-simd.h"
;; ;;
arm*-*-*) arm*-*-*)
......
...@@ -65,9 +65,9 @@ along with GCC; see the file COPYING3. If not see ...@@ -65,9 +65,9 @@ along with GCC; see the file COPYING3. If not see
%(subtarget_cpp_spec)" %(subtarget_cpp_spec)"
#undef CC1_SPEC #undef CC1_SPEC
#define CC1_SPEC "\ #define CC1_SPEC "%{EB:%{EL:%emay not use both -EB and -EL}} \
%{EB:%{EL:%emay not use both -EB and -EL}} \ %{EB:-mbig-endian} %{EL:-mlittle-endian} \
%{EB:-mbig-endian} %{EL:-mlittle-endian} \ %{G*} \
" "
extern const char *arc_cpu_to_as (int argc, const char **argv); extern const char *arc_cpu_to_as (int argc, const char **argv);
......
...@@ -1383,19 +1383,18 @@ ...@@ -1383,19 +1383,18 @@
[(set (match_operand:V2HI 0 "general_operand" "") [(set (match_operand:V2HI 0 "general_operand" "")
(match_operand:V2HI 1 "general_operand" ""))] (match_operand:V2HI 1 "general_operand" ""))]
"" ""
{ "{
if (!register_operand (operands[0], V2HImode) if (prepare_move_operands (operands, V2HImode))
&& !register_operand (operands[1], V2HImode)) DONE;
operands[1] = force_reg (V2HImode, operands[1]); }")
})
(define_expand "mov<mode>" (define_expand "mov<mode>"
[(set (match_operand:VWH 0 "move_dest_operand" "") [(set (match_operand:VWH 0 "move_dest_operand" "")
(match_operand:VWH 1 "general_operand" ""))] (match_operand:VWH 1 "general_operand" ""))]
"" ""
"{ "{
if (GET_CODE (operands[0]) == MEM) if (prepare_move_operands (operands, <MODE>mode))
operands[1] = force_reg (<MODE>mode, operands[1]); DONE;
}") }")
(define_insn_and_split "*mov<mode>_insn" (define_insn_and_split "*mov<mode>_insn"
...@@ -1440,11 +1439,10 @@ ...@@ -1440,11 +1439,10 @@
[(set (match_operand:VWH 0 "general_operand" "") [(set (match_operand:VWH 0 "general_operand" "")
(match_operand:VWH 1 "general_operand" ""))] (match_operand:VWH 1 "general_operand" ""))]
"" ""
{ "{
if (!register_operand (operands[0], <MODE>mode) if (prepare_move_operands (operands, <MODE>mode))
&& !register_operand (operands[1], <MODE>mode)) DONE;
operands[1] = force_reg (<MODE>mode, operands[1]); }")
})
(define_insn "bswapv2hi2" (define_insn "bswapv2hi2"
[(set (match_operand:V2HI 0 "register_operand" "=r,r") [(set (match_operand:V2HI 0 "register_operand" "=r,r")
......
...@@ -614,7 +614,7 @@ Objective-C and Objective-C++ Dialects}. ...@@ -614,7 +614,7 @@ Objective-C and Objective-C++ Dialects}.
-mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
-mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
-mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
-mrgf-banked-regs @gol -mrgf-banked-regs -G @var{num} @gol
-mvolatile-cache -mtp-regno=@var{regno} @gol -mvolatile-cache -mtp-regno=@var{regno} @gol
-malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
-mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
...@@ -14896,6 +14896,13 @@ allow use of the 25-bit range, rather than the 21-bit range with ...@@ -14896,6 +14896,13 @@ allow use of the 25-bit range, rather than the 21-bit range with
conditional branch-and-link. This is the default for tool chains built conditional branch-and-link. This is the default for tool chains built
for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets. for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
@item -G @var{num}
@opindex G
Put definitions of externally-visible data in a small data section if
that data is no bigger than @var{num} bytes. The default value of
@var{num} is 4 for any ARC configuration, or 8 when we have double
load/store operations.
@item -mno-sdata @item -mno-sdata
@opindex mno-sdata @opindex mno-sdata
Do not generate sdata references. This is the default for tool chains Do not generate sdata references. This is the default for tool chains
2017-08-31 Claudiu Zissulescu <claziss@synopsys.com> 2017-08-31 Claudiu Zissulescu <claziss@synopsys.com>
* gcc.target/arc/sdata-5.c: New test.
* gcc.target/arc/arc700-stld-hazard.c: Update test options.
2017-08-31 Claudiu Zissulescu <claziss@synopsys.com>
* gcc.target/arc/sdata-3.c: New file. * gcc.target/arc/sdata-3.c: New file.
* gcc.target/arc/sdata-4.c: Likewise. * gcc.target/arc/sdata-4.c: Likewise.
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-mcpu=arc700" } */ /* { dg-options "-mcpu=arc700 -mno-sdata" } */
volatile int a; volatile int a;
volatile int b; volatile int b;
......
/* { dg-do compile } */
/* { dg-options "-Os -msdata" } */
/* Check interaction between section anchors and small data. */
const int a[1] = {};
static short b[] = {};
int c;
const int* fn1 (void)
{
return a + b[c];
}
/* { dg-final { scan-assembler "@c@sda" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment