From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 81B5538582B4; Mon, 24 Oct 2022 07:17:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 81B5538582B4 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 9CC161F85D; Mon, 24 Oct 2022 07:17:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1666595823; h=from:from:reply-to: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=QQu1JmKY+94w9GYm0GZWFWxePvr5pL2vyKK/KoOttqg=; b=RZ3xPzWnF78QKt8etBlChAwmHMeh+U6D387+fSjFR6qB3rem4s9MmAupD06q9Iv6UhK4By RkQlKMB0x5C8F+PfxtkrwGVvCIVKPQOA10hph2NsZVB6NIHboPxWaHTGNzqHSbhFWhcpCq ByrBAXjulmoQkBvaGm69E513st97Y18= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1666595823; h=from:from:reply-to: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=QQu1JmKY+94w9GYm0GZWFWxePvr5pL2vyKK/KoOttqg=; b=J7iUyL7I8dMBADElm07imLEcVbZGTWoIKL89iXQbAQpV/QbXa2XUNtXXRZUl60DR2Pzb2g 9v9sCvVhzFSbKOCg== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 93DA32C141; Mon, 24 Oct 2022 07:17:03 +0000 (UTC) Date: Mon, 24 Oct 2022 07:17:03 +0000 (UTC) From: Richard Biener To: "Andre Vieira (lists)" cc: "gcc-patches@gcc.gnu.org" , Richard Sandiford , ebotcazou@gcc.gnu.org Subject: Re: vect: Make vect_check_gather_scatter reject offsets that aren't multiples of BITS_PER_UNIT [PR107346] In-Reply-To: <129db1b0-0d2a-b768-bc80-9f73d665e8f8@arm.com> Message-ID: References: <129db1b0-0d2a-b768-bc80-9f73d665e8f8@arm.com> User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="-1609957120-357579951-1666595823=:4294" X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,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: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1609957120-357579951-1666595823=:4294 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT On Fri, 21 Oct 2022, Andre Vieira (lists) wrote: > Hi, > > The ada failure reported in the PR was being caused by > vect_check_gather_scatter failing to deal with bit offsets that weren't > multiples of BITS_PER_UNIT. This patch makes vect_check_gather_scatter reject > memory accesses with such offsets. > > Bootstrapped and regression tested on aarch64 and x86_64. > > I wasn't sure whether I should add a new Ada test that shows the same failure > without the bitfield lowering, I suspect this is such a rare form of > data-structure that is why no other tests have highlighted the failure. Let me > know if you would like me to add it still, the change is quite simple, just > change the Int24 -> Int32 type in the structure. The 'thing' that causes the > failure is the 4-bit member inside the packed structure before the field we > access, giving it a 4-bit offset. I attempted but failed to create a C test > using __attribute__((packed)). Can you check why vect_find_stmt_data_reference doesn't trip on the if (TREE_CODE (DR_REF (dr)) == COMPONENT_REF && DECL_BIT_FIELD (TREE_OPERAND (DR_REF (dr), 1))) { free_data_ref (dr); return opt_result::failure_at (stmt, "not vectorized:" " statement is an unsupported" " bitfield access %G", stmt); } ? I think we should amend this check and I guess that checking multiple_p on DECL_FIELD_BIT_OFFSET should be enough? Eric - the docs of DECL_BIT_FIELD are vague enough "must be accessed specially" but ISTR it might eventually only apply to the fields (bit) size and not it's position. OTOH the Ada frontend might not be too careful in setting this flag for bit-packed structs? Richard. > Kind Regards, > Andre > > gcc/ChangeLog: > >         PR tree-optimization/107346 >         * tree-vect-data-refs.cc (vect_check_gather_scatter): Reject > offsets that aren't >         multiples of BITS_PER_UNIT. > -- Richard Biener SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman; HRB 36809 (AG Nuernberg) ---1609957120-357579951-1666595823=:4294--