From: Jim Wilson <jimw@sifive.com>
To: gdb-patches@sourceware.org
Cc: Jim Wilson <jimw@sifive.com>
Subject: [PATCH 2/3] RISC-V: gdb.base/gnu_vector fixes.
Date: Tue, 06 Nov 2018 21:44:00 -0000 [thread overview]
Message-ID: <20181106214428.22262-1-jimw@sifive.com> (raw)
In-Reply-To: <CAFyWVaYMo6sOfXQqZ3YuRyjSnsfGSB9vZTO43j6hKRva73_TCA@mail.gmail.com>
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.
---
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);
+ /* FALLTHROUGH */
+
case TYPE_CODE_COMPLEX:
return riscv_type_alignment (TYPE_TARGET_TYPE (t));
--
2.17.1
next prev parent reply other threads:[~2018-11-06 21:44 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 ` Jim Wilson [this message]
2018-11-08 14:37 ` [PATCH 2/3] " Andrew Burgess
2018-11-06 21:44 ` [PATCH 3/3] " Jim Wilson
2018-11-08 14:34 ` Andrew Burgess
2018-11-08 14:44 ` Andrew Burgess
2018-11-06 21:44 ` [PATCH 1/3] " Jim Wilson
2018-11-08 15:43 ` Andrew Burgess
2018-11-13 1:52 ` Jim Wilson
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=20181106214428.22262-1-jimw@sifive.com \
--to=jimw@sifive.com \
--cc=gdb-patches@sourceware.org \
/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