From patchwork Mon Mar 19 18:42:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 887832 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-91165-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aurel32.net Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="Y+XSmCLZ"; dkim-atps=neutral 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 404lL330dbz9s7f for ; Tue, 20 Mar 2018 05:42:35 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; q=dns; s= default; b=j+H1X21ef9CKdx1GqPpaZz6DOWiQPfCufsWZI+JKdTZeMbv3epiGF qduUgxGlOWvpl3PP9X6FmtySIBn7CDdssV0wODvemug5KHLOp2LntTisb3+y3+mZ tFPEsHz8vDRT5uMAbhl1Xx7Nl2/fDxpDM+xpBDLmtqeelAXZGEDF7E= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; s=default; bh=w19ZPYxmFLz3cjPHUyx+6LQ46fU=; b=Y+XSmCLZvDsjyvh/H8VN7nMnkW/T NfGr26e5R5wdWkfJw1hD+jryms7pp32gwG9ED6qT0pvsUsMShGp4dLckrkRxXjpw a1L7ahqnx2VrXvn+ZVxBQ3afjkZBOS5IzZVAKILtJtBZgTIoZEVQy4xZz6ujpVlB 3bswlcMfOUxaQss= Received: (qmail 76628 invoked by alias); 19 Mar 2018 18:42:29 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 76603 invoked by uid 89); 19 Mar 2018 18:42:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1756, H*r:bc8, H*RU:bc8, Hx-spam-relays-external:bc8 X-HELO: hall.aurel32.net From: Aurelien Jarno To: libc-alpha@sourceware.org Cc: DJ Delorie Subject: [2.27 COMMITTED 1/3] RISC-V: Do not initialize $gp in TLS macros. Date: Mon, 19 Mar 2018 19:42:06 +0100 Message-Id: <20180319184208.23770-1-aurelien@aurel32.net> From: DJ Delorie RISC-V TLS doesn't require GP to be initialized, and doing so breaks TLS in a shared object. (cherry picked from commit 8090720a87e42fddc31396f6126112d4b8014d8e) --- ChangeLog | 4 ++++ sysdeps/riscv/tls-macros.h | 20 +++----------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 17075925fa6..8b859f637d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-02-22 DJ Delorie + + * sysdeps/riscv/tls-macros.h: Do not initialize $gp. + 2018-03-16 Rafal Luzynski [BZ #22963] diff --git a/sysdeps/riscv/tls-macros.h b/sysdeps/riscv/tls-macros.h index 5433ed9d16c..7f0dd926d0c 100644 --- a/sysdeps/riscv/tls-macros.h +++ b/sysdeps/riscv/tls-macros.h @@ -23,19 +23,9 @@ #include #include "dl-tls.h" -#define LOAD_GP \ - ".option push\n\t" \ - ".option norelax\n\t" \ - "la gp, __global_pointer$\n\t" \ - ".option pop\n\t" - -#define UNLOAD_GP - #define TLS_GD(x) \ ({ void *__result; \ - asm (LOAD_GP \ - "la.tls.gd %0, " #x "\n\t" \ - UNLOAD_GP \ + asm ("la.tls.gd %0, " #x "\n\t" \ : "=r" (__result)); \ __tls_get_addr (__result); }) @@ -43,19 +33,15 @@ #define TLS_IE(x) \ ({ void *__result; \ - asm (LOAD_GP \ - "la.tls.ie %0, " #x "\n\t" \ + asm ("la.tls.ie %0, " #x "\n\t" \ "add %0, %0, tp\n\t" \ - UNLOAD_GP \ : "=r" (__result)); \ __result; }) #define TLS_LE(x) \ ({ void *__result; \ - asm (LOAD_GP \ - "lui %0, %%tprel_hi(" #x ")\n\t" \ + asm ("lui %0, %%tprel_hi(" #x ")\n\t" \ "add %0, %0, tp, %%tprel_add(" #x ")\n\t" \ "addi %0, %0, %%tprel_lo(" #x ")\n\t" \ - UNLOAD_GP \ : "=r" (__result)); \ __result; }) From patchwork Mon Mar 19 18:42:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 887834 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-91167-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aurel32.net Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="QYbKx0AH"; dkim-atps=neutral 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 404lLL4zYZz9s7f for ; Tue, 20 Mar 2018 05:42:50 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Ws3Y/T2NdR1EEqGBi7ZDxQSw5pnLG4E UqadX23vg4hNV+GuG+RbXf+yXYK5J7fJS5AT6hSkWoYS4JDbEY443MxqYmTZPVm9 Alnu7lmfe6v/HG9UFdZGiWZaBOp8m6BOK1NgwWfAQaMlmqeRNsk59el2IsrU9hRH 6vk3N9PXBU4A= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=Vs0eb1RD/d4GxMPGcbToPxbGxww=; b=QYbKx 0AHUBnUz2SHdUi+dauOIWVmQgieMlK0n5/OfNOb4S5MAUrRajqjJtJ9Tyl/M0TUk akPiS7rvs76tJo3VLo0hJhw14HKiG1Aogd0o+/5zXE80RISvz53pjvvyLI//1w9r pbyQ5Kp+lLc7STazC4uYRapTxIh9EO0MmJzlRU= Received: (qmail 76863 invoked by alias); 19 Mar 2018 18:42:30 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 76758 invoked by uid 89); 19 Mar 2018 18:42:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, T_RP_MATCHES_RCVD, UNWANTED_LANGUAGE_BODY autolearn=ham version=3.3.2 spammy=H*RU:bc8, Hx-spam-relays-external:bc8, H*r:bc8, Hx-languages-length:3770 X-HELO: hall.aurel32.net From: Aurelien Jarno To: libc-alpha@sourceware.org Cc: Andrew Waterman Subject: [2.27 COMMITTED 2/3] RISC-V: fmax/fmin: Handle signalling NaNs correctly. Date: Mon, 19 Mar 2018 19:42:07 +0100 Message-Id: <20180319184208.23770-2-aurelien@aurel32.net> In-Reply-To: <20180319184208.23770-1-aurelien@aurel32.net> References: <20180319184208.23770-1-aurelien@aurel32.net> From: Andrew Waterman RISC-V's fmax(sNAN,4) returns 4 but glibc expects it to return qNAN. * sysdeps/riscv/rvd/s_fmax.c (__fmax): Handle sNaNs correctly. * sysdeps/riscv/rvd/s_fmin.c (__fmin): Likewise. * sysdeps/riscv/rvf/s_fmaxf.c (__fmaxf): Likewise. * sysdeps/riscv/rvf/s_fminf.c (__fminf): Likewise. (cherry picked from commit fdcc625376505eacb1125a6aeba57501407a30ec) --- ChangeLog | 7 +++++++ sysdeps/riscv/rvd/s_fmax.c | 11 +++++++++-- sysdeps/riscv/rvd/s_fmin.c | 11 +++++++++-- sysdeps/riscv/rvf/s_fmaxf.c | 11 +++++++++-- sysdeps/riscv/rvf/s_fminf.c | 11 +++++++++-- 5 files changed, 43 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b859f637d6..394f6703638 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-02-22 Andrew Waterman + + * sysdeps/riscv/rvd/s_fmax.c (__fmax): Handle sNaNs correctly. + * sysdeps/riscv/rvd/s_fmin.c (__fmin): Likewise. + * sysdeps/riscv/rvf/s_fmaxf.c (__fmaxf): Likewise. + * sysdeps/riscv/rvf/s_fminf.c (__fminf): Likewise. + 2018-02-22 DJ Delorie * sysdeps/riscv/tls-macros.h: Do not initialize $gp. diff --git a/sysdeps/riscv/rvd/s_fmax.c b/sysdeps/riscv/rvd/s_fmax.c index ef8f1344ce5..22e91bfc4b8 100644 --- a/sysdeps/riscv/rvd/s_fmax.c +++ b/sysdeps/riscv/rvd/s_fmax.c @@ -17,12 +17,19 @@ . */ #include +#include #include double __fmax (double x, double y) { - asm ("fmax.d %0, %1, %2" : "=f" (x) : "f" (x), "f" (y)); - return x; + double res; + + if (__glibc_unlikely ((_FCLASS (x) | _FCLASS (y)) & _FCLASS_SNAN)) + return x + y; + else + asm ("fmax.d %0, %1, %2" : "=f" (res) : "f" (x), "f" (y)); + + return res; } libm_alias_double (__fmax, fmax) diff --git a/sysdeps/riscv/rvd/s_fmin.c b/sysdeps/riscv/rvd/s_fmin.c index c6ff24cefb8..7b35230cacd 100644 --- a/sysdeps/riscv/rvd/s_fmin.c +++ b/sysdeps/riscv/rvd/s_fmin.c @@ -17,12 +17,19 @@ . */ #include +#include #include double __fmin (double x, double y) { - asm ("fmin.d %0, %1, %2" : "=f" (x) : "f" (x), "f" (y)); - return x; + double res; + + if (__glibc_unlikely ((_FCLASS (x) | _FCLASS (y)) & _FCLASS_SNAN)) + return x + y; + else + asm ("fmin.d %0, %1, %2" : "=f" (res) : "f" (x), "f" (y)); + + return res; } libm_alias_double (__fmin, fmin) diff --git a/sysdeps/riscv/rvf/s_fmaxf.c b/sysdeps/riscv/rvf/s_fmaxf.c index 3293f2f41ca..63f7e3d6648 100644 --- a/sysdeps/riscv/rvf/s_fmaxf.c +++ b/sysdeps/riscv/rvf/s_fmaxf.c @@ -17,12 +17,19 @@ . */ #include +#include #include float __fmaxf (float x, float y) { - asm ("fmax.s %0, %1, %2" : "=f" (x) : "f" (x), "f" (y)); - return x; + float res; + + if (__glibc_unlikely ((_FCLASS (x) | _FCLASS (y)) & _FCLASS_SNAN)) + return x + y; + else + asm ("fmax.s %0, %1, %2" : "=f" (res) : "f" (x), "f" (y)); + + return res; } libm_alias_float (__fmax, fmax) diff --git a/sysdeps/riscv/rvf/s_fminf.c b/sysdeps/riscv/rvf/s_fminf.c index e4411f04b25..82cca4e37d8 100644 --- a/sysdeps/riscv/rvf/s_fminf.c +++ b/sysdeps/riscv/rvf/s_fminf.c @@ -17,12 +17,19 @@ . */ #include +#include #include float __fminf (float x, float y) { - asm ("fmin.s %0, %1, %2" : "=f" (x) : "f" (x), "f" (y)); - return x; + float res; + + if (__glibc_unlikely ((_FCLASS (x) | _FCLASS (y)) & _FCLASS_SNAN)) + return x + y; + else + asm ("fmin.s %0, %1, %2" : "=f" (res) : "f" (x), "f" (y)); + + return res; } libm_alias_float (__fmin, fmin) From patchwork Mon Mar 19 18:42:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 887833 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-91166-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aurel32.net Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="UscNUKfF"; dkim-atps=neutral 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 404lLB6Kpwz9s7f for ; Tue, 20 Mar 2018 05:42:42 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=JgAYdbgRgC07sosONMfpsfe5eu6sDVD +Fy83mVCDcC6t9BocicKCbnZ7K54gZPyW7DoYf6RNEt1SDql1kiDU9mhoA6Dd5BH xiAfyX/6TSZ9ipO4GTrowXeQGxv6khpw+d1kgGD4crVinrG26VIuDhN5nHdDzARR pyIVsATNbwAg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=H6/rk+9rYgWpOp3mJwy9lW4f3Ow=; b=UscNU KfF6uWNId07hLfHffY/H2qz13J9VDgs/RfvyL5cPrt6V93DNghX9SeycdCwPcZVW il+I1r/gQocm5TOWrnRcgQrqLkx2quT0LDA9JCf2NfUAkID8Ae8V/Dp5IooMjQGg Ak+93P/BEoXdDIktJd3LA5HszhwiJLHOtqzSTQ= Received: (qmail 76639 invoked by alias); 19 Mar 2018 18:42:29 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 76605 invoked by uid 89); 19 Mar 2018 18:42:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:bc8, H*RU:bc8, H*r:bc8 X-HELO: hall.aurel32.net From: Aurelien Jarno To: libc-alpha@sourceware.org Cc: DJ Delorie Subject: [2.27 COMMITTED 3/3] Update ChangeLog for BZ 22884 - riscv fmax/fmin Date: Mon, 19 Mar 2018 19:42:08 +0100 Message-Id: <20180319184208.23770-3-aurelien@aurel32.net> In-Reply-To: <20180319184208.23770-1-aurelien@aurel32.net> References: <20180319184208.23770-1-aurelien@aurel32.net> From: DJ Delorie (cherry picked from commit 7e04eb2932d3126c721ee2bc0d664a5bbea2f41f) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 394f6703638..23ff0ea3057 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2018-02-22 Andrew Waterman + [BZ # 22884] * sysdeps/riscv/rvd/s_fmax.c (__fmax): Handle sNaNs correctly. * sysdeps/riscv/rvd/s_fmin.c (__fmin): Likewise. * sysdeps/riscv/rvf/s_fmaxf.c (__fmaxf): Likewise.