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 6FA743858D1E for ; Tue, 7 May 2024 14:11:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6FA743858D1E 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 6FA743858D1E 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=1715091090; cv=none; b=ScjIQ/m1cIlUTbgTJTZv+pNvVgX7OVaIzQpDxnrf8WBZa9EvnK74dkbh85Wz0wWRef8FHm9vv2GB+Pvh+kT7oSTrq15hREEFKIQgRTfy30pZeV4aXIeizXVBhHWI1vODAJlghoiMVtIJ0PmahBp9/DjIkkMm3dGlv3+px9FCLxk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715091090; c=relaxed/simple; bh=ZWPSD+yZK6ey6R10UIGFI0twCSLPON4qknQEMPr5Jok=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=JBrJ4o9E1bgWUfgiXT8GiIstJu8B9r1MZSJ4WUvj8d7kzgFHH7dvZbnH/foxMVHuTHdw2mg7ZbDeuxgWjhZSFRAkBTP/u8c+DFHeHiO4HmnzQtPdpropXIZTo3yd4BnvdtqdXbBCyn7iitMUAjMZk3czAKo72m5ybv4bLOlUpEo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715091088; 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=o8UHj6T847Y1CkmaeyHgq8Updz6XVrL/oKrtiNBKwtg=; b=aIqkzsShEm1+ElahQOOdi0K5YeE/j5T1Wq04whTvW8voELSPUcTKaSsCe6N/MIqiV+kETb HBiYYcI/g8mScOLG/NFVvP7ex3GEGH8XkZs5VMia8aPgosGE7wfQv0RcAqgeTaRLZ1vWvT 3P67F+vgyTNpAj1XOoW9gnTB0lcLZrI= Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-350-r4OPDLVfNwqB2Q3G2GAVWQ-1; Tue, 07 May 2024 10:11:26 -0400 X-MC-Unique: r4OPDLVfNwqB2Q3G2GAVWQ-1 Received: by mail-yb1-f198.google.com with SMTP id 3f1490d57ef6-de468af2b73so6669183276.0 for ; Tue, 07 May 2024 07:11:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715091085; x=1715695885; 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=o8UHj6T847Y1CkmaeyHgq8Updz6XVrL/oKrtiNBKwtg=; b=i4R1stF7EGUGkPdTRMDAqD5PA/JcnRKhDGg5lc0Amq9jZSGdeVjOtbTvYx5F6CJnSI 7GzI5CYnYJkpkwmcijZgwyTB6YNkNz2HIsISITMl4tImfVZwwFWMfeOUFvxj8LPSFyeD jHUUtkBdwmVDBQgYCI29IG+94k3vqcSWjwkLTypMHsLohz30rO/5gyxm8DKqO2L32DUm j9P53Qqw/wb4WCQiVzUTq6Xz2zvAoe3sEiLj6MawscNRiN028zT5TxGlUf/JMGMyRrBy NK6AuP2fjoW4VsHWS3F5EW15nTOFdFbRotawkwZv2fHgWlNLmbxDZnstZVq9vpGZdRjj 1Unw== X-Gm-Message-State: AOJu0Yxy+TTI1c78AKCVRv5vmBoBsJzfgwZwuK52Mzvgx89gd6Z42zMD ci43GW5dAGZWeQgZKUukVCNDNaHAEqGJstvyLeLbDW4Cctf2rUfP2oIgqWIZpBFANKKOerU6TuO qSUtNnXv1B/+3z04gHxATIrTAFxAcMWsyfDYuf/MbtBwoc0nbHM0+buKML5ekD7b6Nb4gmBOPEA ZEbfKyArhQpRARJHJA0f5dAmMQTZgM3QTe+RWoJQ== X-Received: by 2002:a25:8d07:0:b0:de5:5aaa:7881 with SMTP id n7-20020a258d07000000b00de55aaa7881mr12321461ybl.49.1715091084585; Tue, 07 May 2024 07:11:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqrT5FgyqljhBszty7tL71tZ9MQ0bfZKsijxReDBmYL99ivkUQHH9vqpPK3MV2HKweJdF7AR4zOOLvspjhZro= X-Received: by 2002:a25:8d07:0:b0:de5:5aaa:7881 with SMTP id n7-20020a258d07000000b00de55aaa7881mr12321442ybl.49.1715091084287; Tue, 07 May 2024 07:11:24 -0700 (PDT) MIME-Version: 1.0 References: <20240507135019.3821031-1-jwakely@redhat.com> In-Reply-To: From: Jonathan Wakely Date: Tue, 7 May 2024 15:11:08 +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.6 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=ham 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: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 My patch uses copysign unconditionally, to avoid branching on isnan. I don't know if that's the right choice.