From: Jeff Law <jeffreyalaw@gmail.com>
To: Dimitar Dimitrov <dimitar@dinux.eu>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] riscv: Fix insn cost calculation
Date: Tue, 6 Jun 2023 20:40:36 -0600 [thread overview]
Message-ID: <48ad5303-6d8b-f45e-1381-d4dbeff29d5a@gmail.com> (raw)
In-Reply-To: <20230606045130.1687824-1-dimitar@dinux.eu>
On 6/5/23 22:51, Dimitar Dimitrov wrote:
> 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. I don't have setup to test riscv64.
I think most folks are using QEMU to test. Though I think most are
doing it in a rv64 environment.
>
> gcc/ChangeLog:
>
> * config/riscv/riscv.cc (riscv_const_insns): Recursively call
> for constant element of a vector.
OK for the trunk. I don't think this code is in gcc-13, but also OK as
a backport if I'm wrong and it is in gcc-13.
jeff
prev parent reply other threads:[~2023-06-07 2:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 4:51 Dimitar Dimitrov
2023-06-07 2:40 ` Jeff Law [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48ad5303-6d8b-f45e-1381-d4dbeff29d5a@gmail.com \
--to=jeffreyalaw@gmail.com \
--cc=dimitar@dinux.eu \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).