Re: [PATCH] gcc: middle-end opt for trigonometric pi-based functions builtins

2025-06-27 Thread Jakub Jelinek
On Fri, Jun 27, 2025 at 03:38:32PM +, Yuao Ma wrote: > Hi Jakub, > > > Please don't include math.h here. > > Done. > > > And instead of this line use __builtin_acospi (0.5). > > and, in dejagnu for runtime tests we prefer __builtin_abort on failure, so > > Done. Oh, one more thing. signbit

Re: [PATCH] gcc: middle-end opt for trigonometric pi-based functions builtins

2025-06-27 Thread Jakub Jelinek
On Fri, Jun 27, 2025 at 03:04:35PM +, Yuao Ma wrote: > > I think the __builtin_constant_p(acospi(0.5)) approach is usable, but would > > be much better done on the lib/target-supports.exp side. > > So, have foldable_pi_based_trigonometry effective target, which would test > > if __builtin_const

Re: [PATCH] gcc: middle-end opt for trigonometric pi-based functions builtins

2025-06-27 Thread Jakub Jelinek
On Fri, Jun 27, 2025 at 08:17:46AM +0200, Tobias Burnus wrote: > Hi Yuao, > > > Yuao Ma wrote: > > >//but the testcases don't seem to be conditionalized on this. Would the > > >//new tests fail if gcc is built against an insufficiently recent version > > >//of mpfr, > … > > The test case is indee

Re: [PATCH] gcc: middle-end opt for trigonometric pi-based functions builtins

2025-06-26 Thread Tobias Burnus
Hi Yuao, Yuao Ma wrote: >//but the testcases don't seem to be conditionalized on this. Would the >//new tests fail if gcc is built against an insufficiently recent version >//of mpfr, … The test case is indeed conditionalized, though in a different manner than you might expect. The condition

Re: [PATCH] gcc: middle-end opt for trigonometric pi-based functions builtins

2025-06-26 Thread David Malcolm
On Thu, 2025-06-26 at 17:45 +, Yuao Ma wrote: > Hi all, > > This patch, a follow-up to r16-1652-g0606d2b979f401, implements > middle-end > optimizations (e.g., constant folding) for our trigonometric pi-based > function > built-ins. > > This patch is part of > https://gcc.gnu.org/pipermail/fo

Re: [PATCH] gcc: middle-end opt for trigonometric pi-based functions builtins

2025-06-23 Thread Richard Biener
On Sat, Jun 7, 2025 at 3:56 PM Yuao Ma wrote: > > Hi all, > > This patch has been updated to conditionally fold the specified math functions > only when using MPFR version 4.2.0 or newer. > > To accompany this change, the test case now utilizes `__builtin_constant_p` to > determine whether to exec

Re: [PATCH] gcc: middle-end opt for trigonometric pi-based functions builtins

2025-06-02 Thread Tobias Burnus
Joseph Myers wrote: On Sun, 1 Jun 2025, Yuao Ma wrote: For MPFR versions older than 4.2.0, we've included our own folding functions. I think the normal practice in GCC would be to avoid the optimizations when the MPFR support is absent, instead of working around the absence with possibly less a

Re: [PATCH] gcc: middle-end opt for trigonometric pi-based functions builtins

2025-06-02 Thread Joseph Myers
On Sun, 1 Jun 2025, Yuao Ma wrote: > For MPFR versions older than 4.2.0, we've included our own folding functions. I think the normal practice in GCC would be to avoid the optimizations when the MPFR support is absent, instead of working around the absence with possibly less accurate implementa