From: Jayant R Sonar Date: Tue, 25 Mar 2008 13:36:11 +0000 (+0000) Subject: constraints.md (I28): New constraint. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e990551a821ea234e518ef75a380f0c0ab7af2c0;p=gcc.git 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 From-SVN: r133514 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 071d094d4db..7ca50285e1f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2008-03-25 Jayant Sonar + Naveen.H.S + + * 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 Jayant Sonar Naveen.H.S diff --git a/gcc/config/sh/constraints.md b/gcc/config/sh/constraints.md index 333c5beccb9..7509fae67ee 100644 --- a/gcc/config/sh/constraints.md +++ b/gcc/config/sh/constraints.md @@ -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") diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 57049ea738f..df959d82746 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -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; } diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 6dae438f9f9..750e9d36d96 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 103aaf20414..7cee9300aed 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-03-25 Jayant Sonar + Naveen.H.S + + * gcc.target/sh/sh2a-movi20s.c: New test. + 2008-03-25 Anil Paranjape Jayant Sonar Naveen.H.S diff --git a/gcc/testsuite/gcc.target/sh/sh2a-movi20s.c b/gcc/testsuite/gcc.target/sh/sh2a-movi20s.c new file mode 100644 index 00000000000..55d2f665b3b --- /dev/null +++ b/gcc/testsuite/gcc.target/sh/sh2a-movi20s.c @@ -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; +}