Sean D'Epagnier wrote:
I am working toward efficient support of some of the sfixed point types on avr architecture.I started out by writing an assembly library to handle all of the conversions to and from various fixed point, integer, and floating point types. In many cases the functions are only 1 or 2 instructions, so I would like to implement them in the machine descriptor language so there isn't a function call needed, and the registers can be used more efficiently. I was able to get addition of fixed point rules working, eg: (define_insn "addqq3" [(set (match_operand:QQ 0 "register_operand" "=r") (plus:QQ (match_operand:QQ 1 "register_operand" "%0") (match_operand:QQ 2 "register_operand" "r")))] "" "add %0,%2" [(set_attr "length" "1") (set_attr "cc" "set_czn")]) This rule works correctly and adds numbers. The problem is I can't get conversions to work, and I'm wondering if something is missing in the compiler elsewhere. Here is what I tried: (define_insn "fractqiqq" [(set (match_operand:QQ 0 "register_operand" "=r") (fract_convert:QQ (match_operand:QI 1 "register_operand" "0")))] "" "clr %0" [(set_attr "length" "1") (set_attr "cc" "set_czn")]) However, it always generates "rcall __fractqiqq" so it isn't using my rule. I also found that the fixed point conversions specified at "http://gcc.gnu.org/onlinedocs/gccint/Conversions.html" are not used by any backend currently, so I don't have any examples to work with. Has anyone used any of the following in machine description? fract_convert sat_fract unsigned_fract_convert unsigned_sat_fract I would like some examples. Thanks, Sean
Here is one example I made up in 2007 for MIPS backend. The md file contains all possible instruction patterns that GCC may utilize.
Regards,Chao-ying
fake-mips-fixed.md
Description: Binary data