[PATCH,SH] Add SH2A new instructions 4/6

Kaz Kojima kkojima@rr.iij4u.or.jp
Tue Oct 30 01:33:00 GMT 2007


"Naveen H.S." <naveen.hs@kpitcummins.com> wrote:
> Please find attached the modified patch "sh2a4.patch". This patch
> implements new instructions NOTT and MOVRT for SH2A target.

Looks fine, except for a few problems about coding standard
and the missing testcase for nott.
Re-post the revised patch when the trunk returns to stage1.
Don't forget to describe how the patch is tested then.

> --- gcc-4.3-20070921/gcc/config/sh/sh.c	2007-10-24 12:09:31.000000000 +0530
> +++ tars/gcc-4.3-20070921/gcc/config/sh/sh.c	2007-10-24 12:14:27.000000000 +0530
> @@ -10590,6 +10590,11 @@ sh_expand_t_scc (enum rtx_code code, rtx
>    val = INTVAL (sh_compare_op1);
>    if ((code == EQ && val == 1) || (code == NE && val == 0))
>      emit_insn (gen_movt (result));
> +  else if (TARGET_SH2A && ((code == EQ && val == 0)
> +			    || (code == NE && val == 1)))
> +    {
> +      emit_insn (gen_movrt (result));
> +    }

We don't use braces in this case.

> --- gcc-4.3-20070921/gcc/config/sh/sh.md	2007-10-24 12:14:16.000000000 +0530
> +++ tars/gcc-4.3-20070921/gcc/config/sh/sh.md	2007-10-24 12:15:34.000000000 +0530
> @@ -3320,6 +3320,24 @@ label:
>  	xori	%1, %2, %0"
>    [(set_attr "type" "arith_media")])
>  
> +;; complements the T bit

This comment should be an English sentence like

;; Invert the T bit.

+(define_insn "xorsi_nott"
+  [(set (reg:SI T_REG)
+        (xor:SI (reg:SI T_REG)
+                (const_int 1)))]
  ^^^^^^^^
Use a tab.

> +;; complements the T bit and stores the result in a register

;; Store the complements of the T bit in a register.

> +(define_insn "xorsi3_movrt"
> +  [(set (match_operand:SI 0 "arith_reg_dest" "=r")
> +        (xor:SI (reg:SI T_REG)
> +                (const_int 1)))]
    ^^^^^^^^
Use a tab.

> @@ -9535,6 +9553,26 @@ mov.l\\t1f,r0\\n\\
>    "movt	%0"
>    [(set_attr "type" "arith")])
>  
> +;; complements the T bit

Same as above

> +;; complements the T bit and stores the result in a register

and here.

> --- gcc-4.3-20070921/gcc/testsuite/gcc.target/sh/sh2a-movrt.c	1970-01-01 05:30:00.000000000 +0530
> +++ tars/gcc-4.3-20070921/gcc/testsuite/gcc.target/sh/sh2a-movrt.c	2007-10-24 12:16:53.000000000 +0530
> @@ -0,0 +1,18 @@
> +/* Testcase to check generation of a SH2A specific instruction for
> +   "MOVRT Rn"  */

Missing period.

> +/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single
> +   -m2a-single-only" }  */

A single line would be safer.

> 2007-10-25	Naveen.H.S naveen.hs@kpitcummins.com
>             
> 	* config/sh/sh.c (sh_expand_t_scc): Generate MOVRT for a
> specific
> 	condition for SH2A target.
> 	* config/sh/sh.md : xorsi_nott, xorsi3_movrt, nott, movrt : New.

The style of this entry is wrong.  Should be

200z-xx-yy  Naveen.H.S  <naveen.hs@kpitcummins.com>
            
	* config/sh/sh.c (sh_expand_t_scc): Emit movrt for SH2A if possible.
	* config/sh/sh.md (xorsi_nott, xorsi3_movrt, nott, movrt): New insns.

New testcase requires an entry in gcc/testsuite/ChangeLog.

Regards,
	kaz



More information about the Gcc-patches mailing list