On Mon, Feb 2, 2015 at 9:18 PM, James Bowman <james.bow...@ftdichip.com> wrote:
> FT32 is a new high performance 32-bit RISC core developed by FTDI for 
> embedded applications.
>
> Support for FT32 has already been added to binutils. This patch adds FT32 
> support to gcc.
>
> Please can someone review it, and if appropriate commit it, as I do not have 
> write access to the tree.
>
> The FSF have acknowledged receipt of FTDI's copyright assignment papers.

+(define_insn "umulsidi3"
+  [(set (match_operand:DI 0 "register_operand" "=r,r")
+    (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r,r"))
+         (zero_extend:DI (match_operand:SI 2 "ft32_rimm_operand" "r,KA"))))
+  ]
+  ""
+  "mul.l  $cc,%1,%2\;muluh.l %h0,%1,%2\;move.l   %0,$cc")

Could you have a split of this instruction to allow better register
allocation to happen?
Also you are clobbering $cc but don't have a clobber for that register
in the pattern.

Likewise of:
+(define_insn "abssi2"
+  [(set (match_operand:SI 0 "register_operand" "=r")
+ (abs:SI (match_operand:SI 1 "register_operand" "r")))
+   (clobber (match_scratch:SI 2 "=&r"))]
+  ""
+  "ashr.l\t%2,%1,31\;xor.l\t%0,%1,%2\;sub.l\t%0,%0,%2")


You also have a few formatting issues dealing with if statements.
An example:
+  /* If this is a store, force the value into a register.  */
+  if ( 1 && (! (reload_in_progress || reload_completed)))
+  {
+    if (MEM_P (operands[0]))
+    {

it should be:
  if (!(reload_in_progress || reload_completed))
    {
      if (MEM_P (operands[0]))
        {
           ....
+  "
+{
+  /* If this is a store, force the value into a register.  */
+  if (MEM_P (operands[0]))
+    operands[1] = force_reg (SFmode, operands[1]);
+  if (CONST_DOUBLE_P(operands[1]))
+    operands[1] = force_const_mem(SFmode, operands[1]);
+}")
You don't need the quotes around the {} in end of the patterns any more.
An example:
+  "
+{
+  /* If this is a store, force the value into a register.  */
+  if (MEM_P (operands[0]))
+    operands[1] = force_reg (SFmode, operands[1]);
+  if (CONST_DOUBLE_P(operands[1]))
+    operands[1] = force_const_mem(SFmode, operands[1]);
+}")

You do some of the instructions have lengths but not all, the ones
which matter the most are the ones where the output is more than one
instruction.

You implement some of the sync_* patterns instead of the newer
atomic_* patterns.



Thanks,
Andrew Pinski


>
> Thanks very much. ChangeLog entry:
>
> 2014-02-03  James Bowman  <james.bow...@ftdichip.com>
>
>         * configure.ac: FT32 target added
>         * libgcc/config.host: FT32 target added
>         * gcc/config/ft32/: FT32 target added
>         * libgcc/config/ft32/: FT32 target added
>         * configure: Regenerated
>
> --
> James Bowman
> FTDI Open Source Liaison

Reply via email to