From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by sourceware.org (Postfix) with ESMTPS id 2880A3858D38 for ; Thu, 17 Aug 2023 08:26:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2880A3858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-51e28cac164so1398994a12.1 for ; Thu, 17 Aug 2023 01:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692260770; x=1692865570; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:cc:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=N0+UtNRAOC+9yj2LMcAWUlQHpfrFkIy8bp6x5bR7EVQ=; b=OU1HvHyCXhXUN6qc45xN5Phim2ngfHo7/loIEJAA3o820ZWC6/bStxqPkhlVakJgrB 57AmdiVytQ7wATmV2dZkJqhWYosukQqVyrGI+OcfI0QsZtyxB+ktJhUfBrFzwgDb0iY2 gkz6onk6T4DCFPKS48RgWy4mCdjo1OtUaBquuk8N1GPmELQEODlWU3fcuMzWKjGlToGS HaYmfQA3RKwMUWYKAq8skzposrkkJ9H4m5924INpy4dt+/nRmUxqA66O8K0P2YOw/MYl B2FUorrdtVxgZp7L/xb/2GE4HdPzwFUe2BeHFmbQDv/mqbKrT60kAbGmjzcmlO5AlKTl vf1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692260770; x=1692865570; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:cc:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=N0+UtNRAOC+9yj2LMcAWUlQHpfrFkIy8bp6x5bR7EVQ=; b=kwkZ+r7PqD8d76XCxXV680uipv1GsmcX0tQlLGvGMHIrc6yjRlr28xm+6/sbW0OlhO +S5pa2eq0/Xu3jpc1rTsp8dBHfjWzW9+yvAW4x/S/jyi6lBm4D3fVSEODbH3nFW1XZA5 UNPUvOB1mvDrq9SYDRKl+I2bQzXieDyXTEbm2KDCRIgRmEOIz6/un6y/Cux13IuDfwNJ enFik+pHZu7lm1fzaTPXjR59EaqxEFRTin5ZX73ngx7QDU0bzttOldI59QHY2sQwkb7T zAtRe9c4yogjS33Ql9Fmp3z+bIZrZoLoZVGO3n8bucXSDyBIolrr0LkwJyTLXckpXbG4 St9A== X-Gm-Message-State: AOJu0YzHltUniS/9pidz/Hxm3u+0ncjg6xFBqXNnzTFgNd6TnizUPwv2 JKe2Oa+xEwEx+aCNJmEfOaw= X-Google-Smtp-Source: AGHT+IEy38FKnwf9IDl6yv5JfOwfM/pfDz6qzOM8I64mmujX+YJZD0L8+5xJWyGsnxSynYg130afgg== X-Received: by 2002:a17:907:2bc7:b0:99c:fb4d:a110 with SMTP id gv7-20020a1709072bc700b0099cfb4da110mr2204041ejc.7.1692260769466; Thu, 17 Aug 2023 01:26:09 -0700 (PDT) Received: from [192.168.1.23] (ip-046-005-130-086.um12.pools.vodafone-ip.de. [46.5.130.86]) by smtp.gmail.com with ESMTPSA id k8-20020a17090627c800b0099b8234a9fesm9818094ejc.1.2023.08.17.01.26.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Aug 2023 01:26:09 -0700 (PDT) Message-ID: <90b35919-773d-b27b-fe1e-d33dd3b21630@gmail.com> Date: Thu, 17 Aug 2023 10:26:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: rdapp.gcc@gmail.com, juzhe.zhong@rivai.ai, gcc-patches@gcc.gnu.org, Kito Cheng Subject: Re: [PATCH] RISC-V: Fix reduc_strict_run-1 test case. To: Palmer Dabbelt , jeffreyalaw@gmail.com References: Content-Language: en-US From: Robin Dapp In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: > I'm not opposed to merging the test change, but I couldn't figure out > where in C the implicit conversion was coming from: as far as I can > tell the macros don't introduce any (it's "return _float16 * > _float16"), I'd had the patch open since last night but couldn't > figure it out. > > We get a bunch of half->single->half converting in the generated > assembly that smelled like we had a bug somewhere else, sorry if I'm > just missing something... Yes, good point, my explanation was wrong again. What really (TM) happens is that the equality comparison, in presence of _Float16 emulation(!), performs an extension to float/double for its arguments. So if (res != r * q) is if ((float)res (float)!= (float)(r * q)) Now, (r * q) is also implicitly computed in float. Because the comparison requires a float argument, there is no intermediate conversion back to _Float16 and the value is more accurate than it would be in _Float16. res, however, despite being calculated in float as well, is converted to _Float16 for the function return or rather the assignment to "res". Therefore it is less accurate than (r * q) and the comparison fails. So, what would also help, even though it's not obvious at first sight is: TYPE res = reduc_plus_##TYPE (a, b); \ - if (res != r * q) \ + TYPE ref = r * q; \ + if (res != ref) \ __builtin_abort (); \ } This does not happen with proper _zfh because the operations are done in _Float16 precision then. BTW such kinds of non-obvious problems are the reason why I split off _zvfh run tests into separate files right away. Regards Robin