public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] riscv: Fix insn cost calculation
@ 2023-06-12 14:25 Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2023-06-12 14:25 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:aee3d984a2de38d76f3b00b83a728b34557179a1
commit aee3d984a2de38d76f3b00b83a728b34557179a1
Author: Dimitar Dimitrov <dimitar@dinux.eu>
Date: Mon Jun 5 21:30:35 2023 +0300
riscv: Fix insn cost calculation
When building riscv32-none-elf with "--enable-checking=yes,rtl", the
following ICE is observed:
cc1: internal compiler error: RTL check: expected code 'const_int', have 'const_double' in riscv_const_insns, at config/riscv/riscv.cc:1313
0x843c4d rtl_check_failed_code1(rtx_def const*, rtx_code, char const*, int, char const*)
/mnt/nvme/dinux/local-workspace/gcc/gcc/rtl.cc:916
0x8eab61 riscv_const_insns(rtx_def*)
/mnt/nvme/dinux/local-workspace/gcc/gcc/config/riscv/riscv.cc:1313
0x15443bb riscv_legitimate_constant_p
/mnt/nvme/dinux/local-workspace/gcc/gcc/config/riscv/riscv.cc:826
0xdd3c71 emit_move_insn(rtx_def*, rtx_def*)
/mnt/nvme/dinux/local-workspace/gcc/gcc/expr.cc:4310
0x15f28e5 run_const_vector_selftests
/mnt/nvme/dinux/local-workspace/gcc/gcc/config/riscv/riscv-selftests.cc:285
0x15f37bd selftest::riscv_run_selftests()
/mnt/nvme/dinux/local-workspace/gcc/gcc/config/riscv/riscv-selftests.cc:364
0x1f6fba9 selftest::run_tests()
/mnt/nvme/dinux/local-workspace/gcc/gcc/selftest-run-tests.cc:111
0x11d1f39 toplev::run_self_tests()
/mnt/nvme/dinux/local-workspace/gcc/gcc/toplev.cc:2185
Fix by following the spirit of the adjacent comment, and using the
dedicated riscv_const_insns() function to calculate cost for loading a
constant element. Infinite recursion is not possible because the first
invocation is on a CONST_VECTOR, whereas the second is on a single
element of the vector (e.g. CONST_INT or CONST_DOUBLE).
Regression tested for riscv32-none-elf. No changes in gcc.sum and
g++.sum.
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_const_insns): Recursively call
for constant element of a vector.
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Diff:
---
gcc/config/riscv/riscv.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 21e7d3b3caa..4ff3758434c 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -1310,7 +1310,7 @@ riscv_const_insns (rtx x)
a general-purpose register. This means we need as many
insns as it takes to load the constant into the GPR
and one vmv.v.x. */
- return 1 + riscv_integer_cost (INTVAL (elt));
+ return 1 + riscv_const_insns (elt);
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] riscv: Fix insn cost calculation
@ 2023-07-14 2:44 Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2023-07-14 2:44 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:31ef97dad9e66c8651e156f4e920581e58d40c0c
commit 31ef97dad9e66c8651e156f4e920581e58d40c0c
Author: Dimitar Dimitrov <dimitar@dinux.eu>
Date: Mon Jun 5 21:30:35 2023 +0300
riscv: Fix insn cost calculation
When building riscv32-none-elf with "--enable-checking=yes,rtl", the
following ICE is observed:
cc1: internal compiler error: RTL check: expected code 'const_int', have 'const_double' in riscv_const_insns, at config/riscv/riscv.cc:1313
0x843c4d rtl_check_failed_code1(rtx_def const*, rtx_code, char const*, int, char const*)
/mnt/nvme/dinux/local-workspace/gcc/gcc/rtl.cc:916
0x8eab61 riscv_const_insns(rtx_def*)
/mnt/nvme/dinux/local-workspace/gcc/gcc/config/riscv/riscv.cc:1313
0x15443bb riscv_legitimate_constant_p
/mnt/nvme/dinux/local-workspace/gcc/gcc/config/riscv/riscv.cc:826
0xdd3c71 emit_move_insn(rtx_def*, rtx_def*)
/mnt/nvme/dinux/local-workspace/gcc/gcc/expr.cc:4310
0x15f28e5 run_const_vector_selftests
/mnt/nvme/dinux/local-workspace/gcc/gcc/config/riscv/riscv-selftests.cc:285
0x15f37bd selftest::riscv_run_selftests()
/mnt/nvme/dinux/local-workspace/gcc/gcc/config/riscv/riscv-selftests.cc:364
0x1f6fba9 selftest::run_tests()
/mnt/nvme/dinux/local-workspace/gcc/gcc/selftest-run-tests.cc:111
0x11d1f39 toplev::run_self_tests()
/mnt/nvme/dinux/local-workspace/gcc/gcc/toplev.cc:2185
Fix by following the spirit of the adjacent comment, and using the
dedicated riscv_const_insns() function to calculate cost for loading a
constant element. Infinite recursion is not possible because the first
invocation is on a CONST_VECTOR, whereas the second is on a single
element of the vector (e.g. CONST_INT or CONST_DOUBLE).
Regression tested for riscv32-none-elf. No changes in gcc.sum and
g++.sum.
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_const_insns): Recursively call
for constant element of a vector.
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Diff:
---
gcc/config/riscv/riscv.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 21e7d3b3caa..4ff3758434c 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -1310,7 +1310,7 @@ riscv_const_insns (rtx x)
a general-purpose register. This means we need as many
insns as it takes to load the constant into the GPR
and one vmv.v.x. */
- return 1 + riscv_integer_cost (INTVAL (elt));
+ return 1 + riscv_const_insns (elt);
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-14 2:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 14:25 [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] riscv: Fix insn cost calculation Jeff Law
2023-07-14 2:44 Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).