From patchwork Fri Nov 3 16:18:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 117939 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3652837qgn; Fri, 3 Nov 2017 09:18:28 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TWJY3XaHNkC3j8Nd26Kj5fHxLjc4VbWNhBd9CaWVq2zgm/2zPx3UeDZjxK63g9vBq8A6vj X-Received: by 10.84.245.15 with SMTP id i15mr7355021pll.437.1509725908099; Fri, 03 Nov 2017 09:18:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509725908; cv=none; d=google.com; s=arc-20160816; b=UL5zyeE6DERPFnd/SRc1awVK5rdRNi8IVbk0UAbwlGQaba5WmjbrtQeOa6l03TEFBL dfFq5ma45EEX02jw2s2o5NjgEY2Y5lPuZ3GKJGyAHRcGxFv9Ug2WMmYVH2Wez30BmTgs 0RxBCJhK9TufdLl3eKivxT9M1nqEDDa540yqDLz8h9lV7SDLwZsqOlL2lDYf0TdtofzS S6aXGtSF8ecCp3Dqb1IZRXyrrh8K7EApKjT1rZn1zRJP1t0qLiAUqg99tX4h1GhiegYB V8sa9KHnegY4aktYM3ngg/6d8sNReey0eHHt/piDRGGqBVTxUH1yA/ZHvkE1Vn7GxsQ+ r5fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:mail-followup-to:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=WtAjjH+zdTeNlcsk4Yo1NJzWPRE2gO0tERROkcxfHHw=; b=kndKJgzW5uHk1GY3MeQfKh+jwvaZt7uDT3Y7GPKTSEeq754iClooHvBFyfj2QdmP44 mniyneeMU2TjzxsvJG0WttKyxdradLn0ZE0Jb0dzF+hcABQNWCd8mDUdzobISdORIO6z QS1+soGt/nTEBwO7GZPOxgQ2uWN4uXqU06/RaPlPuhydbjf6O8u/elgp8NfBxdJR09/m KjN3tU/oYvyvtGLi4R2YDX9sB6z7EwaI7IFqvgCtEiFakRbo1B8EVmYTMT1jrNK6DE3a 0WIMTgXOF52gCXcnlKZtbZebyjsMHi5njr31Bm7b/rvZMOnMWCAQ6MuwC8Wo2Tm2kBDV YwAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ySOwyHGf; spf=pass (google.com: domain of gcc-patches-return-465873-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-465873-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id p24si5470382plr.533.2017.11.03.09.18.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Nov 2017 09:18:28 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-465873-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 header.s=default header.b=ySOwyHGf; spf=pass (google.com: domain of gcc-patches-return-465873-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-465873-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.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:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=ETzvBVgyPTMUso/syFrnw6HqhThE9 efhy90S4ir/2H0f9CfJ5TO453XuB/unD8B3DzhBovn6XZHe3p+Ic0PR7n/EDhLEc P8kVVnZpfEKb/i6KnqRRasmvU2ma5bYGyNAW2mmMvzh9MUavXKe8WZiRAy3PZ5Nu eCMBproUc+ESBg= 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:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=7pqhfrjyz+7ToL4RNzzhH9PhiBI=; b=ySO wyHGfAwNJBku0ZUwM0T65qRSsRg9aW9Ea0fDy9qFxcMUDQAJxhlMVxK4FIe6JzOD kklw2Yg9Ew/oMKNiUiq6pv0oEaYqVCzwS1CEk2WXQUaXi2opYMNyBPBIpehUDr0k QmYPDasCf3pXzWOoSLBCxQLrmF943FnjVFBFXqqI= Received: (qmail 33437 invoked by alias); 3 Nov 2017 16:18:16 -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 33426 invoked by uid 89); 3 Nov 2017 16:18:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-15.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:check_a X-HELO: mail-wr0-f173.google.com Received: from mail-wr0-f173.google.com (HELO mail-wr0-f173.google.com) (209.85.128.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 03 Nov 2017 16:18:14 +0000 Received: by mail-wr0-f173.google.com with SMTP id z55so2981173wrz.1 for ; Fri, 03 Nov 2017 09:18:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=WtAjjH+zdTeNlcsk4Yo1NJzWPRE2gO0tERROkcxfHHw=; b=E7dOgkfYfoA6J4fE1r/BbA8XutHKHq3a2ZXUCWhZZgOoaoXbFlk7ABLAtxcIWDqZXl +19DWThZ4igbwTqsJyiMeZPJNL6+gS6qX6moVn1zNIK2HEylVEwdHJAvzQ16QNSQqak/ 2S9yrdmI28SSedojEkJhCNQ1azePTJEzb/HNjEy0dsdvTI5OG2BgE7eetwxcp6s2oyE1 fjJbk+yJ7vfazS7T9Qra/chaHAcIeL8p4xCa6KYBpms74allJILxEkQZ95H81ocF7qbo d8McL5Z/GvscePLzmfB0FxkHKBBIuALLOycFRxEh/LTO7W7YzC8wqN6pk5K70EAueS1M fuhA== X-Gm-Message-State: AMCzsaV382uK+SzsegjFu05j18XoYrD8h0EGAcZd6qYxKgIpRt+Qzufr j1LHb8EHqJarzS/UlqZwC1WoGw0Phhw= X-Received: by 10.223.147.39 with SMTP id 36mr5953378wro.175.1509725892059; Fri, 03 Nov 2017 09:18:12 -0700 (PDT) Received: from localhost (188.29.164.162.threembb.co.uk. [188.29.164.162]) by smtp.gmail.com with ESMTPSA id i16sm5717604wrf.19.2017.11.03.09.18.11 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Nov 2017 09:18:11 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [3/10] Add available_vector_sizes to target-supports.exp References: <87inerqqyz.fsf@linaro.org> Date: Fri, 03 Nov 2017 16:18:09 +0000 In-Reply-To: <87inerqqyz.fsf@linaro.org> (Richard Sandiford's message of "Fri, 03 Nov 2017 16:14:44 +0000") Message-ID: <874lqbqqta.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch adds a routine that lists the available vector sizes for a target and uses it for some existing target conditions. Later patches add more uses. The cases are taken from multiple_sizes. 2017-11-03 Richard Sandiford Alan Hayward David Sherwood gcc/testsuite/ * lib/target-supports.exp (available_vector_sizes): New proc. (check_effective_target_vect_multiple_sizes): Use it. (check_effective_target_vect64): Likewise. (check_effective_target_vect_sizes_32B_16B): Likewise. Index: gcc/testsuite/lib/target-supports.exp =================================================================== --- gcc/testsuite/lib/target-supports.exp 2017-11-03 12:16:58.605777011 +0000 +++ gcc/testsuite/lib/target-supports.exp 2017-11-03 16:06:12.625838683 +0000 @@ -6581,46 +6581,38 @@ foreach N {2 3 4 8} { }] } -# Return 1 if the target supports multiple vector sizes +# Return the list of vector sizes (in bits) that each target supports. +# A vector length of "0" indicates variable-length vectors. -proc check_effective_target_vect_multiple_sizes { } { - global et_vect_multiple_sizes_saved - global et_index - - set et_vect_multiple_sizes_saved($et_index) 0 - if { [istarget aarch64*-*-*] - || [is-effective-target arm_neon] - || (([istarget i?86-*-*] || [istarget x86_64-*-*]) - && ([check_avx_available] && ![check_prefer_avx128])) } { - set et_vect_multiple_sizes_saved($et_index) 1 +proc available_vector_sizes { } { + set result {} + if { [istarget aarch64*-*-*] } { + lappend result 128 64 + } elseif { [istarget arm*-*-*] + && [check_effective_target_arm_neon_ok] } { + lappend result 128 64 + } elseif { (([istarget i?86-*-*] || [istarget x86_64-*-*]) + && ([check_avx_available] && ![check_prefer_avx128])) } { + lappend result 256 128 + } elseif { [istarget sparc*-*-*] } { + lappend result 64 + } else { + # The traditional default asumption. + lappend result 128 } + return $result +} + +# Return 1 if the target supports multiple vector sizes - verbose "check_effective_target_vect_multiple_sizes:\ - returning $et_vect_multiple_sizes_saved($et_index)" 2 - return $et_vect_multiple_sizes_saved($et_index) +proc check_effective_target_vect_multiple_sizes { } { + return [expr { [llength [available_vector_sizes]] > 1 }] } # Return 1 if the target supports vectors of 64 bits. proc check_effective_target_vect64 { } { - global et_vect64_saved - global et_index - - if [info exists et_vect64_saved($et_index)] { - verbose "check_effective_target_vect64: using cached result" 2 - } else { - set et_vect64_saved($et_index) 0 - if { ([is-effective-target arm_neon] - && [check_effective_target_arm_little_endian]) - || [istarget aarch64*-*-*] - || [istarget sparc*-*-*] } { - set et_vect64_saved($et_index) 1 - } - } - - verbose "check_effective_target_vect64:\ - returning $et_vect64_saved($et_index)" 2 - return $et_vect64_saved($et_index) + return [expr { [lsearch -exact [available_vector_sizes] 64] >= 0 }] } # Return 1 if the target supports vector copysignf calls. @@ -7747,11 +7739,7 @@ proc check_avx_available { } { # Return true if 32- and 16-bytes vectors are available. proc check_effective_target_vect_sizes_32B_16B { } { - if { [check_avx_available] && ![check_prefer_avx128] } { - return 1; - } else { - return 0; - } + return [expr { [available_vector_sizes] == [list 256 128] }] } # Return true if 16- and 8-bytes vectors are available.