public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "andi-gcc at firstfloor dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/55139] __atomic store does not support __ATOMIC_HLE_RELEASE Date: Wed, 07 Nov 2012 04:04:00 -0000 [thread overview] Message-ID: <bug-55139-4-S2sRBaPW8L@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-55139-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55139 --- Comment #1 from Andi Kleen <andi-gcc at firstfloor dot org> 2012-11-07 04:03:53 UTC --- This is an interesting one. This is the gcc code: enum memmodel { MEMMODEL_RELAXED = 0, MEMMODEL_CONSUME = 1, MEMMODEL_ACQUIRE = 2, MEMMODEL_RELEASE = 3, MEMMODEL_ACQ_REL = 4, MEMMODEL_SEQ_CST = 5, MEMMODEL_LAST = 6 }; #define MEMMODEL_MASK ((1<<16)-1) enum memmodel model; model = get_memmodel (CALL_EXPR_ARG (exp, 2)); if ((model & MEMMODEL_MASK) != MEMMODEL_RELAXED && (model & MEMMODEL_MASK) != MEMMODEL_SEQ_CST && (model & MEMMODEL_MASK) != MEMMODEL_RELEASE) { error ("invalid memory model for %<__atomic_store%>"); return NULL_RTX; } HLE_STORE is 1 << 16, so outside the enum range But when looking at the assembler we see that the & MEMMODEL_MASK gets optimized away, it just generates a direct sequence of 32bit cmps. This makes all the != fail, even though they should succeed I presume the optimizer assumes nothing can be outside the enum. I tried to expand the enum by adding MEMMODEL_ARCH1 = 1 << 16, MEMMODEL_ARCH2 = 1 << 17, MEMMODEL_ARCH3 = 1 << 18, MEMMODEL_ARCH4 = 1 << 19 But still doesn't work. Questions: - Is it legal for the optimizer to assume this? - Why does extending the enum not help? We could fix it by not using an enum here of course, but I wonder if this is an underlying optimizer bug.
next prev parent reply other threads:[~2012-11-07 4:04 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-10-30 16:59 [Bug target/55139] New: " andi-gcc at firstfloor dot org 2012-11-07 4:04 ` andi-gcc at firstfloor dot org [this message] 2012-11-07 14:31 ` [Bug target/55139] " jakub at gcc dot gnu.org 2012-11-07 14:45 ` andi-gcc at firstfloor dot org 2012-11-09 14:06 ` andi-gcc at firstfloor dot org 2012-11-09 15:24 ` ak at gcc dot gnu.org 2024-04-09 3:22 ` pinskia at gcc dot gnu.org
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=bug-55139-4-S2sRBaPW8L@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.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: linkBe 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).