diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 38d19bdf7147..61987af01bff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-04-22 Christian Bruel + + * config/sh/sh.md (mov): Replace movQIHI. + Force immediates to SImode. + 2014-04-22 Sandra Loosemore * config/nios2/nios2.md (UNSPEC_ROUND): New. diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 9035bfcb1a8c..367f4ef2bbfc 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -6978,20 +6978,20 @@ label: [(set_attr "type" "sfunc") (set_attr "needs_delay_slot" "yes")]) -(define_expand "movhi" - [(set (match_operand:HI 0 "general_movdst_operand" "") - (match_operand:HI 1 "general_movsrc_operand" ""))] +(define_expand "mov" + [(set (match_operand:QIHI 0 "general_movdst_operand") + (match_operand:QIHI 1 "general_movsrc_operand"))] "" { - prepare_move_operands (operands, HImode); -}) + if (can_create_pseudo_p () && CONST_INT_P (operands[1]) + && REG_P (operands[0]) && REGNO (operands[0]) != R0_REG) + { + rtx reg = gen_reg_rtx(SImode); + emit_move_insn (reg, operands[1]); + operands[1] = gen_lowpart (mode, reg); + } -(define_expand "movqi" - [(set (match_operand:QI 0 "general_operand" "") - (match_operand:QI 1 "general_operand" ""))] - "" -{ - prepare_move_operands (operands, QImode); + prepare_move_operands (operands, mode); }) ;; Specifying the displacement addressing load / store patterns separately diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 78b0e34592d8..69a566757ef7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-04-22 Christian Bruel + + * gcc.target/sh/hiconst.c: New test. + 2014-04-22 Sandra Loosemore * gcc.target/nios2/custom-fp-conversion.c: Adjust to test that diff --git a/gcc/testsuite/gcc.target/sh/hiconst.c b/gcc/testsuite/gcc.target/sh/hiconst.c new file mode 100644 index 000000000000..d471d20364ec --- /dev/null +++ b/gcc/testsuite/gcc.target/sh/hiconst.c @@ -0,0 +1,22 @@ +/* { dg-do compile { target "sh*-*-*" } } */ +/* { dg-options "-O1" } */ + +char a; +int b; + +foo(char *pt, int *pti) +{ + a = 0; + b = 0; + *pt = 0; + *pti = 0; +} + +rab(char *pt, int *pti) +{ + pt[2] = 0; + pti[3] = 0; +} + +/* { dg-final { scan-assembler-times "mov\t#0" 2 } } */ +