From patchwork Tue Jul 7 12:34:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Lawrence X-Patchwork-Id: 492167 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D1B9A1402C2 for ; Tue, 7 Jul 2015 22:34:35 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=TrnckEoG; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:in-reply-to :content-type; q=dns; s=default; b=sXidIdsZFqDvgtXTcXolBWFvG5TM8 WvyFpDiR0AE/012DvPTz6tzphgbiMKinwOD3ChFmAsnVEAH2loOW5DZJPjajC/PM HUtuUQ2Vr1nJMY6Qs4X85tPd7WqniOZauRJeWKMuwusrLIwJ9MqJh2FHp/6VNRd2 a1bYCtGoFecrWo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:in-reply-to :content-type; s=default; bh=jqQkHzYAToG2ORDe9wB0fwvAqr4=; b=Trn ckEoGoEPbjfgCnRZ4e4UILws5p5N4wFOAwsKlYXxf6k6fF2y38+oI0S8S9SlcxrO Y0fPbDsC3SbQlf38JABz90obEn9NbvUVLg4lBnL1q83Io2kLQ3iqxXaAClIWPtCO PR9sJlbKF8lSLAzO8wHIJacaGtWE1QEqHCmgOj/4= Received: (qmail 71165 invoked by alias); 7 Jul 2015 12:34:29 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 70256 invoked by uid 89); 7 Jul 2015 12:34:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 07 Jul 2015 12:34:27 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-1-yhToPBdJTr6LIR_z2berbQ-1; Tue, 07 Jul 2015 13:34:23 +0100 Received: from [10.2.207.65] ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 7 Jul 2015 13:34:22 +0100 Message-ID: <559BC74E.6090804@arm.com> Date: Tue, 07 Jul 2015 13:34:22 +0100 From: Alan Lawrence User-Agent: Thunderbird 2.0.0.24 (X11/20101213) MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" Subject: [PATCH 2/16][ARM] PR/63870 Add __builtin_arm_lane_check. In-Reply-To: <559BC6EC.3000907@arm.com> X-MC-Unique: yhToPBdJTr6LIR_z2berbQ-1 X-IsSubscribed: yes As per https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01334.html commit 1bb1b208a2c8c8b1ee1186c6128a498583fd64fe Author: Alan Lawrence Date: Mon Dec 8 18:36:30 2014 +0000 Add __builtin_arm_lane_check diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c index 7f5bf87..89b1b0c 100644 --- a/gcc/config/arm/arm-builtins.c +++ b/gcc/config/arm/arm-builtins.c @@ -534,12 +534,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 @@ -898,7 +902,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 (); @@ -908,6 +912,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; @@ -2171,14 +2184,28 @@ 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) + { + 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;