From: Florian Weimer <fweimer@redhat.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] libgcc: Mostly vectorize CIE encoding extraction for FDEs
Date: Mon, 17 Oct 2022 15:21:48 +0200 [thread overview]
Message-ID: <87r0z6lh5f.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CAFiYyc03z+889_GCFU++3UdTwBF0BgrgDefteYdLqVMQ4147gQ@mail.gmail.com> (Richard Biener's message of "Mon, 17 Oct 2022 15:17:21 +0200")
* Richard Biener:
> On Mon, Oct 17, 2022 at 3:01 PM Florian Weimer via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
>>
>> "zR" and "zPLR" are the most common augmentations. Use a simple
>> SIMD-with-in-a-register technique to check for both augmentations,
>> and that the following variable-length integers have length 1, to
>> get more quickly at the encoding field.
>>
>> libgcc/
>>
>> * unwind-dw2-fde.c (get_cie_encoding_slow): Rename from
>> get_cie_encoding. Mark as noinline.
>> (get_cie_encoding): Add fast path for "zR" and "zPLR"
>> augmentations. Call get_cie_encoding_slow as a fall-back.
>>
>> ---
>> libgcc/unwind-dw2-fde.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++--
>> 1 file changed, 59 insertions(+), 2 deletions(-)
>>
>> diff --git a/libgcc/unwind-dw2-fde.c b/libgcc/unwind-dw2-fde.c
>> index 3c0cc654ec0..4e3a54c5a1a 100644
>> --- a/libgcc/unwind-dw2-fde.c
>> +++ b/libgcc/unwind-dw2-fde.c
>> @@ -333,8 +333,10 @@ base_from_object (unsigned char encoding, const struct object *ob)
>> /* Return the FDE pointer encoding from the CIE. */
>> /* ??? This is a subset of extract_cie_info from unwind-dw2.c. */
>>
>> -static int
>> -get_cie_encoding (const struct dwarf_cie *cie)
>> +/* Disable inlining because the function is only used as a slow path in
>> + get_cie_encoding below. */
>> +static int __attribute__ ((noinline))
>> +get_cie_encoding_slow (const struct dwarf_cie *cie)
>> {
>> const unsigned char *aug, *p;
>> _Unwind_Ptr dummy;
>> @@ -389,6 +391,61 @@ get_cie_encoding (const struct dwarf_cie *cie)
>> }
>> }
>>
>> +static inline int
>> +get_cie_encoding (const struct dwarf_cie *cie)
>> +{
>> + /* Fast path for some augmentations and single-byte variable-length
>> + integers. Do this only for targets that align struct dwarf_cie to 8
>> + bytes, which ensures that at least 8 bytes are available starting at
>> + cie->version. */
>> +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ \
>> + || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
>> + if (__alignof (*cie) == 8 && sizeof (unsigned long long) == 8)
>> + {
>> + unsigned long long value = *(const unsigned long long *) &cie->version;
>
> TBAA? Maybe use
>
> unsigned long long value;
> memcpy (&value, &cie->version, 8);
>
> instead?
It's following the existing libgcc style, see
read_encoded_value_with_base in unwind-pe.h.
We know here that the pointer is aligned, but perhaps GCC still can use
that information if using memcpy.
I can certainly change it to memcpy.
Thanks,
Florian
prev parent reply other threads:[~2022-10-17 13:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-17 13:00 Florian Weimer
2022-10-17 13:17 ` Richard Biener
2022-10-17 13:21 ` Florian Weimer [this message]
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=87r0z6lh5f.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=richard.guenther@gmail.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).