GCC maintainers:
This patch was previously posted. Per the feedback, it is now the first
of two patches to remove the set built-ins.
This patch removes the __builtin_vec_set_v1ti, __builtin_vec_set_v2df
and __builtin_vec_set_v2di built-ins. The users should just use normal
C-code to update the various vector elements. This change was
originally intended to be part of the earlier series of cleanup
patches. It was initially thought that some additional work would be
needed to do some gimple generation instead of these built-ins.
However, the existing default code generation does produce the needed
code. For the vec_set bif, the equivalent C code is as good or better
than the built-in. For the vec_insert bif whose resolving previously
made use of the vec_set bif, the assembly code generation is as good as
before with the -O3 optimization.
The patch has been tested on Power 10 LE with no regressions.
Please let me know if the patch is acceptable for mainline. Thanks.
Carl
-----------------------------------------------------------------------------------------------------------------
rs6000, Remove __builtin_vec_set_v1ti, __builtin_vec_set_v2df,
__builtin_vec_set_v2di
Remove the built-ins, use the default gimple generation instead.
gcc/ChangeLog:
* config/rs6000/rs6000-builtins.def (__builtin_vec_set_v1ti,
__builtin_vec_set_v2df, __builtin_vec_set_v2di): Remove built-in
definitions.
* config/rs6000/rs6000-c.cc (resolve_vec_insert): Remove the
handling for constant vec_insert position with
VECTOR_UNIT_VSX_P V1TImode, V2DFmode and V2DImode modes.
---
gcc/config/rs6000/rs6000-builtins.def | 13 ---------
gcc/config/rs6000/rs6000-c.cc | 40 ---------------------------
2 files changed, 53 deletions(-)
diff --git a/gcc/config/rs6000/rs6000-builtins.def
b/gcc/config/rs6000/rs6000-builtins.def
index 47830b7dcb0..75c33aa9ffc 100644
--- a/gcc/config/rs6000/rs6000-builtins.def
+++ b/gcc/config/rs6000/rs6000-builtins.def
@@ -1263,19 +1263,6 @@
const signed long long __builtin_vec_ext_v2di (vsll, signed int);
VEC_EXT_V2DI nothing {extract}
-;; VEC_SET_V1TI, VEC_SET_V2DF and VEC_SET_V2DI are used in
-;; resolve_vec_insert(), rs6000-c.cc
-;; TODO: Remove VEC_SET_V1TI, VEC_SET_V2DF and VEC_SET_V2DI once the uses
-;; in resolve_vec_insert are replaced by the equivalent gimple statements.
- const vsq __builtin_vec_set_v1ti (vsq, signed __int128, const int<0,0>);
- VEC_SET_V1TI nothing {set}
-
- const vd __builtin_vec_set_v2df (vd, double, const int<1>);
- VEC_SET_V2DF nothing {set}
-
- const vsll __builtin_vec_set_v2di (vsll, signed long long, const int<1>);
- VEC_SET_V2DI nothing {set}
-
const vsc __builtin_vsx_cmpge_16qi (vsc, vsc);
CMPGE_16QI vector_nltv16qi {}
diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc
index 68519e1397f..04882c396bf 100644
--- a/gcc/config/rs6000/rs6000-c.cc
+++ b/gcc/config/rs6000/rs6000-c.cc
@@ -1524,46 +1524,6 @@ resolve_vec_insert (resolution *res, vec<tree,
va_gc> *arglist,
return error_mark_node;
}
- /* If we can use the VSX xxpermdi instruction, use that for insert. */
- machine_mode mode = TYPE_MODE (arg1_type);
-
- if ((mode == V2DFmode || mode == V2DImode)
- && VECTOR_UNIT_VSX_P (mode)
- && TREE_CODE (arg2) == INTEGER_CST)
- {
- wide_int selector = wi::to_wide (arg2);
- selector = wi::umod_trunc (selector, 2);
- arg2 = wide_int_to_tree (TREE_TYPE (arg2), selector);
-
- tree call = NULL_TREE;
- if (mode == V2DFmode)
- call = rs6000_builtin_decls[RS6000_BIF_VEC_SET_V2DF];
- else if (mode == V2DImode)
- call = rs6000_builtin_decls[RS6000_BIF_VEC_SET_V2DI];
-
- /* Note, __builtin_vec_insert_<xxx> has vector and scalar types
- reversed. */
- if (call)
- {
- *res = resolved;
- return build_call_expr (call, 3, arg1, arg0, arg2);
- }
- }
-
- else if (mode == V1TImode
- && VECTOR_UNIT_VSX_P (mode)
- && TREE_CODE (arg2) == INTEGER_CST)
- {
- tree call = rs6000_builtin_decls[RS6000_BIF_VEC_SET_V1TI];
- wide_int selector = wi::zero(32);
- arg2 = wide_int_to_tree (TREE_TYPE (arg2), selector);
-
- /* Note, __builtin_vec_insert_<xxx> has vector and scalar types
- reversed. */
- *res = resolved;
- return build_call_expr (call, 3, arg1, arg0, arg2);
- }
-
/* Build *(((arg1_inner_type*) & (vector type){arg1}) + arg2) = arg0
with
VIEW_CONVERT_EXPR. i.e.:
D.3192 = v1;
--
2.45.2