public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bill Schmidt <wschmidt@linux.ibm.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: gcc-patches@gcc.gnu.org, dje.gcc@gmail.com
Subject: Re: [PATCH v2 1/8] rs6000: More factoring of overload processing
Date: Wed, 2 Feb 2022 12:46:37 -0600	[thread overview]
Message-ID: <0df5ab62-b272-dc71-89d9-4bdf26181255@linux.ibm.com> (raw)
In-Reply-To: <20220201214836.GV614@gate.crashing.org>

Hi!

On 2/1/22 3:48 PM, Segher Boessenkool wrote:
> On Tue, Feb 01, 2022 at 08:49:34AM -0600, Bill Schmidt wrote:
>> I've modified the previous patch to add more explanatory commentary about
>> the number-of-arguments test that was previously confusing, and to convert
>> the switch into an if-then-else chain.  The rest of the patch is unchanged.
>> Bootstrapped and tested on powerpc64le-linux-gnu.  Is this okay for trunk?
>> gcc/
>> 	* config/rs6000/rs6000-c.cc (resolve_vec_mul): Accept args and types
>> 	parameters instead of arglist and nargs.  Simplify accordingly.  Remove
>> 	unnecessary test for argument count mismatch.
>> 	(resolve_vec_cmpne): Likewise.
>> 	(resolve_vec_adde_sube): Likewise.
>> 	(resolve_vec_addec_subec): Likewise.
>> 	(altivec_resolve_overloaded_builtin): Move overload special handling
>> 	after the gathering of arguments into args[] and types[] and the test
>> 	for correct number of arguments.  Don't perform the test for correct
>> 	number of arguments for certain special cases.  Call the other special
>> 	cases with args and types instead of arglist and nargs.
>> +  if (fcode != RS6000_OVLD_VEC_PROMOTE
>> +      && fcode != RS6000_OVLD_VEC_SPLATS
>> +      && fcode != RS6000_OVLD_VEC_EXTRACT
>> +      && fcode != RS6000_OVLD_VEC_INSERT
>> +      && fcode != RS6000_OVLD_VEC_STEP
>> +      && (!VOID_TYPE_P (TREE_VALUE (fnargs)) || n < nargs))
>>      return NULL;
> Please don't do De Morgan manually, let the compiler deal with it?
> Although even with that the logic is as clear as mud.  This matters if
> someone (maybe even you) will have to debug this later, or modify this.
> Maybe adding some suitably named variables can clarify things  here?

I can de-deMorgan this.  Do you want to see the patch again, or is it okay
with that change?

Thanks!
Bill

>
>> +  if (fcode == RS6000_OVLD_VEC_MUL)
>> +    returned_expr = resolve_vec_mul (&res, args, types, loc);
>> +  else if (fcode == RS6000_OVLD_VEC_CMPNE)
>> +    returned_expr = resolve_vec_cmpne (&res, args, types, loc);
>> +  else if (fcode == RS6000_OVLD_VEC_ADDE || fcode == RS6000_OVLD_VEC_SUBE)
>> +    returned_expr = resolve_vec_adde_sube (&res, fcode, args, types, loc);
>> +  else if (fcode == RS6000_OVLD_VEC_ADDEC || fcode == RS6000_OVLD_VEC_SUBEC)
>> +    returned_expr = resolve_vec_addec_subec (&res, fcode, args, types, loc);
>> +  else if (fcode == RS6000_OVLD_VEC_SPLATS || fcode == RS6000_OVLD_VEC_PROMOTE)
>> +    returned_expr = resolve_vec_splats (&res, fcode, arglist, nargs);
>> +  else if (fcode == RS6000_OVLD_VEC_EXTRACT)
>> +    returned_expr = resolve_vec_extract (&res, arglist, nargs, loc);
>> +  else if (fcode == RS6000_OVLD_VEC_INSERT)
>> +    returned_expr = resolve_vec_insert (&res, arglist, nargs, loc);
>> +  else if (fcode == RS6000_OVLD_VEC_STEP)
>> +    returned_expr = resolve_vec_step (&res, arglist, nargs);
>> +
>> +  if (res == resolved)
>> +    return returned_expr;
> This is so convoluted because the functions do two things, and have two
> return values (res and returned_expr).
>
>
> Segher

  reply	other threads:[~2022-02-02 18:46 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 17:50 [PATCH 0/8] rs6000: Built-in function cleanups and bug fixes Bill Schmidt
2022-01-28 17:50 ` [PATCH 1/8] rs6000: More factoring of overload processing Bill Schmidt
2022-01-28 19:11   ` Segher Boessenkool
2022-01-28 21:19     ` Bill Schmidt
2022-01-28 23:09       ` Segher Boessenkool
2022-02-01 14:49     ` [PATCH v2 " Bill Schmidt
2022-02-01 21:48       ` Segher Boessenkool
2022-02-02 18:46         ` Bill Schmidt [this message]
2022-02-03 14:44         ` [PATCH v3 " Bill Schmidt
2022-02-04  1:24           ` Segher Boessenkool
2022-01-28 17:50 ` [PATCH 2/8] rs6000: Don't #ifdef "short" built-in names Bill Schmidt
2022-01-28 20:32   ` Segher Boessenkool
2022-01-28 21:21     ` Bill Schmidt
2022-01-28 17:50 ` [PATCH 3/8] rs6000: Convert <x> built-in constraints to <x,y> form Bill Schmidt
2022-01-28 23:24   ` [PATCH 3/8] rs6000: Convert <x> built-in constraints to <x, y> form Segher Boessenkool
2022-01-31 17:21     ` [PATCH 3/8] rs6000: Convert <x> built-in constraints to <x,y> form Bill Schmidt
2022-01-31 17:28       ` [PATCH 3/8] rs6000: Convert <x> built-in constraints to <x, y> form Segher Boessenkool
2022-01-31 17:31         ` [PATCH 3/8] rs6000: Convert <x> built-in constraints to <x,y> form Bill Schmidt
2022-02-01 14:53         ` [PATCH v2 3/8] rs6000: Unify error messages for built-in constant restrictions Bill Schmidt
2022-02-01 22:16           ` Segher Boessenkool
2022-01-28 17:50 ` [PATCH 4/8] rs6000: Consolidate target built-ins code Bill Schmidt
2022-01-31 21:32   ` Segher Boessenkool
2022-01-31 22:01     ` Bill Schmidt
2022-01-31 22:33       ` Segher Boessenkool
2022-01-28 17:50 ` [PATCH 5/8] rs6000: Fix LE code gen for vec_cnt[lt]z_lsbb [PR95082] Bill Schmidt
2022-02-01 23:01   ` Segher Boessenkool
2022-01-28 17:50 ` [PATCH 6/8] rs6000: Remove -m[no-]fold-gimple flag [PR103686] Bill Schmidt
2022-02-02 23:21   ` Segher Boessenkool
2022-01-28 17:50 ` [PATCH 7/8] rs6000: vec_neg built-ins wrongly require POWER8 Bill Schmidt
2022-02-07 15:48   ` Bill Schmidt
2022-03-30 18:04   ` Segher Boessenkool
2022-01-28 17:50 ` [PATCH 8/8] rs6000: Fix some missing built-in attributes [PR104004] Bill Schmidt
2022-03-15 13:18   ` rs6000 patch ping: " Jakub Jelinek
2022-03-30 12:28     ` rs6000 patch ping^2: " Jakub Jelinek
2022-03-30 23:07     ` rs6000 patch ping: " Segher Boessenkool
2022-03-31 22:17       ` Segher Boessenkool
2022-03-30 17:41   ` will schmidt

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=0df5ab62-b272-dc71-89d9-4bdf26181255@linux.ibm.com \
    --to=wschmidt@linux.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).