From patchwork Tue Dec 18 13:33:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrylo Tkachov X-Patchwork-Id: 207115 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]) by ozlabs.org (Postfix) with SMTP id 56FBD2C0089 for ; Wed, 19 Dec 2012 00:36:14 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1356442574; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=2ijxzbVMMAwibRm26tqu gwPLjDs=; b=krnqBx3vKDJLMfPGB8BLM5I9tl8mkxRNVbThdXs3G7uIjnxRT/+K 4ufovLgoDUinDEdeRuNfbYpq24l5DLR5QrUXaCMmCVlmspsOZNSzdxbzmjsR0Xou F4Y8YEbS472bNz6KgqTqhtqjFyg139cc3lNcZvy4EwVNL67pKN6i73E= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:From:To:Cc:Subject:Date:Message-ID:MIME-Version:X-MC-Unique:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=uTd7AtE38wMkrX6UpixvcXxsu3cCFMxDp90pXsxdZNBCS4/aja3ZubSEwRKFxF 1VMnWMAtchKBVOD0ilgkZc1/oLIAyC47gQS3gE3WwQ0FqSfb5W334nrTSXVMQ//z t4BE3bS6eUzpni2eETzne46SUICLsYJ4fdhxa0V8ljjRE=; Received: (qmail 4639 invoked by alias); 18 Dec 2012 13:34:25 -0000 Received: (qmail 4539 invoked by uid 22791); 18 Dec 2012 13:34:24 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, MSGID_MULTIPLE_AT, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 18 Dec 2012 13:33:49 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Tue, 18 Dec 2012 13:33:47 +0000 Received: from e106372vm ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Tue, 18 Dec 2012 13:33:46 +0000 From: "Kyrylo Tkachov" To: Cc: "Ramana Radhakrishnan" , "Richard Earnshaw" Subject: [PATCH][ARM][3/3] Add vectorization support for rounding functions Date: Tue, 18 Dec 2012 13:33:42 -0000 Message-ID: <002a01cddd24$4c641140$e52c33c0$@tkachov@arm.com> MIME-Version: 1.0 X-MC-Unique: 112121813334710801 X-IsSubscribed: yes 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 Hi all, This patch adds arm and v8 NEON to the effective target checks that are used in the rounding functions vectorisation tests. A new effective target check for NEON hardware is added This check is used to determine whether to do runtime tests or just compilation. With these changes the following tests now PASS on arm instead of being UNSUPPORTED: * gcc.dg/vect/vect-rounding-btrunc.c * gcc.dg/vect/vect-rounding-ceilf.c * gcc.dg/vect/vect-rounding-floorf.c * gcc.dg/vect/vect-rounding-roundf.c Tested on arm-none-eabi with model and softfp float ABI. Ok for trunk? Thanks, Kyrill gcc/testuite/ChangeLog 2012-12-18 Kyrylo Tkachov * lib/target-supports.exp (check_effective_target_arm_v8_neon_hw): New procedure. (check_effective_target_vect_call_btruncf): Add check for arm and ARMv8 NEON. (check_effective_target_vect_call_ceilf): Likewise. (check_effective_target_vect_call_floorf): Likewise. (check_effective_target_vect_call_roundf): Likewise. (check_vect_support_and_set_flags): Handle ARMv8 NEON effective target. diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index c3151ac..6789428 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -2469,6 +2469,24 @@ proc check_effective_target_arm_neonv2_hw { } { } [add_options_for_arm_neonv2 ""]] } +# Return 1 if the target supports executing ARMv8 NEON instructions, 0 +# otherwise. + +proc check_effective_target_arm_v8_neon_hw { } { + return [check_runtime arm_v8_neon_hw_available { + #include "arm_neon.h" + int + main (void) + { + float32x2_t a; + asm ("vrinta.f32 %P0, %P1" + : "=w" (a) + : "0" (a)); + return 0; + } + } [add_options_for_arm_v8_neon ""]] +} + # Return 1 if this is a ARM target with NEON enabled. proc check_effective_target_arm_neon { } { @@ -3975,7 +3993,9 @@ proc check_effective_target_vect_call_btruncf { } { verbose "check_effective_target_vect_call_btruncf: using cached result" 2 } else { set et_vect_call_btruncf_saved 0 - if { [istarget aarch64*-*-*] } { + if { [istarget aarch64*-*-*] + || ([istarget arm*-*-*] + && [check_effective_target_arm_v8_neon_ok]) } { set et_vect_call_btruncf_saved 1 } } @@ -4011,7 +4031,9 @@ proc check_effective_target_vect_call_ceilf { } { verbose "check_effective_target_vect_call_ceilf: using cached result" 2 } else { set et_vect_call_ceilf_saved 0 - if { [istarget aarch64*-*-*] } { + if { [istarget aarch64*-*-*] + || ([istarget arm*-*-*] + && [check_effective_target_arm_v8_neon_ok]) } { set et_vect_call_ceilf_saved 1 } } @@ -4047,7 +4069,9 @@ proc check_effective_target_vect_call_floorf { } { verbose "check_effective_target_vect_call_floorf: using cached result" 2 } else { set et_vect_call_floorf_saved 0 - if { [istarget aarch64*-*-*] } { + if { [istarget aarch64*-*-*] + || ([istarget arm*-*-*] + && [check_effective_target_arm_v8_neon_ok]) } { set et_vect_call_floorf_saved 1 } } @@ -4155,7 +4179,9 @@ proc check_effective_target_vect_call_roundf { } { verbose "check_effective_target_vect_call_roundf: using cached result" 2 } else { set et_vect_call_roundf_saved 0 - if { [istarget aarch64*-*-*] } { + if { [istarget aarch64*-*-*] + || ([istarget arm*-*-*] + && [check_effective_target_arm_v8_neon_ok]) } { set et_vect_call_roundf_saved 1 } } @@ -5057,6 +5083,14 @@ proc check_vect_support_and_set_flags { } { } } elseif [istarget ia64-*-*] { set dg-do-what-default run + } elseif [is-effective-target arm_v8_neon_ok] { + eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_v8_neon ""] + lappend DEFAULT_VECTCFLAGS "-ffast-math" + if [is-effective-target arm_v8_neon_hw] { + set dg-do-what-default run + } else { + set dg-do-what-default compile + } } elseif [is-effective-target arm_neon_ok] { eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""] # NEON does not support denormals, so is not used for vectorization by