public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/53020] New: __atomic_fetch_or doesn't generate `1 insn` variant
@ 2012-04-17 16:21 kirill.yukhin at intel dot com
  2012-04-17 16:25 ` [Bug target/53020] " kirill.yukhin at intel dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: kirill.yukhin at intel dot com @ 2012-04-17 16:21 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53020
           Summary: __atomic_fetch_or doesn't generate `1 insn` variant
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: kirill.yukhin@intel.com


Hello,
while working on Intel's TSX extensions, I've found strange (to me) thing.

We have in config/i386/sync.md:
(define_insn "atomic_<code><mode>"
  [(set (match_operand:SWI 0 "memory_operand" "+m")
        (unspec_volatile:SWI
          [(any_logic:SWI (match_dup 0)
                          (match_operand:SWI 1 "nonmemory_operand" "<r><i>"))
           (match_operand:SI 2 "const_int_operand")]            ;; model
          UNSPECV_LOCK))
...

any_logic covers (unconditionally) covers AND IOR and XOR ops.

However, generated insn-opinit.c lacks IOR variant initalization:
...
set_direct_optab_handler (atomic_and_optab, QImode, CODE_FOR_atomic_andqi);
set_direct_optab_handler (atomic_xor_optab, QImode, CODE_FOR_atomic_xorqi);
...

So, having such simple test:
void
foo (int *p, int v)
{
  __atomic_fetch_or (p, 1, __ATOMIC_ACQUIRE | __ATOMIC_HLE_ACQUIRE);
}

`lock orl      %edx, (%eax)` wont' be generated, since there is no
corresponding occurence in IOR optab.
Here is the code, that fails to find it:
optabs.c:maybe_emit_op
...
      if (use_memmodel)
        {
          icode = direct_optab_handler (optab->mem_no_result, mode);
...

The most strange thing to me is that it works fine with XOR and AND ops.


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

end of thread, other threads:[~2012-04-17 17:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-17 16:21 [Bug target/53020] New: __atomic_fetch_or doesn't generate `1 insn` variant kirill.yukhin at intel dot com
2012-04-17 16:25 ` [Bug target/53020] " kirill.yukhin at intel dot com
2012-04-17 16:55 ` ubizjak at gmail dot com
2012-04-17 17:01 ` kirill.yukhin at intel dot com
2012-04-17 17:40 ` uros at gcc dot gnu.org
2012-04-17 17:41 ` uros at gcc dot gnu.org
2012-04-17 17:57 ` ubizjak at gmail dot com

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