This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
putting operands in MEM even with register_operand predicate
- From: "Sean D'Epagnier" <geckosenator at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 17 Jan 2009 20:41:21 -0500
- Subject: putting operands in MEM even with register_operand predicate
Hi,
I have a rule in machine descriptor:
(define_insn "fract<FIXED2:mode><FIXED1:mode>2"
[(set (match_operand:FIXED1 0 "register_operand" "")
(fract_convert:FIXED1 (match_operand:FIXED2 1
"register_operand" "")))]
""
"* return fract_out (insn, operands, 1, NULL);"
[(set_attr "cc" "clobber")])
Basically it generates instructions for fixed point conversions, but I
found that in certain very unlikely cases, sometimes it calls
fract_out where one of the operands is in MEM and is not a register.
This caused my function to output incorrect assembly which could not
be assembled.
I found that I can fix this problem by adding "=r" and "r" as follows:
(define_insn "fract<FIXED2:mode><FIXED1:mode>2"
[(set (match_operand:FIXED1 0 "register_operand" "=r")
(fract_convert:FIXED1 (match_operand:FIXED2 1
"register_operand" "r")))]
""
"* return fract_out (insn, operands, 1, NULL);"
[(set_attr "cc" "clobber")])
So I'm trying to understand this since I thought register_operand was
supposed to make things be in a register... I'm sure this is easy to
explain. Eventually I need to output instructions so one or the
other operands is allowed to be in MEM for efficiency reasons, but I
want to understand this first.
Thanks,
Sean