From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 29958384A06B for ; Fri, 10 May 2024 10:59:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 29958384A06B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 29958384A06B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715338750; cv=none; b=oa2NmXWETVK7zk0Z5U/wjD1xT3D9RG5zxUDciE+dD5hub7+zyqd2VTBU/goPP0O65zDJMquxrlusxvkJ5WEAOyHild7EreFI27fgntpFB3mS2bn4C1nlwKlDM7Ciun8lO4GI8BtIzVhTMxMDPHRwLqXxCpHKIG+abdUoT+Y32aI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715338750; c=relaxed/simple; bh=Fa1m0Fb7jFfj5lpnc4toun+k7JRR+53V6zpuNhHQq4Q=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=EBdC9ri6SyLwyCpVJbPtXhah4M3TlkBsjsaNgrIV/gMI4e6OBFYiKzSFk/oYwekhhyPjUY7d6i+1QcEC5xZnXX/Z9V+P11Fn1/cMxYgKXjKbf4xx5MKKDtTfJJmAJ43FCrrqOmcE3qlHDOm+GYETDbkrgixbivysqBg/3fFnmFQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715338748; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kyTeVIpVdslJK2o9DHgB0zk0BcueABJkLpKuYrjVrBg=; b=ixJCsBYtiMM3SynHeC7wxMs1s+dVZ49uqjkbfRhM23Zkr3YwuxecYLZ6QMM6gEG7RpmB71 3eebf/0pQm1S4Q1hTb/cMH/P7MsAc+sqfuhf/luz0qwKhwVw2ioUmXFC1GVSL06lnwoJKw tjE5xcoppWcqEAJlmFE9+13XYLiXWrE= Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-108-rs2NfUa4NpmVVH2kbtCESw-1; Fri, 10 May 2024 06:59:07 -0400 X-MC-Unique: rs2NfUa4NpmVVH2kbtCESw-1 Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-61be23bb01aso36133317b3.2 for ; Fri, 10 May 2024 03:59:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715338747; x=1715943547; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kyTeVIpVdslJK2o9DHgB0zk0BcueABJkLpKuYrjVrBg=; b=oiBgn8xdGDWqmRoKTF2PzblpazaQPPfGaBLIdYHdqYeJimDfhfBoS5T+O3/JQBuMpZ uYTP7QERR7/ghj9JABCZA66mC1sA45dtCNfO0h8bIS579BQz9RE9urN0h534YbyryrkK WhUlB2Ww/1q66e+CTDssflwYz4SN/CoIHSf42Su2h59GBWW75yR4LeYXSxuAVg0kvl3w eCJVWEWWgvmOysx/T2qEkLa2NXhl+TkmfUI9IgXIo/P+h4H3L4U9TsH+65R+B2SQgOqK QNMo+qV7LfEfCqxTcozzJpD03hoNxWMQkiDmUPoFe08t7m5pW61QvciJG9K7IP+eD9xb 0u0g== X-Forwarded-Encrypted: i=1; AJvYcCXMUBu//hqoswt3+B9kb8igt0uAzoN4sIpgojKPWD8tdFEvlSWKkR8lMj+UiiWmUI0pUwV31v52ZMywQreXat0+WGzkc74OKg== X-Gm-Message-State: AOJu0YzSqyfKlmx4aR7MrFw44BkuOT8625N8wlhYOPm+IXz83wQzJG5V hO0hvhG+JXE5UOKE3otzLGw1lnwEbslDK/zS0PClxfzVGetZTaZIXgZH8QZM4lgc+BJTKMyMacs rKN/ruCrMHcXFIevMLz/3zMhuW6mwtOqLeJabIjpcSbNCc4FB2LEgrmfQPxopRoLs+LmXol0rC7 ZANP7JWFT8Yz86y77l9SXRCROm8K7BzQ== X-Received: by 2002:a25:bc83:0:b0:de6:b96:c607 with SMTP id 3f1490d57ef6-dee4f33838cmr2476912276.22.1715338746867; Fri, 10 May 2024 03:59:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqazR25bPY2yKQM+u/9GSUSgYS/xj3fOQhnvFtTzZuH0Ow4HV2UyHr9NLzg8DF+4iwCfhiqBJKnvGlJRs+D5s= X-Received: by 2002:a25:bc83:0:b0:de6:b96:c607 with SMTP id 3f1490d57ef6-dee4f33838cmr2476886276.22.1715338746370; Fri, 10 May 2024 03:59:06 -0700 (PDT) MIME-Version: 1.0 References: <20240507135019.3821031-1-jwakely@redhat.com> In-Reply-To: From: Jonathan Wakely Date: Fri, 10 May 2024 11:58:50 +0100 Message-ID: Subject: Re: [PATCH][risc-v] libstdc++: Preserve signbit of nan when converting float to double [PR113578] To: Jeff Law Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, 7 May 2024 at 15:11, Jonathan Wakely wrote: > > On Tue, 7 May 2024 at 15:06, Jonathan Wakely wrote: > > > > On Tue, 7 May 2024 at 14:57, Jeff Law wrote: > > > > > > > > > > > > On 5/7/24 7:49 AM, Jonathan Wakely wrote: > > > > Do we want this change for RISC-V, to fix PR113578? > > > > > > > > I haven't tested it on RISC-V, only on x86_64-linux (where it doesn't do > > > > anything). > > > > > > > > -- >8 -- > > > > > > > > libstdc++-v3/ChangeLog: > > > > > > > > PR libstdc++/113578 > > > > * include/std/ostream (operator<<(basic_ostream&, float)): > > > > Restore signbit after converting to double. > > > No strong opinion. One could argue that the existence of a > > > conditional like that inherently implies the generic code is dependent > > > on specific processor behavior which probably is unwise. But again, no > > > strong opinion. > > > > Yes, but I'm not aware of any other processors that lose the signbit > > like this, so in practice it's always worked fine to cast the float to > > double. > > The similar glibc fix for strfrom is specific to RISC-V: > https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0cc0033ef19bd3378445c2b851e53d7255cb1b1e Looks like I spoke too soon and the same behaviour exists on Apple M1 chips. > > My patch uses copysign unconditionally, to avoid branching on isnan. I > don't know if that's the right choice.