From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by sourceware.org (Postfix) with ESMTPS id 63C9A3857800 for ; Thu, 16 Sep 2021 09:20:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 63C9A3857800 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-pj1-x1029.google.com with SMTP id m21-20020a17090a859500b00197688449c4so4331086pjn.0 for ; Thu, 16 Sep 2021 02:20:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2XK063woCn2ND490ufI03jO9wSWKk9vHOYGHF4puAAI=; b=NZrZrtVOm1lg3y5B0XH/ZjO+87fLKkVulohs51z7RiXsRSLlniuCihEy3k3AUPabDa jAWePhW1SODH89BxnqSwLsa1aIjlS/RDZLrf8i41XKrSJ7dlF1i+97alnniTEGyXl38Z Vved/O9CQhWlgzdb/7JNELQXZBXjtDau1n9LvGhV0ucj4d1ipPB5hIyQJ3USAr/2SmXG 3rk5fOQ/OEQHw9erXIarSsbVNwc4UIdSb+8bgqJQd+tE5DP3BTLbcr+tMvChlg2ZLdQ6 5saFjGNGiWy1lrPUritlfZCN/EtxCb2yYhnJ3Iu/V7AXXtO3lp6O8VCACy9owfCobMgp +lHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2XK063woCn2ND490ufI03jO9wSWKk9vHOYGHF4puAAI=; b=hTYJWjQ9WFI/CoDZMlcLZsX7iSTVf2bmJBMNk006YtZofpiT7mho2nMTIoGL2vdT55 c159JGDjJdcdevVDtVH6243Ivp8iFDx9iC1MSOKr8Ek8k3ZHeIGRrxUw5k9k2M4mt19A HpprWFQGNXTwdPD0eX3DEi67ywPxMFU0i5Q4QEoqEo7qxad27nv2xR73lrZpUVDyszQh l+3zTQN2lJgLZFwmjcoctAPdDgm1qOwbWVmr8ccSONLo2wYhrETKMaCpZkwE7D5qJh1C dWVZmF8uwBB/axRpT1Q06fqhwZH7va4TovMQ0pi7NDDy2owlHsNGws+CWgngfxU9SmZw RjZw== X-Gm-Message-State: AOAM5329DuckDMKgGUfit7TlhTwwTEY9VGbqMDATvNeRJiCylQQxbwRr OQqJt8fjrN33VGLKz422ITK3s1G184iNMiPdfErUiQ== X-Google-Smtp-Source: ABdhPJxJsODjfwGzJXGnEKc1bdWp6Gd7fo1/Z1L0isNTjy/c/aEqzPFh7FRF3hCW5s5EDEgP7uNjakiyV+NMz63MHxM= X-Received: by 2002:a17:902:e2d4:b0:13b:9402:fefc with SMTP id l20-20020a170902e2d400b0013b9402fefcmr3937661plc.40.1631784031310; Thu, 16 Sep 2021 02:20:31 -0700 (PDT) MIME-Version: 1.0 References: <1631497278-29829-1-git-send-email-vincent.chen@sifive.com> <1631497278-29829-4-git-send-email-vincent.chen@sifive.com> In-Reply-To: From: Vincent Chen Date: Thu, 16 Sep 2021 17:20:20 +0800 Message-ID: Subject: Re: [RFC patch 3/5] RISC-V: Save and restore VCSR when doing user context switch To: Andrew Waterman Cc: Joseph Myers , GNU C Library , Palmer Dabbelt Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 09:20:33 -0000 On Wed, Sep 15, 2021 at 8:13 AM Andrew Waterman wrote: > > On Tue, Sep 14, 2021 at 4:48 PM Joseph Myers wrote: > > > > On Mon, 13 Sep 2021, Vincent Chen wrote: > > > > > According to the RISC-V V extension specification, all vector registers > > > except VCSR are caller-saved registers. The VCSR (vxrm + vxsat) has thread > > > storage duration. Therefore, only VCSR needs to be added to the user > > > context operation. > > > > What is the intended programming model for using vxrm and vxsat? > > > > The expectation for the floating-point rounding modes and flags is that > > they work just like user-defined _Thread_local variables - that is, they > > are *not* saved or restored by setjmp/longjmp or *context functions. It > > would be natural to expect fixed-point rounding modes and flags to work > > similarly. > > Indeed, Joseph, vxsat and vxrm should be treated analogously to the FP > flags and rounding mode, respectively. > OK, I understood. As Andrew mentioned, the vxsat and vxrm should be treated analogously to the FP flags and rounding mode. Therefore, the VCSR should not be saved and restored in *context functions. I think this patch can be dropped in the next version patch. Thank Joseph and Andrew for the kind reply. Thanks, Vincent > > > > -- > > Joseph S. Myers > > joseph@codesourcery.com