[committed] testsuite: Add yet another testcase for float range inverse ops [PR126547]

Jakub Jelinek <[email protected]> Mon, 3 Aug 2026 13:05:29 +0200
Newsgroups gmane.comp.gcc.patches
Message-ID <anB1-W8mYz_ID_C4@tucnak>
Hi!

This got also fixed with r17-2843.

Tested on x86_64-linux and i686-linux, committed to trunk as obvious.

2026-08-03  Jakub Jelinek  <[email protected]>

	PR tree-optimization/126547
	* gcc.dg/torture/pr126547.c: New test.

--- gcc/testsuite/gcc.dg/torture/pr126547.c.jj	2026-08-03 12:58:33.127328964 +0200
+++ gcc/testsuite/gcc.dg/torture/pr126547.c	2026-08-03 12:59:58.169244957 +0200
@@ -0,0 +1,31 @@
+/* PR tree-optimization/126547 */
+/* { dg-do run } */
+
+#if __LDBL_HAS_INFINITY__
+[[gnu::noipa]] static int
+foo (long double a1, long double a2)
+{
+  if (a1 >= 1.0 && a1 <= 8.0)
+    {
+      long double d = a1 / a2;
+      int n = 0;
+      if (d >= __builtin_infl ())
+	n += 1;
+      if (a2 > 0.0L)
+	n += 2;
+      return n;
+    }
+  else
+    return -1;
+}
+#endif
+
+int
+main ()
+{
+#if __LDBL_HAS_INFINITY__
+  if (__builtin_isinf (1.0 / __LDBL_DENORM_MIN__)
+      && foo (1.0, __LDBL_DENORM_MIN__) != 3)
+    __builtin_abort ();
+#endif
+}

	Jakub