On Fri, Oct 19, 2012 at 7:46 AM, Zhenqiang Chen <zhenqiang.c...@linaro.org> wrote: > Hi, > > In function arm_expand_compare_and_swap, oldval is converted to SImode > when its "mode" is QImode/HImode. After "FALLTHRU" to "case SImode", > we should use "SImode", other than "mode" (which is QImode/HImode). > And INSN atomic_compare_and_swap<mode>_1 expects the operand in > SImode. > > No make check regression. > > Is it OK for 4.7 and trunk?
Makes sense , OK for both. Thanks, Ramana > > Thanks! > -Zhenqiang > > ChangeLog: > 2012-10-19 Zhenqiang Chen <zhenqiang.c...@linaro.org> > > PR target/54892 > * config/arm/arm.c (arm_expand_compare_and_swap): Use SImode to make > sure the mode is correct when falling through from above cases. > > testsuite/ChangeLog: > 2012-10-19 Zhenqiang Chen <zhenqiang.c...@linaro.org> > > PR target/54892 > * gcc.target/arm/pr54892.c: New. > > diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c > index fc3a508..265e1cb 100644 > --- a/gcc/config/arm/arm.c > +++ b/gcc/config/arm/arm.c > @@ -25437,8 +25437,8 @@ arm_expand_compare_and_swap (rtx operands[]) > case SImode: > /* Force the value into a register if needed. We waited until after > the zero-extension above to do this properly. */ > - if (!arm_add_operand (oldval, mode)) > - oldval = force_reg (mode, oldval); > + if (!arm_add_operand (oldval, SImode)) > + oldval = force_reg (SImode, oldval); > break; > > case DImode: