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