public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, ARM] Fix PR target/54892 - [4.7/4.8 Regression], ICE in extract_insn, at recog.c:2123
@ 2012-10-19  7:23 Zhenqiang Chen
  2012-10-19  8:13 ` Ramana Radhakrishnan
  0 siblings, 1 reply; 3+ messages in thread
From: Zhenqiang Chen @ 2012-10-19  7:23 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1267 bytes --]

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.

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:

[-- Attachment #2: pr54892.c --]
[-- Type: text/x-csrc, Size: 141 bytes --]

/* { dg-do compile } */

int set_role(unsigned char role_id, short m_role)
{
  return __sync_bool_compare_and_swap(&m_role, -1, role_id);
}


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, ARM] Fix PR target/54892 - [4.7/4.8 Regression], ICE in extract_insn, at recog.c:2123
  2012-10-19  7:23 [PATCH, ARM] Fix PR target/54892 - [4.7/4.8 Regression], ICE in extract_insn, at recog.c:2123 Zhenqiang Chen
@ 2012-10-19  8:13 ` Ramana Radhakrishnan
  2012-10-19 10:29   ` Zhenqiang Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Ramana Radhakrishnan @ 2012-10-19  8:13 UTC (permalink / raw)
  To: Zhenqiang Chen; +Cc: gcc-patches

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:

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, ARM] Fix PR target/54892 - [4.7/4.8 Regression], ICE in extract_insn, at recog.c:2123
  2012-10-19  8:13 ` Ramana Radhakrishnan
@ 2012-10-19 10:29   ` Zhenqiang Chen
  0 siblings, 0 replies; 3+ messages in thread
From: Zhenqiang Chen @ 2012-10-19 10:29 UTC (permalink / raw)
  To: ramrad01; +Cc: gcc-patches

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-19  9:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-19  7:23 [PATCH, ARM] Fix PR target/54892 - [4.7/4.8 Regression], ICE in extract_insn, at recog.c:2123 Zhenqiang Chen
2012-10-19  8:13 ` Ramana Radhakrishnan
2012-10-19 10:29   ` Zhenqiang Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).