From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17664 invoked by alias); 5 Oct 2010 18:08:19 -0000 Received: (qmail 17654 invoked by uid 22791); 5 Oct 2010 18:08:18 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate3.de.ibm.com (HELO mtagate3.de.ibm.com) (195.212.17.163) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 05 Oct 2010 18:08:11 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate3.de.ibm.com (8.13.1/8.13.1) with ESMTP id o95I89sp028001 for ; Tue, 5 Oct 2010 18:08:09 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o95I88CS4083802 for ; Tue, 5 Oct 2010 20:08:08 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id o95I88Tt013278 for ; Tue, 5 Oct 2010 20:08:08 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id o95I87Xt013258; Tue, 5 Oct 2010 20:08:07 +0200 Message-Id: <201010051808.o95I87Xt013258@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Tue, 05 Oct 2010 20:08:07 +0200 Subject: Re: [patch] Scalar to vector widening To: ken@linux.vnet.ibm.com (Ken Werner) Date: Tue, 05 Oct 2010 18:08:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <201009171458.29584.ken@linux.vnet.ibm.com> from "Ken Werner" at Sep 17, 2010 02:58:29 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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/msg00048.txt.bz2 Ken Werner wrote: > This patch adds support for widening scalars to vectors to allow binary > operations with mixed operand types. It mainly extends the binop_promote > function to call widen_scalar_to_vector if required. No regressions on i686-*- > linux-gnu. > * value.h (widen_scalar_to_vector): Declare. > * valops.c (widen_scalar_to_vector): New function. > (value_assign): Add call to widen_scalar_to_vector. > * eval.c (binop_promote, evaluate_subexp_standard) > : Likewise. I've been thinking about this a bit. One piece that's missing here is support for explicit casts. For OpenCL vectors (and that seems like a useful extension in general), you can use an explicit type cast operation to widen a scalar value to a vector, e.g. like float f = 1.0f; float4 v = (float4) f; I think it would be better to change your patch to perform the operation you're doing in the new widen_scalar_to_vector routine simply in value_cast instead (if the source is a scalar and the target type a vector type). This would support the above-mentioned OpenCL language feature, and it would also simplify implict widening for operators. Note that e.g. both binop_promote and value_assign already call value_cast in their regular operation; it's just a matter of using the appropriate target type ... Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com