From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99870 invoked by alias); 3 Nov 2015 13:42:19 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 99827 invoked by uid 89); 3 Nov 2015 13:42:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yk0-f181.google.com Received: from mail-yk0-f181.google.com (HELO mail-yk0-f181.google.com) (209.85.160.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 03 Nov 2015 13:42:17 +0000 Received: by ykdr3 with SMTP id r3so15517854ykd.1 for ; Tue, 03 Nov 2015 05:42:15 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.129.46.212 with SMTP id u203mr15522467ywu.147.1446558135677; Tue, 03 Nov 2015 05:42:15 -0800 (PST) Received: by 10.37.117.136 with HTTP; Tue, 3 Nov 2015 05:42:15 -0800 (PST) In-Reply-To: References: <20151028131339.GC20857@msticlxl57.ims.intel.com> Date: Tue, 03 Nov 2015 13:42:00 -0000 Message-ID: Subject: Re: [PATCH] Use signed boolean type for boolean vectors From: Richard Biener To: Ilya Enkovich Cc: GCC Patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg00199.txt.bz2 On Wed, Oct 28, 2015 at 4:30 PM, Ilya Enkovich wrote: > 2015-10-28 18:21 GMT+03:00 Richard Biener : >> On Wed, Oct 28, 2015 at 2:13 PM, Ilya Enkovich wrote: >>> Hi, >>> >>> Testing boolean vector conversions I found several runtime regressions >>> and investigation showed it's due to incorrect conversion caused by >>> unsigned boolean type. When boolean vector is represented as an >>> integer vector on target it's a signed integer actually. Unsigned >>> boolean type was chosen due to possible single bit values, but for >>> multiple bit values it causes wrong casting. The easiest way to fix >>> it is to use signed boolean value. The following patch does this and >>> fixes my problems with conversion. Bootstrapped and tested on >>> x86_64-unknown-linux-gnu. Is it OK? >> >> Hmm. Actually formally the "boolean" vectors were always 0 or -1 >> (all bits set). That is also true for a signed boolean with precision 1 >> but with higher precision what makes sure to sign-extend 'true'? >> >> So it's far from an obvious change, esp as you don't change the >> precision == 1 case. [I still think we should have precision == 1 >> for all boolean types] >> >> Richard. >> > > For 1 bit precision signed type value 1 is out of range, right? This might break > in many place due to used 1 as true value. For vectors -1 is true. Did you try whether it breaks many places? build_int_cst (type, 1) should still work fine. Richard. > > Ilya