From: Tomasz Jankowski <tomcioj@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: Problem with modyfying "addsi3" in machine description
Date: Fri, 12 Oct 2012 15:05:00 -0000 [thread overview]
Message-ID: <CAMxYpJzt_P3-1=VkRrwvp8QJZFXTbCtb_QL6-xPCuLKzP5inVQ@mail.gmail.com> (raw)
Hello,
I'm working on machine description for modified OpenRISC and at the
moment I'm trying to modify standard "addsi3" insn. I have custom add
in instruction called "radd", which I'm going to use for regular
arithmetic (for computing addresses, offsets for stack pointer etc. I
use "standard" OpenRISC instructions). The problem with "radd" is only
operates on register, so when I have to add immediate to register I
have to first manually copy immediate to temporary register and then
call my "radd" instruction. I implemented code for that:
(define_expand "addsi3"
[(set (match_operand:SI 0 "general_operand" "")
(plus:SI (match_operand:SI 1 "general_operand" "")
(match_operand:SI 2 "general_operand" "")))]
""
{
if (CONST_INT_P (operands [2]))
{
operands [2] = force_reg (SImode, operands [2]);
emit_insn (gen_rto (operands [2], operands [2]));
}
//emit_insn (gen_rtx_SET (VOIDmode, operands [0], gen_rtx_PLUS
(SImode, operands [1], operands [2])));
DONE;
})
(define_insn "radd"
[(set (match_operand:SI 0 "register_operand" "=r")
(plus:SI (match_operand:SI 1 "register_operand" "%r")
(match_operand:SI 2 "register_operand" "r")))]
""
"l.radd \t%0,%1,%2"
[(set_attr "type" "add")
(set_attr "length" "1")])
During GCC compilation, when self test are run GCC fails on assertion:
gcc_assert (can_create_pseudo_p ());
in function:
rtx gen_reg_rtx (enum machine_mode mode)
Why I cannot create temporary registers in define_expand? What's
possible workaround for this issue?
Bye
next reply other threads:[~2012-10-12 15:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-12 15:05 Tomasz Jankowski [this message]
2012-10-12 17:16 ` Ian Lance Taylor
2012-10-14 19:29 ` Tomasz Jankowski
2012-10-14 20:33 ` Tomasz Jankowski
2012-10-14 23:19 ` Georg-Johann Lay
2012-10-15 11:56 ` Tomasz Jankowski
2012-10-15 15:37 ` Segher Boessenkool
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='CAMxYpJzt_P3-1=VkRrwvp8QJZFXTbCtb_QL6-xPCuLKzP5inVQ@mail.gmail.com' \
--to=tomcioj@gmail.com \
--cc=gcc-help@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).