rs6000: Refactor altivec_build_resolved_builtin
authorBill Schmidt <wschmidt@linux.ibm.com>
Thu, 16 Dec 2021 13:47:58 +0000 (07:47 -0600)
committerBill Schmidt <wschmidt@linux.ibm.com>
Thu, 16 Dec 2021 13:51:26 +0000 (07:51 -0600)
commitab3f5b71dc6e800cb194028e2f0797e9fb3cb935
treec77546364f7069e82c8caa8f4e2ccbf6cbd3a4c1
parent0a68862e782847752be0ea2b2a987278cdbefc9e
rs6000: Refactor altivec_build_resolved_builtin

While replacing the built-in machinery, we agreed to defer some necessary
refactoring of the overload processing.  This patch cleans it up considerably.

I've put in one FIXME for an additional level of cleanup that should be done
independently.  The various helper functions (resolve_VEC_*) can be simplified
if we move the argument processing in altivec_resolve_overloaded_builtin
earlier.  But this requires making nontrivial changes to those functions that
will need careful review.  Let's do that in a later patch.

2021-12-16  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
* config/rs6000/rs6000-c.c (resolution): New enum.
(resolve_vec_mul): New function.
(resolve_vec_cmpne): Likewise.
(resolve_vec_adde_sube): Likewise.
(resolve_vec_addec_subec): Likewise.
(resolve_vec_splats): Likewise.
(resolve_vec_extract): Likewise.
(resolve_vec_insert): Likewise.
(resolve_vec_step): Likewise.
(find_instance): Likewise.
(altivec_resolve_overloaded_builtin): Many cleanups.  Call factored-out
functions.  Move variable declarations closer to uses.  Add commentary.
Remove unnecessary levels of braces.  Avoid use of gotos.  Change
misleading variable names.  Use switches over if-else-if chains.
gcc/config/rs6000/rs6000-c.c