diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-12-07 13:46:07 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-12-07 13:46:07 +0000 |
commit | 7e6e9bffdaa4d15604f9ae370054ce8a83cbf9e6 (patch) | |
tree | 5efde36c9a090f2922c1a53b1474a6511ad9a3a4 /gcc/config | |
parent | f40f9ee2db149a9e5e2d5d3acd861190b5582691 (diff) | |
download | gcc-7e6e9bffdaa4d15604f9ae370054ce8a83cbf9e6.tar.gz |
gcc/
* config/nvptx/nvptx.c (nvptx_assemble_decl_begin): Look inside
complex and vector types. Cope with packed structs.
gcc/testsuite/
* gcc.target/nvptx/decl-init.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231362 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/nvptx/nvptx.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index fc0e9b8a9df..2dec8467437 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -1643,17 +1643,24 @@ nvptx_assemble_decl_begin (FILE *file, const char *name, const char *section, while (TREE_CODE (type) == ARRAY_TYPE) type = TREE_TYPE (type); - if (!INTEGRAL_TYPE_P (type) && !SCALAR_FLOAT_TYPE_P (type)) - type = ptr_type_node; + if (TREE_CODE (type) == VECTOR_TYPE + || TREE_CODE (type) == COMPLEX_TYPE) + /* Neither vector nor complex types can contain the other. */ + type = TREE_TYPE (type); + unsigned elt_size = int_size_in_bytes (type); - if (elt_size > UNITS_PER_WORD) - { - type = ptr_type_node; - elt_size = int_size_in_bytes (type); - } + + /* Largest mode we're prepared to accept. For BLKmode types we + don't know if it'll contain pointer constants, so have to choose + pointer size, otherwise we can choose DImode. */ + machine_mode elt_mode = TYPE_MODE (type) == BLKmode ? Pmode : DImode; + + elt_size |= GET_MODE_SIZE (elt_mode); + elt_size &= -elt_size; /* Extract LSB set. */ + elt_mode = mode_for_size (elt_size * BITS_PER_UNIT, MODE_INT, 0); decl_chunk_size = elt_size; - decl_chunk_mode = int_mode_for_mode (TYPE_MODE (type)); + decl_chunk_mode = elt_mode; decl_offset = 0; init_part = 0; |