public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Jim Wilson <jimw@sifive.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 2/3] RISC-V: gdb.base/gnu_vector fixes.
Date: Thu, 08 Nov 2018 14:37:00 -0000	[thread overview]
Message-ID: <20181108143716.GY16539@embecosm.com> (raw)
In-Reply-To: <20181106214428.22262-1-jimw@sifive.com>

* Jim Wilson <jimw@sifive.com> [2018-11-06 13:44:28 -0800]:

> GCC gives vectors natural aligment based on total size, not element size,
> bounded by the maximum supported type alignment.
> 
> 	gdb/
> 	* riscv-tdep.c (BIGGEST_ALIGNMENT): New.
> 	(riscv_type_alignment) <TYPE_CODE_ARRAY>: If TYPE_VECTOR, return min
> 	of TYPE_LENGTH and BIGGEST_ALIGNMENT.

As with patch #1, please update the patch title line.

> ---
>  gdb/riscv-tdep.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
> index ac4f2533f4..3d4f7e3dcc 100644
> --- a/gdb/riscv-tdep.c
> +++ b/gdb/riscv-tdep.c
> @@ -59,6 +59,9 @@
>  /* The stack must be 16-byte aligned.  */
>  #define SP_ALIGNMENT 16
>  
> +/* The biggest alignment that the target supports.  */
> +#define BIGGEST_ALIGNMENT 16
> +
>  /* Forward declarations.  */
>  static bool riscv_has_feature (struct gdbarch *gdbarch, char feature);
>  
> @@ -1640,6 +1643,10 @@ riscv_type_alignment (struct type *t)
>        return TYPE_LENGTH (t);
>  
>      case TYPE_CODE_ARRAY:
> +      if (TYPE_VECTOR (t))
> +	return std::min (TYPE_LENGTH (t), (unsigned)BIGGEST_ALIGNMENT);

I think there's supposed to be a space after the cast, '(unsigned) BIGGEST_ALIGNMENT'.

> +      /* FALLTHROUGH */
> +
>      case TYPE_CODE_COMPLEX:
>        return riscv_type_alignment (TYPE_TARGET_TYPE (t));
>  
> -- 
> 2.17.1
> 

Otherwise, look fine.

Thanks,
Andrew

  reply	other threads:[~2018-11-08 14:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 21:43 [PATCH 0/3] " Jim Wilson
2018-11-06 21:44 ` [PATCH 2/3] " Jim Wilson
2018-11-08 14:37   ` Andrew Burgess [this message]
2018-11-06 21:44 ` [PATCH 1/3] " Jim Wilson
2018-11-08 15:43   ` Andrew Burgess
2018-11-13  1:52     ` Jim Wilson
2018-11-06 21:44 ` [PATCH 3/3] " Jim Wilson
2018-11-08 14:34   ` Andrew Burgess
2018-11-08 14:44     ` Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181108143716.GY16539@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jimw@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).