Commit 9a863523 by Nathan Sidwell Committed by Nathan Sidwell

nvptx-protos.h (npvptx_section_from_addr_space): Delete.

	gcc/
	* config/nvptx/nvptx-protos.h (npvptx_section_from_addr_space):	Delete.
	* config/nvptx/nvptx.c (enum nvptx_data_area): New.
	(SYMBOL_DATA_AREA, SET_SYMBOL_DATA_AREA): New defines.
	(nvptx_option_override): Set data ares for worker vars.
	(nvptx_addr_space_from_sym): Delete.
	(nvptx_encode_section_info): New.
	(section_for_sym, section_for_decl): New.
	(nvptx_maybe_convert_symbolic_operand): Get data area from symbol
	flags,
	(nvptx_section_from_addr_space): Delete.
	(nvptx_section_for_decl): Delete.
	(nvptx_output_aligned, nvptx_declare_object_name,
	nvptx_assemble_undefined_decl): Use section_for_decl, remove
	unnecessary checks.
	(nvptx_print_operand): Add 'D', adjust 'A'.
	(nvptx_expand_worker_addr): Adjust unspec generation.
	(TARGET_ENCODE_SECTION_INFO): Override.
	* config/nvptx/nvptx.h (ADDR_SPACE_GLOBAL, ADDR_SPACE_SHARED,
	ADDR_SPACE_CONST, ADDR_SPACE_LOCAL, ADDR_SPACE_PARAM): Delete.
	* config/nvptx/nvptx.md (UNSPEC_FROM_GLOBAL, UNSPEC_FROM_LOCAL,
	UNSPEC_FROM_PARAM, UNSPEC_FROM_SHARED, UNSPEC_FROM_CONST,
	UNSPEC_TO_GLOBAL, UNSPEC_TO_LOCAL, UNSPEC_TO_PARAM,
	UNSPEC_TO_SHARED, UNSPEC_TO_CONST): Delete.
	(UNSPEC_TO_GENERIC): New.
	(nvptx_register_or_symbolic_operand): Delete.
	(cvt_code, cvt_name, cvt_str): Delete.
	(convaddr_<cvt_name><mode> [P]): Delete.
	(convaddr_<mode> [P]): New.

	gcc/testsuite/
	* gcc.target/nvptx/decl.c: New.
	* gcc.target/nvptx/uninit-decl.c: Robustify regexps.

From-SVN: r231227
parent 1986d679
2015-12-03 Nathan Sidwell <nathan@acm.org>
* config/nvptx/nvptx-protos.h (npvptx_section_from_addr_space): Delete.
* config/nvptx/nvptx.c (enum nvptx_data_area): New.
(SYMBOL_DATA_AREA, SET_SYMBOL_DATA_AREA): New defines.
(nvptx_option_override): Set data ares for worker vars.
(nvptx_addr_space_from_sym): Delete.
(nvptx_encode_section_info): New.
(section_for_sym, section_for_decl): New.
(nvptx_maybe_convert_symbolic_operand): Get data area from symbol
flags,
(nvptx_section_from_addr_space): Delete.
(nvptx_section_for_decl): Delete.
(nvptx_output_aligned, nvptx_declare_object_name,
nvptx_assemble_undefined_decl): Use section_for_decl, remove
unnecessary checks.
(nvptx_print_operand): Add 'D', adjust 'A'.
(nvptx_expand_worker_addr): Adjust unspec generation.
(TARGET_ENCODE_SECTION_INFO): Override.
* config/nvptx/nvptx.h (ADDR_SPACE_GLOBAL, ADDR_SPACE_SHARED,
ADDR_SPACE_CONST, ADDR_SPACE_LOCAL, ADDR_SPACE_PARAM): Delete.
* config/nvptx/nvptx.md (UNSPEC_FROM_GLOBAL, UNSPEC_FROM_LOCAL,
UNSPEC_FROM_PARAM, UNSPEC_FROM_SHARED, UNSPEC_FROM_CONST,
UNSPEC_TO_GLOBAL, UNSPEC_TO_LOCAL, UNSPEC_TO_PARAM,
UNSPEC_TO_SHARED, UNSPEC_TO_CONST): Delete.
(UNSPEC_TO_GENERIC): New.
(nvptx_register_or_symbolic_operand): Delete.
(cvt_code, cvt_name, cvt_str): Delete.
(convaddr_<cvt_name><mode> [P]): Delete.
(convaddr_<mode> [P]): New.
2015-12-03 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2015-12-03 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR rtl-optimization/68624 PR rtl-optimization/68624
...@@ -41,7 +41,6 @@ extern const char *nvptx_ptx_type_from_mode (machine_mode, bool); ...@@ -41,7 +41,6 @@ extern const char *nvptx_ptx_type_from_mode (machine_mode, bool);
extern const char *nvptx_output_mov_insn (rtx, rtx); extern const char *nvptx_output_mov_insn (rtx, rtx);
extern const char *nvptx_output_call_insn (rtx_insn *, rtx, rtx); extern const char *nvptx_output_call_insn (rtx_insn *, rtx, rtx);
extern const char *nvptx_output_return (void); extern const char *nvptx_output_return (void);
extern const char *nvptx_section_from_addr_space (addr_space_t);
extern bool nvptx_hard_regno_mode_ok (int, machine_mode); extern bool nvptx_hard_regno_mode_ok (int, machine_mode);
extern rtx nvptx_maybe_convert_symbolic_operand (rtx); extern rtx nvptx_maybe_convert_symbolic_operand (rtx);
#endif #endif
......
...@@ -141,13 +141,6 @@ enum reg_class ...@@ -141,13 +141,6 @@ enum reg_class
(MODE) = SImode; \ (MODE) = SImode; \
} }
/* Address spaces. */
#define ADDR_SPACE_GLOBAL 1
#define ADDR_SPACE_SHARED 3
#define ADDR_SPACE_CONST 4
#define ADDR_SPACE_LOCAL 5
#define ADDR_SPACE_PARAM 101
/* Stack and Calling. */ /* Stack and Calling. */
#define STARTING_FRAME_OFFSET 0 #define STARTING_FRAME_OFFSET 0
......
...@@ -20,16 +20,7 @@ ...@@ -20,16 +20,7 @@
(define_c_enum "unspec" [ (define_c_enum "unspec" [
UNSPEC_ARG_REG UNSPEC_ARG_REG
UNSPEC_FROM_GLOBAL UNSPEC_TO_GENERIC
UNSPEC_FROM_LOCAL
UNSPEC_FROM_PARAM
UNSPEC_FROM_SHARED
UNSPEC_FROM_CONST
UNSPEC_TO_GLOBAL
UNSPEC_TO_LOCAL
UNSPEC_TO_PARAM
UNSPEC_TO_SHARED
UNSPEC_TO_CONST
UNSPEC_COPYSIGN UNSPEC_COPYSIGN
UNSPEC_LOG2 UNSPEC_LOG2
...@@ -100,20 +91,6 @@ ...@@ -100,20 +91,6 @@
(define_predicate "symbolic_operand" (define_predicate "symbolic_operand"
(match_code "symbol_ref,const")) (match_code "symbol_ref,const"))
;; Allow registers or symbolic constants. We can allow frame, arg or stack
;; pointers here since they are actually symbolic constants.
(define_predicate "nvptx_register_or_symbolic_operand"
(match_code "reg,subreg,symbol_ref,const")
{
if (GET_CODE (op) == SUBREG && MEM_P (SUBREG_REG (op)))
return false;
if (GET_CODE (op) == SUBREG)
return false;
if (CONSTANT_P (op))
return true;
return register_operand (op, mode);
})
;; Registers or constants for normal instructions. Does not allow symbolic ;; Registers or constants for normal instructions. Does not allow symbolic
;; constants. ;; constants.
(define_predicate "nvptx_nonmemory_operand" (define_predicate "nvptx_nonmemory_operand"
...@@ -399,43 +376,13 @@ ...@@ -399,43 +376,13 @@
%.\\tst%A0.u%T0\\t%0, %1;" %.\\tst%A0.u%T0\\t%0, %1;"
[(set_attr "subregs_ok" "true")]) [(set_attr "subregs_ok" "true")])
;; Pointer address space conversions ;; Pointer address space conversion
(define_insn "convaddr_<mode>"
(define_int_iterator cvt_code
[UNSPEC_FROM_GLOBAL
UNSPEC_FROM_LOCAL
UNSPEC_FROM_SHARED
UNSPEC_FROM_CONST
UNSPEC_TO_GLOBAL
UNSPEC_TO_LOCAL
UNSPEC_TO_SHARED
UNSPEC_TO_CONST])
(define_int_attr cvt_name
[(UNSPEC_FROM_GLOBAL "from_global")
(UNSPEC_FROM_LOCAL "from_local")
(UNSPEC_FROM_SHARED "from_shared")
(UNSPEC_FROM_CONST "from_const")
(UNSPEC_TO_GLOBAL "to_global")
(UNSPEC_TO_LOCAL "to_local")
(UNSPEC_TO_SHARED "to_shared")
(UNSPEC_TO_CONST "to_const")])
(define_int_attr cvt_str
[(UNSPEC_FROM_GLOBAL ".global")
(UNSPEC_FROM_LOCAL ".local")
(UNSPEC_FROM_SHARED ".shared")
(UNSPEC_FROM_CONST ".const")
(UNSPEC_TO_GLOBAL ".to.global")
(UNSPEC_TO_LOCAL ".to.local")
(UNSPEC_TO_SHARED ".to.shared")
(UNSPEC_TO_CONST ".to.const")])
(define_insn "convaddr_<cvt_name><mode>"
[(set (match_operand:P 0 "nvptx_register_operand" "=R") [(set (match_operand:P 0 "nvptx_register_operand" "=R")
(unspec:P [(match_operand:P 1 "nvptx_register_or_symbolic_operand" "Rs")] cvt_code))] (unspec:P [(match_operand:P 1 "symbolic_operand" "s")]
UNSPEC_TO_GENERIC))]
"" ""
"%.\\tcvta<cvt_str>%t0\\t%0, %1;") "%.\\tcvta%D1%t0\\t%0, %1;")
;; Integer arithmetic ;; Integer arithmetic
......
2015-12-03 Nathan Sidwell <nathan@acm.org>
* gcc.target/nvptx/decl.c: New.
* gcc.target/nvptx/uninit-decl.c: Robustify regexps.
2015-12-03 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2015-12-03 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR rtl-optimization/68624 PR rtl-optimization/68624
......
static const int __attribute__ ((used)) cst_local = 4;
static int __attribute__ ((used)) glob_local = 5;
const int __attribute__ ((used)) cst_export = 4;
int __attribute__ ((used)) glob_export = 5;
extern const int cst_import;
extern int glob_import;
int Foo ()
{
return cst_import + glob_import;
}
/* { dg-final { scan-assembler "\[\r\n\]\[\t \]*.visible .global \[^,\r\n\]*glob_export" } } */
/* { dg-final { scan-assembler "\[\r\n\]\[\t \]*.visible .const \[^,\r\n\]*cst_export" } } */
/* { dg-final { scan-assembler "\[\r\n\]\[\t \]*.global \[^,\r\n\]*glob_local" } } */
/* { dg-final { scan-assembler "\[\r\n\]\[\t \]*.const \[^,\r\n\]*cst_local" } } */
/* { dg-final { scan-assembler "\[\r\n\]\[\t \]*.extern .global \[^,\r\n\]*glob_import" } } */
/* { dg-final { scan-assembler "\[\r\n\]\[\t \]*.extern .const \[^,\r\n\]*cst_import" } } */
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
int __attribute__ ((used)) common; int __attribute__ ((used)) common;
static int __attribute__ ((used)) local; static int __attribute__ ((used)) local;
/* { dg-final { scan-assembler ".weak .global\[^,\n\r\]*common" } } */ /* { dg-final { scan-assembler "\[\n\r\]\[\t \]*.weak .global\[^,\n\r\]*common" } } */
/* { dg-final { scan-assembler "\[\n\r\].global\[^,\n\r\]*local" } } */ /* { dg-final { scan-assembler "\[\n\r\]\[\t \]*.global\[^,\n\r\]*local" } } */
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