Patchwork [ARM] Fix PR target/54892 - [4.7/4.8 Regression], ICE in extract_insn, at recog.c:2123

login
register
mail settings
Submitter Zhenqiang Chen
Date Oct. 19, 2012, 6:46 a.m.
Message ID <CACgzC7DTzdC2LKxQd74bvieL-1n4=G8KVqLVFMkCTgGj+sWP6A@mail.gmail.com>
Download mbox | patch
Permalink /patch/192577/
State New
Headers show

Comments

Zhenqiang Chen - Oct. 19, 2012, 6:46 a.m.
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?

Thanks!
-Zhenqiang

ChangeLog:
2012-10-19  Zhenqiang Chen <zhenqiang.chen@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.chen@linaro.org>

	PR target/54892
	* gcc.target/arm/pr54892.c: New.
Ramana Radhakrishnan - Oct. 19, 2012, 6:53 a.m.
On Fri, Oct 19, 2012 at 7:46 AM, Zhenqiang Chen
<zhenqiang.chen@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.chen@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.chen@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:
Zhenqiang Chen - Oct. 19, 2012, 9:45 a.m.
On 19 October 2012 14:53, Ramana Radhakrishnan
<ramana.gcc@googlemail.com> wrote:
> On Fri, Oct 19, 2012 at 7:46 AM, Zhenqiang Chen
> <zhenqiang.chen@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. Committed to 4.7 and trunk.

-Zhenqiang

Patch

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: