]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
AVR: tree-optimization/115307 - Work around isinf bloat from early passes.
authorGeorg-Johann Lay <avr@gjlay.de>
Sat, 1 Jun 2024 08:38:00 +0000 (10:38 +0200)
committerGeorg-Johann Lay <avr@gjlay.de>
Sat, 1 Jun 2024 08:50:28 +0000 (10:50 +0200)
PR tree-optimization/115307
gcc/
* config/avr/avr.md (SFDF): New mode iterator.
(isinf<mode>2) [sf, df]: New expanders.

gcc/testsuite/
* gcc.target/avr/torture/pr115307-isinf.c: New test.

gcc/config/avr/avr.md
gcc/testsuite/gcc.target/avr/torture/pr115307-isinf.c [new file with mode: 0644]

index d4fcff46123be5593f2c87d98083b332ffef2597..75d35d5e14be697b7beb5d0625482417f61df582 100644 (file)
 (define_mode_iterator SPLIT34 [SI SF PSI
                                SQ USQ SA USA])
 
+(define_mode_iterator SFDF [SF DF])
+
 ;; Where the most significant bit is located.
 (define_mode_attr MSB  [(QI "7") (QQ "7") (UQQ "7")
                         (HI "15") (HQ "15") (UHQ "15") (HA "15") (UHA "15")
                          (const_int 1)
                          (match_dup 2)))])
 
+
+;; Work around PR115307: Early passes expand isinf/f/l to a bloat.
+;; These passes do not consider costs, and there is no way to
+;; hook in or otherwise disable the generated bloat.
+
+;; isinfsf2  isinfdf2
+(define_expand "isinf<mode>2"
+  [(parallel [(match_operand:HI 0)
+              (match_operand:SFDF 1)])]
+  ""
+  {
+    FAIL;
+  })
+
 \f
 ;; Fixed-point instructions
 (include "avr-fixed.md")
diff --git a/gcc/testsuite/gcc.target/avr/torture/pr115307-isinf.c b/gcc/testsuite/gcc.target/avr/torture/pr115307-isinf.c
new file mode 100644 (file)
index 0000000..6368bd2
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+int call_isinff (float f)
+{
+    int isinff (float);
+    return isinff (f);
+}
+
+int call_isinf (double f)
+{
+    int isinf (double);
+    return isinf (f);
+}
+
+int call_isinfl (long double f)
+{
+    int isinfl (long double);
+    return isinfl (f);
+}
+
+/* { dg-final { scan-assembler-not "unord" } } */