constraints.md (I28): New constraint.

* config/sh/constraints.md (I28): New constraint.
	* config/sh/sh.c (broken_move): Add support for movi20s.
	* config/sh/sh.md (movsi_ie): Add the alternative for
	movi20s.

	* gcc.target/sh/sh2a-movi20s.c: New test.


Co-Authored-By: Naveen.H.S <naveen.hs@kpitcummins.com>

From-SVN: r133514
This commit is contained in:
Jayant R Sonar 2008-03-25 13:36:11 +00:00 committed by Kaz Kojima
parent 561642fa67
commit e990551a82
6 changed files with 41 additions and 5 deletions

View File

@ -1,3 +1,11 @@
2008-03-25 Jayant Sonar <Jayant.sonar@kpitcummins.com>
Naveen.H.S <naveen.hs@kpitcummins.com>
* config/sh/constraints.md (I28): New constraint.
* config/sh/sh.c (broken_move): Add support for movi20s.
* config/sh/sh.md (movsi_ie): Add the alternative for
movi20s.
2008-03-25 Anil Paranjape <anil.paranjape@kpitcummins.com>
Jayant Sonar <Jayant.sonar@kpitcummins.com>
Naveen.H.S <naveen.hs@kpitcummins.com>

View File

@ -112,6 +112,12 @@
(match_test "ival >= -524288 && ival <= 524287")
(match_test "TARGET_SH2A")))
(define_constraint "I28"
"A signed 28-bit constant, as used in SH2A movi20s."
(and (match_code "const_int")
(match_test "ival >= -134217728 && ival <= 134217727")
(match_test "(ival & 255) == 0")
(match_test "TARGET_SH2A")))
(define_constraint "J16"
"0xffffffff00000000 or 0x00000000ffffffff."
(and (match_code "const_int")

View File

@ -3753,7 +3753,8 @@ broken_move (rtx insn)
&& FP_REGISTER_P (REGNO (SET_DEST (pat))))
&& ! (TARGET_SH2A
&& GET_MODE (SET_DEST (pat)) == SImode
&& satisfies_constraint_I20 (SET_SRC (pat)))
&& (satisfies_constraint_I20 (SET_SRC (pat))
|| satisfies_constraint_I28 (SET_SRC (pat))))
&& ! satisfies_constraint_I08 (SET_SRC (pat)))
return 1;
}

View File

@ -4937,9 +4937,9 @@ label:
;; TARGET_FMOVD is in effect, and mode switching is done before reload.
(define_insn "movsi_ie"
[(set (match_operand:SI 0 "general_movdst_operand"
"=r,r,r,r,t,r,r,r,r,m,<,<,x,l,x,l,y,<,r,y,r,*f,y,*f,y")
"=r,r,r,r,r,t,r,r,r,r,m,<,<,x,l,x,l,y,<,r,y,r,*f,y,*f,y")
(match_operand:SI 1 "general_movsrc_operand"
"Q,r,I08,I20,r,mr,x,l,t,r,x,l,r,r,>,>,>,y,i,r,y,y,*f,*f,y"))]
"Q,r,I08,I20,I28,r,mr,x,l,t,r,x,l,r,r,>,>,>,y,i,r,y,y,*f,*f,y"))]
"(TARGET_SH2E || TARGET_SH2A)
&& (register_operand (operands[0], SImode)
|| register_operand (operands[1], SImode))"
@ -4948,6 +4948,7 @@ label:
mov %1,%0
mov %1,%0
movi20 %1,%0
movi20s %1,%0
cmp/pl %1
mov.l %1,%0
sts %1,%0
@ -4969,13 +4970,14 @@ label:
flds %1,fpul
fmov %1,%0
! move optimized away"
[(set_attr "type" "pcload_si,move,movi8,move,*,load_si,mac_gp,prget,arith,store,mac_mem,pstore,gp_mac,prset,mem_mac,pload,load,fstore,pcload_si,gp_fpul,fpul_gp,fmove,fmove,fmove,nil")
(set_attr "late_fp_use" "*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,yes,*,*,yes,*,*,*,*")
[(set_attr "type" "pcload_si,move,movi8,move,move,*,load_si,mac_gp,prget,arith,store,mac_mem,pstore,gp_mac,prset,mem_mac,pload,load,fstore,pcload_si,gp_fpul,fpul_gp,fmove,fmove,fmove,nil")
(set_attr "late_fp_use" "*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,yes,*,*,yes,*,*,*,*")
(set_attr_alternative "length"
[(const_int 2)
(const_int 2)
(const_int 2)
(const_int 4)
(const_int 4)
(const_int 2)
(if_then_else
(ne (symbol_ref "TARGET_SH2A") (const_int 0))

View File

@ -1,3 +1,8 @@
2008-03-25 Jayant Sonar <Jayant.sonar@kpitcummins.com>
Naveen.H.S <naveen.hs@kpitcummins.com>
* gcc.target/sh/sh2a-movi20s.c: New test.
2008-03-25 Anil Paranjape <anil.paranjape@kpitcummins.com>
Jayant Sonar <Jayant.sonar@kpitcummins.com>
Naveen.H.S <naveen.hs@kpitcummins.com>

View File

@ -0,0 +1,14 @@
/* Testcase to check generation of 'MOVI20S #imm20, Rn'. */
/* { dg-do assemble {target sh*-*-*}} */
/* { dg-options "-O0" } */
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" } */
/* { dg-final { scan-assembler "movi20s"} } */
volatile long la;
void
testfun (void)
{
la = -134217728;
la = 134217216;
}