summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralalaw01 <alalaw01@138bc75d-0d04-0410-961f-82ee72b054a4>2015-07-27 15:55:23 +0000
committeralalaw01 <alalaw01@138bc75d-0d04-0410-961f-82ee72b054a4>2015-07-27 15:55:23 +0000
commit732205bce05a722d37bb1b4030649781e09ec629 (patch)
tree24473b9cc956cab63f0782b09225caaa0a079651
parent505e1f91ad904336a6cbbc8a2da209b71d0e2d1c (diff)
downloadgcc-732205bce05a722d37bb1b4030649781e09ec629.tar.gz
[ARM] PR/63870 Add a __builtin_lane_check
* config/arm/arm-builtins.c (enum arm_builtins): Add ARM_BUILTIN_NEON_BASE and ARM_BUILTIN_NEON_LANE_CHECK. (ARM_BUILTIN_NEON_BASE): Rename macro to.... (ARM_BUILTIN_NEON_PATTERN_START): ...this. (arm_init_neon_builtins): Register __builtin_arm_lane_check. (arm_expand_neon_builtin): Handle ARM_BUILTIN_NEON_LANE_CHECK. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226252 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/arm/arm-builtins.c38
2 files changed, 44 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 82e139de0c2..b7fca447d0e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,6 +1,16 @@
2015-07-27 Alan Lawrence <alan.lawrence@arm.com>
PR/63870
+ * config/arm/arm-builtins.c (enum arm_builtins):
+ Add ARM_BUILTIN_NEON_BASE and ARM_BUILTIN_NEON_LANE_CHECK.
+ (ARM_BUILTIN_NEON_BASE): Rename macro to....
+ (ARM_BUILTIN_NEON_PATTERN_START): ...this.
+ (arm_init_neon_builtins): Register __builtin_arm_lane_check.
+ (arm_expand_neon_builtin): Handle ARM_BUILTIN_NEON_LANE_CHECK.
+
+2015-07-27 Alan Lawrence <alan.lawrence@arm.com>
+
+ PR/63870
* config/arm/arm-builtins.c (enum arm_type_qualifiers):
Add qualifier_lane_index.
(arm_binop_imm_qualifiers, BINOP_IMM_QUALIFIERS): New.
diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c
index 7f711a84c75..030d8d19441 100644
--- a/gcc/config/arm/arm-builtins.c
+++ b/gcc/config/arm/arm-builtins.c
@@ -532,12 +532,16 @@ enum arm_builtins
#undef CRYPTO2
#undef CRYPTO3
+ ARM_BUILTIN_NEON_BASE,
+ ARM_BUILTIN_NEON_LANE_CHECK = ARM_BUILTIN_NEON_BASE,
+
#include "arm_neon_builtins.def"
ARM_BUILTIN_MAX
};
-#define ARM_BUILTIN_NEON_BASE (ARM_BUILTIN_MAX - ARRAY_SIZE (neon_builtin_data))
+#define ARM_BUILTIN_NEON_PATTERN_START \
+ (ARM_BUILTIN_MAX - ARRAY_SIZE (neon_builtin_data))
#undef CF
#undef VAR1
@@ -896,7 +900,7 @@ arm_init_simd_builtin_scalar_types (void)
static void
arm_init_neon_builtins (void)
{
- unsigned int i, fcode = ARM_BUILTIN_NEON_BASE;
+ unsigned int i, fcode = ARM_BUILTIN_NEON_PATTERN_START;
arm_init_simd_builtin_types ();
@@ -906,6 +910,15 @@ arm_init_neon_builtins (void)
system. */
arm_init_simd_builtin_scalar_types ();
+ tree lane_check_fpr = build_function_type_list (void_type_node,
+ intSI_type_node,
+ intSI_type_node,
+ NULL);
+ arm_builtin_decls[ARM_BUILTIN_NEON_LANE_CHECK] =
+ add_builtin_function ("__builtin_arm_lane_check", lane_check_fpr,
+ ARM_BUILTIN_NEON_LANE_CHECK, BUILT_IN_MD,
+ NULL, NULL_TREE);
+
for (i = 0; i < ARRAY_SIZE (neon_builtin_data); i++, fcode++)
{
bool print_type_signature_p = false;
@@ -2169,14 +2182,31 @@ arm_expand_neon_args (rtx target, machine_mode map_mode, int fcode,
return target;
}
-/* Expand a Neon builtin. These are "special" because they don't have symbolic
+/* Expand a Neon builtin, i.e. those registered only if TARGET_NEON holds.
+ Most of these are "special" because they don't have symbolic
constants defined per-instruction or per instruction-variant. Instead, the
required info is looked up in the table neon_builtin_data. */
static rtx
arm_expand_neon_builtin (int fcode, tree exp, rtx target)
{
+ if (fcode == ARM_BUILTIN_NEON_LANE_CHECK)
+ {
+ /* Builtin is only to check bounds of the lane passed to some intrinsics
+ that are implemented with gcc vector extensions in arm_neon.h. */
+
+ tree nlanes = CALL_EXPR_ARG (exp, 0);
+ gcc_assert (TREE_CODE (nlanes) == INTEGER_CST);
+ rtx lane_idx = expand_normal (CALL_EXPR_ARG (exp, 1));
+ if (CONST_INT_P (lane_idx))
+ neon_lane_bounds (lane_idx, 0, TREE_INT_CST_LOW (nlanes), exp);
+ else
+ error ("%Klane index must be a constant immediate", exp);
+ /* Don't generate any RTL. */
+ return const0_rtx;
+ }
+
neon_builtin_datum *d =
- &neon_builtin_data[fcode - ARM_BUILTIN_NEON_BASE];
+ &neon_builtin_data[fcode - ARM_BUILTIN_NEON_PATTERN_START];
enum insn_code icode = d->code;
builtin_arg args[SIMD_MAX_BUILTIN_ARGS];
int num_args = insn_data[d->code].n_operands;