public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kyrill Tkachov <kyrylo.tkachov@foss.arm.com>
To: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>,
	gcc Patches <gcc-patches@gcc.gnu.org>,
	James Greenhalgh <James.Greenhalgh@arm.com>
Cc: Richard Sandiford <Richard.Sandiford@arm.com>
Subject: Re: PR90724 - ICE with __sync_bool_compare_and_swap with -march=armv8.2-a
Date: Wed, 17 Jul 2019 08:18:00 -0000	[thread overview]
Message-ID: <4e27950d-43fa-7ab3-a27f-169f91dbdabc@foss.arm.com> (raw)
In-Reply-To: <CAAgBjMnMqXAnbtnTT4Q_0GDFw9X3mRfbActR1bMkU73Cg_x6Yg@mail.gmail.com>

Hi Prathamesh

On 7/10/19 12:24 PM, Prathamesh Kulkarni wrote:
> Hi,
> For following test-case,
> static long long AL[24];
>
> int
> check_ok (void)
> {
>   return (__sync_bool_compare_and_swap (AL+1, 0x200000003ll, 
> 0x1234567890ll));
> }
>
> Compiling with -O2 -march=armv8.2-a results in:
> pr90724.c: In function ‘check_ok’:
> pr90724.c:7:1: error: unrecognizable insn:
>     7 | }
>       | ^
> (insn 11 10 12 2 (set (reg:CC 66 cc)
>         (compare:CC (reg:DI 95)
>             (const_int 8589934595 [0x200000003]))) "pr90724.c":6:11 -1
>      (nil))
>
> IIUC, the issue is that 0x200000003 falls outside the range of
> allowable immediate in cmp ? If it's replaced by a small constant then 
> it works.
>
> The ICE results with -march=armv8.2-a because, we enter if
> (TARGET_LSE) { ... } condition
> in aarch64_expand_compare_and_swap, while with -march=armv8.a it goes 
> into else,
> which forces oldval into register if the predicate fails to match.
>
> The attached patch checks if y (oldval) satisfies aarch64_plus_operand
> predicate and if not, forces it to be in register, which resolves ICE.
> Does it look OK ?
>
> Bootstrap+testing in progress on aarch64-linux-gnu.
>
> PS: The issue has nothing to do with SVE, which I incorrectly
> mentioned in bug report.
>
This looks ok to me (but you'll need maintainer approval).

Does this fail on the branches as well?

Thanks,

Kyrill


> Thanks,
> Prathamesh

  parent reply	other threads:[~2019-07-17  8:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-10 11:28 Prathamesh Kulkarni
2019-07-17  7:19 ` Prathamesh Kulkarni
2019-07-17  8:18 ` Kyrill Tkachov [this message]
2019-07-17 13:40   ` Prathamesh Kulkarni
2019-07-25  7:50     ` Prathamesh Kulkarni
2019-08-01 10:04       ` Prathamesh Kulkarni
2019-08-08  6:31         ` Prathamesh Kulkarni
2019-08-15 13:30           ` Prathamesh Kulkarni
2019-08-19 18:34             ` James Greenhalgh
2019-08-21 20:48               ` Prathamesh Kulkarni
2019-08-22  3:18                 ` JiangNing OS
2019-08-22  3:36                   ` JiangNing OS
2019-09-09 19:07                 ` Prathamesh Kulkarni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4e27950d-43fa-7ab3-a27f-169f91dbdabc@foss.arm.com \
    --to=kyrylo.tkachov@foss.arm.com \
    --cc=James.Greenhalgh@arm.com \
    --cc=Richard.Sandiford@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=prathamesh.kulkarni@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).