Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: ken@linux.vnet.ibm.com (Ken Werner)
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Scalar to vector widening
Date: Tue, 05 Oct 2010 18:08:00 -0000	[thread overview]
Message-ID: <201010051808.o95I87Xt013258@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <201009171458.29584.ken@linux.vnet.ibm.com> from "Ken Werner" at Sep 17, 2010 02:58:29 PM

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)
> 	<BINOP_ASSIGN_MODIFY, BINOP_LSH, BINOP_RSH>: 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


  parent reply	other threads:[~2010-10-05 18:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-17 14:39 Ken Werner
2010-09-28 16:08 ` Ken Werner
2010-10-05 18:08 ` Ulrich Weigand [this message]
2010-10-07 20:41   ` Ken Werner
2010-10-08 13:14     ` Ulrich Weigand
2010-10-08 16:37       ` Ken Werner
2010-10-08 16:44         ` Ulrich Weigand
2010-10-08 16:52           ` Ken Werner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201010051808.o95I87Xt013258@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=ken@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox