From patchwork Wed Oct 19 09:36:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 78207 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp151616qge; Wed, 19 Oct 2016 02:37:05 -0700 (PDT) X-Received: by 10.98.90.130 with SMTP id o124mr9448555pfb.53.1476869825168; Wed, 19 Oct 2016 02:37:05 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id g22si19681814pfd.97.2016.10.19.02.37.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Oct 2016 02:37:05 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-438986-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-438986-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-438986-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type; q=dns; s=default; b=s8wolv8zfSyY+xmyFJKpRFHfkQOcJuMYeHOdtmEB76/IwzrctD kQ33aJELozl63HumjtxwuAaZ8Bcql604thJJGE0bFWHSRdo8I2ePiUZWA44cWYRd 4b2Xx63dyfxNMohGKTRYr4DqLgl2K7VUCUoQ+P/Pjulf8C2cR/5D64BI4= 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:from :to:cc:subject:date:message-id:mime-version:content-type; s= default; bh=NBIMaGqj7m859gJilrywGg+/1ic=; b=OEHn79vBpNMflAwE8LmE TscA6rJ7HKk0kB3Qfl4Zt6hV3+f913FHo9Q3i7t0FA+ApwjeWQxeEuyPVylv24OD Zo/AEEkAR4aCrubtJgVrloQ+/JEIb6z0uSRQUHeKZwigV30VUn57RFaF1ib/60sl ZGluPk1cntfHgBE5ltwiRJg= Received: (qmail 58788 invoked by alias); 19 Oct 2016 09:36:47 -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 58750 invoked by uid 89); 19 Oct 2016 09:36:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, KAM_LOTSOFHASH, SPF_PASS autolearn=no version=3.3.2 spammy=H*r:Wed, 14712, 147, 12, expander 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; Wed, 19 Oct 2016 09:36:36 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01lp0242.outbound.protection.outlook.com [213.199.154.242]) (Using TLS) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-33-iDSTkazmM2CX6sFwBiVSuA-1; Wed, 19 Oct 2016 10:36:31 +0100 Received: from VI1PR0801MB2031.eurprd08.prod.outlook.com (10.173.74.140) by AM4PR0802MB2340.eurprd08.prod.outlook.com (10.172.218.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.12; Wed, 19 Oct 2016 09:36:30 +0000 Received: from VI1PR0801MB2031.eurprd08.prod.outlook.com ([10.173.74.140]) by VI1PR0801MB2031.eurprd08.prod.outlook.com ([10.173.74.140]) with mapi id 15.01.0659.025; Wed, 19 Oct 2016 09:36:29 +0000 From: Tamar Christina To: GCC Patches , Kyrylo Tkachov , Christophe Lyon CC: nd Subject: [PATCH v2][AArch32][NEON] Implementing vmaxnmQ_ST and vminnmQ_ST intrinsincs. Date: Wed, 19 Oct 2016 09:36:29 +0000 Message-ID: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-office365-filtering-correlation-id: 3064deba-6b71-4fee-dd10-08d3f803678c x-microsoft-exchange-diagnostics: 1; AM4PR0802MB2340; 7:X7vSDaKxMDScEfvw89HdnZQz9BTBE8PuKTbIUMjum2VLo29hMrOV72lywU4AxcJkEg+1sHxKqU3NKTBrsns53TT7IhOM/quEF4eqikZ3KtoxprwhOFI7kYR9Y7E6YL1EmMWNvGa2k2qqcBV/neA8NKB5mBwaJdm6ovsF6esIICzGB+FwKpllObmm/Z+EvQBoTSQg6TB1slhIpIdM1WpRIfySihfo2kKTQ9rbrj1DTN+AIWyKnS1mDAWa30OvIFFjZA/ikq/drakJPKJ57E2koD9vdDnqa7mNAaEsiCGkUH7idUk6/xni6/R0F/45lwcwaesXvmpWADTpidtAKDDH6ORf9vT1Ljd3rLiLavDs0SQ= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM4PR0802MB2340; nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917)(22074186197030)(183786458502308); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(102415321)(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:AM4PR0802MB2340; BCL:0; PCL:0; RULEID:; SRVR:AM4PR0802MB2340; x-forefront-prvs: 0100732B76 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(53754006)(189002)(199003)(377424004)(86362001)(81166006)(305945005)(586003)(33656002)(68736007)(81156014)(8936002)(101416001)(15975445007)(106356001)(9686002)(102836003)(99936001)(4001150100001)(3846002)(7846002)(54356999)(6116002)(66066001)(105586002)(229853001)(74316002)(10400500002)(19580395003)(2900100001)(92566002)(77096005)(87936001)(3660700001)(7696004)(106116001)(19580405001)(50986999)(5001770100001)(97736004)(7736002)(189998001)(3280700002)(4326007)(5660300001)(76576001)(5002640100001)(8676002)(122556002)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR0802MB2340; H:VI1PR0801MB2031.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Oct 2016 09:36:29.2945 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0802MB2340 X-MC-Unique: iDSTkazmM2CX6sFwBiVSuA-1 X-IsSubscribed: yes Hi All, This patch implements the vmaxnmQ_ST and vminnmQ_ST intrinsics. The current builtin registration code is deficient since it can't access standard pattern names, to which vmaxnmQ_ST and vminnmQ_ST map directly. Thus, to enable the vectoriser to have access to these intrinsics, we implement them using builtin functions, which we expand to the proper standard pattern using a define_expand. This patch also implements the __ARM_FEATURE_NUMERIC_MAXMIN macro, which is defined when __ARM_ARCH >= 8, and which enables the intrinsics. Regression tested on arm-none-eabi and no regressions. This patch is a rework of a previous patch: https://gcc.gnu.org/ml/gcc-patches/2015-12/msg01971.html OK for trunk? Thanks, Tamar --- gcc/ 2016-10-19 Bilyan Borisov Tamar Christina * config/arm/arm-c.c (arm_cpu_builtins): New macro definition. * config/arm/arm_neon.h (vmaxnm_f32): New intrinsinc. (vmaxnmq_f32): Likewise. (vminnm_f32): Likewise. (vminnmq_f32): Likewise. * config/arm/arm_neon_builtins.def (vmaxnm): New builtin. (vminnm): Likewise. * config/arm/neon.md (neon_, VCVTF): New expander. gcc/testsuite/ 2016-10-19 Bilyan Borisov * gcc.target/arm/simd/vmaxnm_f32_1.c: New. * gcc.target/arm/simd/vmaxnmq_f32_1.c: Likewise. * gcc.target/arm/simd/vminnm_f32_1.c: Likewise. * gcc.target/arm/simd/vminnmq_f32_1.c: Likewise. diff --git a/gcc/config/arm/arm-c.c b/gcc/config/arm/arm-c.c index 72837001d1011e366233236a6ba3d1e5775583b1..dcb883d750506a02257e6e2e49880f2d1b9888fa 100644 --- a/gcc/config/arm/arm-c.c +++ b/gcc/config/arm/arm-c.c @@ -86,6 +86,9 @@ arm_cpu_builtins (struct cpp_reader* pfile) ((TARGET_ARM_ARCH >= 5 && !TARGET_THUMB) || TARGET_ARM_ARCH_ISA_THUMB >=2)); + def_or_undef_macro (pfile, "__ARM_FEATURE_NUMERIC_MAXMIN", + TARGET_ARM_ARCH >= 8 && TARGET_NEON && TARGET_FPU_ARMV8); + def_or_undef_macro (pfile, "__ARM_FEATURE_SIMD32", TARGET_INT_SIMD); builtin_define_with_int_value ("__ARM_SIZEOF_MINIMAL_ENUM", diff --git a/gcc/config/arm/arm_neon.h b/gcc/config/arm/arm_neon.h index 54bbc7dd83cf979b6fad7724ba1d4b327b311f5c..3898ff7302dc3f21e6b50a8a7b835033c1ae2021 100644 --- a/gcc/config/arm/arm_neon.h +++ b/gcc/config/arm/arm_neon.h @@ -2956,6 +2956,34 @@ vmaxq_f32 (float32x4_t __a, float32x4_t __b) return (float32x4_t)__builtin_neon_vmaxfv4sf (__a, __b); } +#pragma GCC push_options +#pragma GCC target ("fpu=neon-fp-armv8") +__extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) +vmaxnm_f32 (float32x2_t a, float32x2_t b) +{ + return (float32x2_t)__builtin_neon_vmaxnmv2sf (a, b); +} + +__extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) +vmaxnmq_f32 (float32x4_t a, float32x4_t b) +{ + return (float32x4_t)__builtin_neon_vmaxnmv4sf (a, b); +} + +__extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) +vminnm_f32 (float32x2_t a, float32x2_t b) +{ + return (float32x2_t)__builtin_neon_vminnmv2sf (a, b); +} + +__extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) +vminnmq_f32 (float32x4_t a, float32x4_t b) +{ + return (float32x4_t)__builtin_neon_vminnmv4sf (a, b); +} +#pragma GCC pop_options + + __extension__ static __inline uint8x16_t __attribute__ ((__always_inline__)) vmaxq_u8 (uint8x16_t __a, uint8x16_t __b) { diff --git a/gcc/config/arm/arm_neon_builtins.def b/gcc/config/arm/arm_neon_builtins.def index b29aa91a64ecb85dfb5eb9661ed67d4fa326062f..58b10207c1f5c0380cb01fdb4a92a3f0b4dec591 100644 --- a/gcc/config/arm/arm_neon_builtins.def +++ b/gcc/config/arm/arm_neon_builtins.def @@ -147,12 +147,12 @@ VAR6 (BINOP, vmaxs, v8qi, v4hi, v2si, v16qi, v8hi, v4si) VAR6 (BINOP, vmaxu, v8qi, v4hi, v2si, v16qi, v8hi, v4si) VAR2 (BINOP, vmaxf, v2sf, v4sf) VAR2 (BINOP, vmaxf, v8hf, v4hf) -VAR2 (BINOP, vmaxnm, v4hf, v8hf) +VAR4 (BINOP, vmaxnm, v2sf, v4sf, v4hf, v8hf) VAR6 (BINOP, vmins, v8qi, v4hi, v2si, v16qi, v8hi, v4si) VAR6 (BINOP, vminu, v8qi, v4hi, v2si, v16qi, v8hi, v4si) VAR2 (BINOP, vminf, v2sf, v4sf) VAR2 (BINOP, vminf, v4hf, v8hf) -VAR2 (BINOP, vminnm, v8hf, v4hf) +VAR4 (BINOP, vminnm, v2sf, v4sf, v8hf, v4hf) VAR3 (BINOP, vpmaxs, v8qi, v4hi, v2si) VAR3 (BINOP, vpmaxu, v8qi, v4hi, v2si) diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md index 05323334ffd81aeff33ee407b96c788d123b3fe3..3ae4f6a3bf26032f4c34d83ff79e27b30d4000de 100644 --- a/gcc/config/arm/neon.md +++ b/gcc/config/arm/neon.md @@ -2841,6 +2841,18 @@ [(set_attr "type" "neon_fp_minmax_s")] ) +;; Expander for vnm intrinsics. +(define_expand "neon_" + [(unspec:VCVTF [(match_operand:VCVTF 0 "s_register_operand" "") + (match_operand:VCVTF 1 "s_register_operand" "") + (match_operand:VCVTF 2 "s_register_operand" "")] + VMAXMINFNM)] + "TARGET_NEON && TARGET_FPU_ARMV8" +{ + emit_insn (gen_3 (operands[0], operands[1], operands[2])); + DONE; +}) + ;; Vector forms for the IEEE-754 fmax()/fmin() functions (define_insn "3" [(set (match_operand:VCVTF 0 "s_register_operand" "=w")