From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 381D73858013; Tue, 23 Jan 2024 11:38:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 381D73858013 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 381D73858013 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::435 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706009889; cv=none; b=K6LTYldj5+Ui9H8y2tSCLcl9dAECbgyNTU0zi0yR+WRT3kc4BMNRbvT2GccTUDXdCFH84q8OVWkJbw2LTS6tTCEM/VhQxT1f5Fn4+YZRl34WaW7cdADHYwv5CexY6naBC/rwN2b1LrbTE9uNgoHuITeyOL7HvQ3O2/LfdmYbtBY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706009889; c=relaxed/simple; bh=+H5zvug7EJKRgXUg7DH6P3zb0O3u/AEi/oMmHpo5cw4=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=JzYNyxvjXCFVTyvXN8VbIetW+C+3wUUqoElsP8woJanftDJ/pX6uf248cB+A6mI8YV5/IyVXVazeldQJBO++ZRzPSBFHCplvLSOXZT8B5kkhMO3RjNurJeYYCtGxFxR7FD7qrwl05ft1dXaO++Sgmu4L68setPVLuZep8qlpG+w= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-3392ba29845so2616035f8f.2; Tue, 23 Jan 2024 03:38:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706009886; x=1706614686; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+H5zvug7EJKRgXUg7DH6P3zb0O3u/AEi/oMmHpo5cw4=; b=U840HMgudes4Y77bBeEXxSt2G7zpHGNcqpGV7dFdGySLNOUktfHfQnCLuPoGtdG16Y 5Qxdc1lOt0HQiyoBLHFTaYAubajZi3zQ6QU1z7l9Fgy0J+chV/QROkrrkhEaHBXyGARg EpoQthJ5gyqBkNJl2OoZmTTi6VmRTnEqcfib8f5HzL+UhHaOvL7lTZa6Aa7uDgRFyKGH 0WJirLq29Cqgb6dUZBqb4uJQAph2MEWWV8Iva/E5DBcie3amxLLVZ8DUB/0V+9daTXyR 2BXqkS05v0IpCidLmGAXqNmq7wR5CpUr+ZKCsHx7Jjtcpa8zdUUTuiJFP4liyutu/Zev yQGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706009886; x=1706614686; h=content-transfer-encoding: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=+H5zvug7EJKRgXUg7DH6P3zb0O3u/AEi/oMmHpo5cw4=; b=c/dKJM6aeVupErHU6xTyiRFzwoiI10aeMqBtpIEzvx5fLulndA8zE5wPoy3juERob+ G3/HxP80YMhkyWXhbNDpya23PeEQth3wnxK+qHNEUK4NOEYGpvazt2olnD0BD2EMbox4 9gl3jY+/zug9XbMwc4hU+gE31sSqj2f6qk1VYFS3mrmme9vzzWHAAIp9Fh+UhNe64iPq WLNVXa6db2du4rgjQL7DcMDa0Zqo4Ae9Ub763YtwjdyzixkotRgtgSTNTLmOFmlrSE2E rWa8HfSFWQv9wwfgfAepNq/BRFfkydyEmgaU5IQGxzxy+yPC1z/wUf+7AdDALm0qjeuM noMw== X-Gm-Message-State: AOJu0YyGRLFxPQHDRd5YqVP52xpbkd5u5J0slKir8MMVic03J+okTebP FTyvHpsrEc3qMLpTWLrOeYjV8COsCmXZ/1qmDaG/xzOVwBKF7TKRbkojJidTG+5N5o9RHWMw9ag HaRJ6DhXsekR3dUlavqHPqVeUQQKi7dLlEY8= X-Google-Smtp-Source: AGHT+IFJItwAOg0rTY8PCmFwHVk0VNnbfL+tF85qucnE4QlGXQUYD7qtWelQyI/jN8xDqFjbtiNKsWbeaVYA7yjddRY= X-Received: by 2002:a5d:4286:0:b0:337:c527:ad4f with SMTP id k6-20020a5d4286000000b00337c527ad4fmr2162541wrq.119.1706009885472; Tue, 23 Jan 2024 03:38:05 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Janne Blomqvist Date: Tue, 23 Jan 2024 13:37:54 +0200 Message-ID: Subject: Re: [Fortran] half-cycle trig functions and atan[d] fixes To: FX Coudert Cc: Steve Kargl , fortran , gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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, Jan 23, 2024 at 11:09=E2=80=AFAM FX Coudert w= rote: > > Hi Steve, Hello, long time no see. > Thanks for the patch. I=E2=80=99ll take time to do a proper review, but a= fter a first read I had the following questions: > > - "an OS's libm may/will contain cospi(), etc.=E2=80=9D: do those functio= ns conform to any standard? Are there plans to implement them outside FreeB= SD at this point? acospi, asinpi, atan2pi, atanpi, cospi, sinpi, tanpi are all in IEEE 754-2019, and are slated to be part of C23. I would assume actively developed libm's will eventually catch up and implement them. > - If I get this right, to take one example, the Fortran front-end will em= it a call to gfortran_acospi_r4(), libgfortran provides this as a wrapper c= alling acospif(), which is called either from libm or from libgfortran. Thi= s is different from other math library functions, like ACOS() where the aco= sf() call is generated directly from the front-end (and then the implementa= tion comes either from libm or from libgfortran). Why not follow our usual = way of doing things? Good point, that's what we've done in c99_functions.c in libgfortran. We should probably do this so we can skip jumping via libgfortran when libm implements these directly. > - On most targets, cospi() and friends are not available. Therefore, we e= nd up doing the fallback (with limited precision as you noted) but with a l= ot of indirection. We could generate that code directly in the front-end, c= ouldn=E2=80=99t we? The frontend generally doesn't know what the target libm implements, hence it's better to just generate the call, and if necessary have a barebones implementation in libgfortran if libm doesn't implement it properly. --=20 Janne Blomqvist