From patchwork Mon Aug 17 21:59:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 508116 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 7CC331402A0 for ; Tue, 18 Aug 2015 08:00:38 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=mywo++ZV; 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:from :to:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=yDlM/TBClxbVupA15AFaaA7Us9IJNl2hIdMql5W65jOGhdokLi9zR 0sU4SqAhsn9+s2nU2hJD3U9qN90OwdlxckyGKnB3PSZqR31BuTHSBQvmXzVGEdf8 HDofJf4xDxV5t3+5B2d6fkyeZj/QALyYv1gNM/kIBcRIqFfY41iZ8w= 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:in-reply-to:references; s= default; bh=JNnK51wjtzc3fJbrXYrSzHcAnJ4=; b=mywo++ZVP7OG2obymwlH s6SBzZqKuSmFQO0ektgFeHmxdpHAmy+LF40dfXtkaKcVyUyijyb8Gn7pmRY1cgOq 1ph8IzXtzjNXXejHWl74Lv8YpzEqSkO8C8cNlnYcXZWpXBw4SfUo6mWjPNHQJ5Y/ lbvpIbIj2n40O0B3kexgZS4= Received: (qmail 62341 invoked by alias); 17 Aug 2015 22:00:21 -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 62270 invoked by uid 89); 17 Aug 2015 22:00:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.0 required=5.0 tests=AWL, BAYES_05, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-lb0-f171.google.com Received: from mail-lb0-f171.google.com (HELO mail-lb0-f171.google.com) (209.85.217.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 17 Aug 2015 22:00:19 +0000 Received: by lbbsx3 with SMTP id sx3so91112650lbb.0 for ; Mon, 17 Aug 2015 15:00:15 -0700 (PDT) X-Received: by 10.112.167.202 with SMTP id zq10mr2840242lbb.69.1439848815538; Mon, 17 Aug 2015 15:00:15 -0700 (PDT) Received: from octofox.metropolis ([5.19.183.212]) by smtp.gmail.com with ESMTPSA id z12sm4223016lbp.46.2015.08.17.15.00.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Aug 2015 15:00:14 -0700 (PDT) From: Max Filippov To: gcc-patches@gcc.gnu.org Cc: linux-xtensa@linux-xtensa.org, Sterling Augustine , Max Filippov Subject: [PATCH 1/3] xtensa: reimplement register spilling Date: Tue, 18 Aug 2015 00:59:48 +0300 Message-Id: <1439848790-3488-2-git-send-email-jcmvbkbc@gmail.com> In-Reply-To: <1439848790-3488-1-git-send-email-jcmvbkbc@gmail.com> References: <1439848790-3488-1-git-send-email-jcmvbkbc@gmail.com> X-IsSubscribed: yes Spilling windowed registers in userspace is much easier, more portable, less error-prone and equally effective as in kernel. Now that register spilling syscall is considered obsolete in the xtensa linux kernel replace it with CALL12 followed by series of ENTRY in libgcc. 2015-08-18 Max Filippov libgcc/ * config/xtensa/lib2funcs.S (__xtensa_libgcc_window_spill): Use CALL12 followed by series of ENTRY to spill windowed registers. (__xtensa_nonlocal_goto): Call __xtensa_libgcc_window_spill instead of making linux spill syscall. --- libgcc/config/xtensa/lib2funcs.S | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/libgcc/config/xtensa/lib2funcs.S b/libgcc/config/xtensa/lib2funcs.S index 4d451c8..ef0703f 100644 --- a/libgcc/config/xtensa/lib2funcs.S +++ b/libgcc/config/xtensa/lib2funcs.S @@ -34,10 +34,29 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see .global __xtensa_libgcc_window_spill .type __xtensa_libgcc_window_spill,@function __xtensa_libgcc_window_spill: - entry sp, 32 - movi a2, 0 - syscall + entry sp, 48 +#if XCHAL_NUM_AREGS > 16 + call12 1f + retw + .align 4 +1: + .rept (XCHAL_NUM_AREGS - 24) / 12 + _entry sp, 48 + mov a12, a0 + .endr + _entry sp, 16 +#if XCHAL_NUM_AREGS % 12 == 0 + mov a4, a4 +#elif XCHAL_NUM_AREGS % 12 == 4 + mov a8, a8 +#elif XCHAL_NUM_AREGS % 12 == 8 + mov a12, a12 +#endif retw +#else + mov a8, a8 + retw +#endif .size __xtensa_libgcc_window_spill, .-__xtensa_libgcc_window_spill #endif @@ -61,10 +80,7 @@ __xtensa_nonlocal_goto: entry sp, 32 /* Flush registers. */ - mov a5, a2 - movi a2, 0 - syscall - mov a2, a5 + call8 __xtensa_libgcc_window_spill /* Because the save area for a0-a3 is stored one frame below the one identified by a2, the only way to restore those