]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[RISC-V][PR target/118170] Add HF div/sqrt reservation
authorAnton Blanchard <antonb@tenstorrent.com>
Wed, 15 Jan 2025 05:11:13 +0000 (22:11 -0700)
committerJeff Law <jlaw@ventanamicro.com>
Wed, 15 Jan 2025 05:17:07 +0000 (22:17 -0700)
Clearly an oversight in the generic-ooo model caught by the checking code.  I
should have realized it was generic-ooo as we don't have a pipeline description
for the tenstorrent design yet, just the costing model.

The patch was extracted from the BZ which indicated Anton was the author, so I
kept that.  I'm listed as co-author just in case someone wants to complain
about the testcase in the future.  I didn't do any notable lifting here.

Thanks Peter and Anton!

PR target/118170
gcc/
* config/riscv/generic-ooo.md (generic_ooo_float_div_half): New
reservation.

gcc/testsuite
* gcc.target/riscv/pr118170.c: New test.

Co-authored-by: Jeff Law <jlaw@ventanamicro.com>
gcc/config/riscv/generic-ooo.md
gcc/testsuite/gcc.target/riscv/pr118170.c [new file with mode: 0644]

index 6cf3463cc42d8c546968323360889a848e839b88..ae9430e47598956b5fe833d790c5c0cc4d31fb4d 100644 (file)
   "generic_ooo_issue,generic_ooo_fxu")
 
 ;; Assume float division and sqrt are not pipelined.
+(define_insn_reservation "generic_ooo_float_div_half" 10
+  (and (eq_attr "tune" "generic_ooo")
+       (and (eq_attr "type" "fdiv,fsqrt")
+           (eq_attr "mode" "HF")))
+  "generic_ooo_issue,generic_ooo_fxu,generic_ooo_div,generic_ooo_div*3")
+
 (define_insn_reservation "generic_ooo_float_div_single" 12
   (and (eq_attr "tune" "generic_ooo")
        (and (eq_attr "type" "fdiv,fsqrt")
diff --git a/gcc/testsuite/gcc.target/riscv/pr118170.c b/gcc/testsuite/gcc.target/riscv/pr118170.c
new file mode 100644 (file)
index 0000000..306ff88
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-do "compile" } */
+/* { dg-options "-O2 -mcpu=tt-ascalon-d8" } */
+_Float16 f;
+
+void
+foo ()
+{
+  f /= 3;
+}