From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11606 invoked by alias); 7 Oct 2010 16:23:41 -0000 Received: (qmail 11595 invoked by uid 22791); 7 Oct 2010 16:23:38 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate6.de.ibm.com (HELO mtagate6.de.ibm.com) (195.212.17.166) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 07 Oct 2010 16:23:33 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate6.de.ibm.com (8.13.1/8.13.1) with ESMTP id o97GNUws024751 for ; Thu, 7 Oct 2010 16:23:30 GMT Received: from d12av04.megacenter.de.ibm.com (d12av04.megacenter.de.ibm.com [9.149.165.229]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o97GNT4D3653672 for ; Thu, 7 Oct 2010 18:23:30 +0200 Received: from d12av04.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av04.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id o97GNTle027721 for ; Thu, 7 Oct 2010 18:23:29 +0200 Received: from leonard.localnet (dyn-9-152-224-33.boeblingen.de.ibm.com [9.152.224.33]) by d12av04.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id o97GNNKE027514 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 7 Oct 2010 18:23:29 +0200 From: Ken Werner To: Joel Brobecker Subject: Re: [patch] GNU vector unop support Date: Thu, 07 Oct 2010 16:23:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.32-25-generic; KDE/4.4.2; i686; ; ) Cc: gdb-patches@sourceware.org References: <201009171033.35808.ken@linux.vnet.ibm.com> <201010042251.57223.ken@linux.vnet.ibm.com> <20101006232659.GC12651@adacore.com> In-Reply-To: <20101006232659.GC12651@adacore.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201010071823.22427.ken@linux.vnet.ibm.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-10/txt/msg00124.txt.bz2 On Thursday, October 07, 2010 1:26:59 am Joel Brobecker wrote: > > > One question: Is it possible to have a non-array vector type? > > > In other words, can we just check for TYPE_VECTOR (type) instead > > > of TYPE_CODE (type) and TYPE_VECTOR (type)? > > > > No, not that I'm aware of. Even a GNU Vector with a single element > > only is an array underneath. My understanding is that querying the > > flag_vector is only legal if the type is an array. > > I feel that this makes the check for the TYPE_CODE a little superfluous. > But at the same time, the code handling vectors then assumes that the > underlying type is an array. Ok, I see your point. : ) It seems my statement was incorrect. I missed that various backends (e.g. i386-tdep.c:i386_mmx_type or rs6000- tdep.c:rs6000_builtin_type_vec64) create vectors with TYPE_CODE_UNION for their vector registers. Therefore checking the vector flag only may not always work as expected. > > ChangeLog: > > > > 2010-10-04 Ken Werner > > > > * valarith.c (value_pos, value_neg, value_complement): Handle > > vector types. > > * valops.c (value_one): Likewise. > > > > testsuite/ChangeLog: > > > > 2010-10-04 Ken Werner > > > > * gdb.base/gnu_vector.exp: Add unary operator tests. > > This is OK. Thanks. I'd prefer to wait with the commit until the lval-issue gets resolved. > If it was just me, I'd probably wrap the checks for vector types > inside a function (such as type_is_vector or vector_type_p), with > a comment explaining the reason why we check for the TYPE_CODE > despite the fact that, normally, all types with the `vector' flag > should be arrays. (this is just a soft suggestion, and to be treated > as a followup patch, if not ignored) It would clearly improve the readability of the source code. Giving vectors a distinct type code may also be an option. Regards Ken