]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Add missing define_insn_reservation to tt-ascalon-d8.md [PR121982]
authorPeter Bergner <bergner@tenstorrent.com>
Mon, 22 Sep 2025 17:17:26 +0000 (12:17 -0500)
committerPeter Bergner <bergner@tenstorrent.com>
Mon, 22 Sep 2025 23:30:20 +0000 (18:30 -0500)
The tt-ascalon-d8's pipeline description has reservations for 16-bit, 32-bit
and 64-bit vector integer divides, but was missing a reservation for 8-bit
vector integer divides, leading to an ICE.  Add the missing reservation.

2025-09-22  Peter Bergner  <bergner@tenstorrent.com>

gcc/
PR target/121982
* config/riscv/tt-ascalon-d8.md (tt_ascalon_d8_vec_idiv_byte): New
define_insn_reservation.

gcc/testsuite/
PR target/121982
* gcc.target/riscv/pr121982.c: New test.

Signed-off-by: Peter Bergner <bergner@tenstorrent.com>
gcc/config/riscv/tt-ascalon-d8.md
gcc/testsuite/gcc.target/riscv/pr121982.c [new file with mode: 0644]

index 25b99b6129ee7f4634c062950a8774e069791729..e72012e2b5baf3b0783f6a848732acf24781d02f 100644 (file)
   "tt_ascalon_d8_decode,(tt_ascalon_d8_vec0*3 | tt_ascalon_d8_vec1*3)")
 
 ;; Vector integer division
+(define_insn_reservation "tt_ascalon_d8_vec_idiv_byte" 16
+  (and (eq_attr "tune" "tt_ascalon_d8")
+       (eq_attr "type" "vidiv")
+       (eq_attr "sew" "8"))
+  "tt_ascalon_d8_decode,(tt_ascalon_d8_vec0*3 | tt_ascalon_d8_vec1*3)")
+
 (define_insn_reservation "tt_ascalon_d8_vec_idiv_half" 16
   (and (eq_attr "tune" "tt_ascalon_d8")
        (eq_attr "type" "vidiv")
diff --git a/gcc/testsuite/gcc.target/riscv/pr121982.c b/gcc/testsuite/gcc.target/riscv/pr121982.c
new file mode 100644 (file)
index 0000000..fb9baf8
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mcpu=tt-ascalon-d8 -mtune=tt-ascalon-d8" } */
+
+/* Verify we don't ICE on the following test cases.  */
+
+typedef char __attribute__((__vector_size__ (32))) vqi;
+typedef short __attribute__((__vector_size__ (32))) vhi;
+typedef int __attribute__((__vector_size__ (32))) vsi;
+typedef long __attribute__((__vector_size__ (32))) vdi;
+
+#define TEST(type) type foo_ ## type (type x, type y) { return x / y; }
+
+TEST(vqi)
+TEST(vhi)
+TEST(vsi)
+TEST(vdi)