From patchwork Tue Dec 10 11:44:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1207041 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-515595-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="fMVnkb0U"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47XJB63Klbz9sRK for ; Tue, 10 Dec 2019 22:44:13 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=IFbF7w/KuTMRznYhR2imEd0Fsl5jw7ipo8PPKDegunrRHU9IdsRxs ShYtO89wBMD6nv5cKyQUOVQsIQVk2CEf9lV37JbTseFZEPNMyXY5hSY1oSzblRP+ hrGPdnzxPZHAQKHOTAS+g+QiM+sUDcomkeMfCpb+VZu2N8kyrjJ0hI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=f1/zIUAoLH9S5JAMCNpkBf249yg=; b=fMVnkb0U2JBQk0tS516P ta55MndA7Zi3DaUSPN8ovTC2pN0TL9XwpNlxJrQbJKyzn0wy89a0H7ikBkCMR0sl dwNb4N/P0FotCVIpCPxZxxvyDvRkop7xrEHqkOfmJjDZHir2yalcEy3MWL0iJcwr LgvbaWGCrqzeCAU98dkdVDA= Received: (qmail 20100 invoked by alias); 10 Dec 2019 11:44:06 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 20091 invoked by uid 89); 10 Dec 2019 11:44:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=dwarf2out.c, dwarf2outc, UD:dwarf2out.c X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Dec 2019 11:44:04 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5D05B1FB for ; Tue, 10 Dec 2019 03:44:03 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 04B523F6CF for ; Tue, 10 Dec 2019 03:44:02 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: Make dwarf2out punt for MODE_VECTOR_BOOL Date: Tue, 10 Dec 2019 11:44:01 +0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes The dwarf2 handling of vector constants currently divides the vector into a length (number of elements) and byte element size. This doesn't work well for MODE_VECTOR_BOOL, where several elements are packed into the same byte. We should probably add a way of encoding this in future, but for now the safest thing is to punt, like we already do for variable-length vectors. Tested on aarch64-linux-gnu and x86_64-linux-gnu. OK to install? Richard 2019-12-10 Richard Sandiford gcc/ * dwarf2out.c (loc_descriptor): Punt for MODE_VECTOR_BOOL. (add_const_value_attribute): Likewise. gcc/testsuite/ * gcc.target/aarch64/sve/acle/general/debug_4.c: New test. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c 2019-11-29 13:04:13.978672241 +0000 +++ gcc/dwarf2out.c 2019-12-10 11:43:15.560875505 +0000 @@ -16763,7 +16763,12 @@ loc_descriptor (rtx rtl, machine_mode mo if (mode == VOIDmode) mode = GET_MODE (rtl); - if (mode != VOIDmode && (dwarf_version >= 4 || !dwarf_strict)) + if (mode != VOIDmode + /* The combination of a length and byte elt_size doesn't extend + naturally to boolean vectors, where several elements are packed + into the same byte. */ + && GET_MODE_CLASS (mode) != MODE_VECTOR_BOOL + && (dwarf_version >= 4 || !dwarf_strict)) { unsigned int length; if (!CONST_VECTOR_NUNITS (rtl).is_constant (&length)) @@ -19622,6 +19627,12 @@ add_const_value_attribute (dw_die_ref di return false; machine_mode mode = GET_MODE (rtl); + /* The combination of a length and byte elt_size doesn't extend + naturally to boolean vectors, where several elements are packed + into the same byte. */ + if (GET_MODE_CLASS (mode) == MODE_VECTOR_BOOL) + return false; + unsigned int elt_size = GET_MODE_UNIT_SIZE (mode); unsigned char *array = ggc_vec_alloc (length * elt_size); Index: gcc/testsuite/gcc.target/aarch64/sve/acle/general/debug_4.c =================================================================== --- /dev/null 2019-09-17 11:41:18.176664108 +0100 +++ gcc/testsuite/gcc.target/aarch64/sve/acle/general/debug_4.c 2019-12-10 11:43:15.572875421 +0000 @@ -0,0 +1,16 @@ +/* { dg-options "-O -g -msve-vector-bits=512" } */ + +#include + +void __attribute__((noipa)) +g (volatile int *x, svbool_t pg) +{ + *x = 1; +} + +void +f (volatile int *x) +{ + svbool_t pg = svorr_z (svpfalse (), svpfalse (), svpfalse ()); + g (x, pg); +}