From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 75AD03858D28 for ; Mon, 17 Oct 2022 13:22:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 75AD03858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666012923; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gbOrZR+ze0h0eIZuAiqE5PuTyKkEVLBhAXSukhsFK24=; b=jOY+tiPPSyrXwpCvO+Joi+LDdV51rjgMKMYoTIpdxCFR+UK6MHSmEzEkD6moqpODWQ6Rhk NvUe+XIQceXKUXnT6YDPNuNwcaIs2YEejpQou/RMvZ8wgwuqNczOpSa/JNXdZCNds1gZJn 4O7R/3FhzGojpDa6HP1Zzwr8/BrvWC4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-582-crHfYV3XN1KLN-0pfkkKNg-1; Mon, 17 Oct 2022 09:22:00 -0400 X-MC-Unique: crHfYV3XN1KLN-0pfkkKNg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2E3ED857FAB; Mon, 17 Oct 2022 13:21:54 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.193.168]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F11E40CA40C; Mon, 17 Oct 2022 13:21:51 +0000 (UTC) From: Florian Weimer To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] libgcc: Mostly vectorize CIE encoding extraction for FDEs References: <87edv6mwp5.fsf@oldenburg.str.redhat.com> Date: Mon, 17 Oct 2022 15:21:48 +0200 In-Reply-To: (Richard Biener's message of "Mon, 17 Oct 2022 15:17:21 +0200") Message-ID: <87r0z6lh5f.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * Richard Biener: > On Mon, Oct 17, 2022 at 3:01 PM Florian Weimer via Gcc-patches > 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