public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/55947] New: non constant memory models lose HLE qualifiers
@ 2013-01-11 20:20 andi-gcc at firstfloor dot org
  2013-01-11 21:23 ` [Bug target/55947] " jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: andi-gcc at firstfloor dot org @ 2013-01-11 20:20 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55947

             Bug #: 55947
           Summary: non constant memory models lose HLE qualifiers
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: andi-gcc@firstfloor.org


get_memmodel does this

 /* If the parameter is not a constant, it's a run time value so we'll just
     convert it to MEMMODEL_SEQ_CST to avoid annoying runtime checking.  */
  if (TREE_CODE (exp) != INTEGER_CST)
    return MEMMODEL_SEQ_CST;

This implies that if __ATOMIC_HLE_ACQUIRE, __ATOMIC_HLE_RELEASE are passed in
as non constant they will get lost.


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

* [Bug target/55947] non constant memory models lose HLE qualifiers
  2013-01-11 20:20 [Bug target/55947] New: non constant memory models lose HLE qualifiers andi-gcc at firstfloor dot org
@ 2013-01-11 21:23 ` jakub at gcc dot gnu.org
  2013-01-11 22:02 ` andi-gcc at firstfloor dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-11 21:23 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55947

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-11 21:23:11 UTC ---
Yeah, that is intentional.  If you want HLE acquire/release, you really should
pass it as constant.  What do you think we should emit instead?  Runtime switch
based on the memory model?


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

* [Bug target/55947] non constant memory models lose HLE qualifiers
  2013-01-11 20:20 [Bug target/55947] New: non constant memory models lose HLE qualifiers andi-gcc at firstfloor dot org
  2013-01-11 21:23 ` [Bug target/55947] " jakub at gcc dot gnu.org
@ 2013-01-11 22:02 ` andi-gcc at firstfloor dot org
  2013-03-13 13:50 ` andi-gcc at firstfloor dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: andi-gcc at firstfloor dot org @ 2013-01-11 22:02 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55947

--- Comment #2 from Andi Kleen <andi-gcc at firstfloor dot org> 2013-01-11 22:01:49 UTC ---
I would probably add at least a warning. The whole concept of a runtime
switched memory barrier is imho ill-defined.


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

* [Bug target/55947] non constant memory models lose HLE qualifiers
  2013-01-11 20:20 [Bug target/55947] New: non constant memory models lose HLE qualifiers andi-gcc at firstfloor dot org
  2013-01-11 21:23 ` [Bug target/55947] " jakub at gcc dot gnu.org
  2013-01-11 22:02 ` andi-gcc at firstfloor dot org
@ 2013-03-13 13:50 ` andi-gcc at firstfloor dot org
  2013-03-13 14:16 ` jakub at gcc dot gnu.org
  2024-04-09  2:44 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: andi-gcc at firstfloor dot org @ 2013-03-13 13:50 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55947

--- Comment #3 from Andi Kleen <andi-gcc at firstfloor dot org> 2013-03-13 13:49:10 UTC ---
It was pointed out to me that atomic triggers this with, when compiled with no
optimization. For HLE wrong hints would be generated.


bool test_and_set(memory_order __m = memory_order_seq_cst) noexcept
{

      return __atomic_test_and_set (&_M_i, __m);

}

bool foo(std::atomic_flag fl) {

    return fl.test_and_set(std::memory_order_relaxed);

}


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

* [Bug target/55947] non constant memory models lose HLE qualifiers
  2013-01-11 20:20 [Bug target/55947] New: non constant memory models lose HLE qualifiers andi-gcc at firstfloor dot org
                   ` (2 preceding siblings ...)
  2013-03-13 13:50 ` andi-gcc at firstfloor dot org
@ 2013-03-13 14:16 ` jakub at gcc dot gnu.org
  2024-04-09  2:44 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-03-13 14:16 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55947

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-03-13 14:15:51 UTC ---
Not wrong, if the code isn't inlined and thus the model is variable, HLE hints
will be ignored and seq_cst model will be used.
If you want something else, even for -O0, just use inline with
__attribute__((always_inline)) to ensure it is inlined.


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

* [Bug target/55947] non constant memory models lose HLE qualifiers
  2013-01-11 20:20 [Bug target/55947] New: non constant memory models lose HLE qualifiers andi-gcc at firstfloor dot org
                   ` (3 preceding siblings ...)
  2013-03-13 14:16 ` jakub at gcc dot gnu.org
@ 2024-04-09  2:44 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-09  2:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55947

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Invalid as explained.

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

end of thread, other threads:[~2024-04-09  2:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-11 20:20 [Bug target/55947] New: non constant memory models lose HLE qualifiers andi-gcc at firstfloor dot org
2013-01-11 21:23 ` [Bug target/55947] " jakub at gcc dot gnu.org
2013-01-11 22:02 ` andi-gcc at firstfloor dot org
2013-03-13 13:50 ` andi-gcc at firstfloor dot org
2013-03-13 14:16 ` jakub at gcc dot gnu.org
2024-04-09  2:44 ` pinskia at gcc dot gnu.org

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).