Hi,

this is OK with one small adjustments in a comment:

On Tue, Mar 22, 2016 at 03:51:53PM +0100, Martin Liska wrote:
> gcc/ChangeLog:
> 
> 2016-03-23  Martin Liska  <mli...@suse.cz>
> 
>       PR hsa/70391
>       * hsa-brig.c (emit_directive_variable): Emit alignment
>       according to hsa_symbol::m_align.
>       * hsa-dump.c (hsa_byte_alignment): Move the function to
>       another file.
>       (dump_hsa_symbol): Dump alignment of HSA symbols.
>       * hsa-gen.c (get_symbol_for_decl): Set-up alignment
>       of a symbol.
>       (gen_hsa_addr_with_align): New function.
>       (hsa_bitmemref_alignment): Use newly added function.
>       (gen_hsa_insns_for_load): Likewise.
>       (gen_hsa_insns_for_store): Likewise.
>       (gen_hsa_memory_copy): New argument added.
>       (gen_hsa_insns_for_single_assignment): Respect
>       alignment for assignments processed via
>       gen_hsa_memory_copy.
>       (gen_hsa_insns_for_direct_call): Likewise.
>       (gen_hsa_insns_for_return): Likewise.
>       (gen_function_def_parameters): Set default
>       alignment.
>       * hsa.c (hsa_object_alignment): New function.
>       (hsa_byte_alignment): Pasted function.
>       * hsa.h (hsa_symbol::m_align): New field.
> ---
>  gcc/hsa-brig.c |  5 +---
>  gcc/hsa-dump.c | 13 ++-------
>  gcc/hsa-gen.c  | 88 
> +++++++++++++++++++++++++++++++++++++++++++++-------------
>  gcc/hsa.c      | 20 +++++++++++++
>  gcc/hsa.h      |  8 +++++-
>  5 files changed, 99 insertions(+), 35 deletions(-)
> 
> diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c
> index 72eecf9..db39813 100644
> --- a/gcc/hsa-gen.c
> +++ b/gcc/hsa-gen.c
> @@ -169,12 +169,12 @@ hsa_symbol::hsa_symbol ()
>  
>  hsa_symbol::hsa_symbol (BrigType16_t type, BrigSegment8_t segment,
>                       BrigLinkage8_t linkage, bool global_scope_p,
> -                     BrigAllocation allocation)
> +                     BrigAllocation allocation, BrigAlignment8_t align)
>    : m_decl (NULL_TREE), m_name (NULL), m_name_number (0),
>      m_directive_offset (0), m_type (type), m_segment (segment),
>      m_linkage (linkage), m_dim (0), m_cst_value (NULL),
>      m_global_scope_p (global_scope_p), m_seen_error (false),
> -    m_allocation (allocation), m_emitted_to_brig (false)
> +    m_allocation (allocation), m_emitted_to_brig (false), m_align (align)
>  {
>  }
>  
> @@ -908,21 +908,29 @@ get_symbol_for_decl (tree decl)
>      {
>        hsa_symbol *sym;
>        gcc_assert (TREE_CODE (decl) == VAR_DECL);
> +      BrigAlignment8_t align = hsa_object_alignment (decl);
>  
>        if (is_in_global_vars)
>       {
>         sym = new hsa_symbol (BRIG_TYPE_NONE, BRIG_SEGMENT_GLOBAL,
>                               BRIG_LINKAGE_PROGRAM, true,
> -                             BRIG_ALLOCATION_PROGRAM);
> +                             BRIG_ALLOCATION_PROGRAM, align);
>         hsa_cfun->m_global_symbols.safe_push (sym);
>       }
>        else
>       {
> +       /* As generation of memory copy instructions relies on alignment
> +          greater or equal to 8 bytes, we need to increase alignment
> +          of all aggregate types.. */

Let's say "efficient memory copy instructions."  It is of curse
possible to use slower ones.

Thanks,

Martin

Reply via email to