[llvm-bugs] [Bug 45149] New: Codegen being moved outside of volatile block

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 9 05:29:46 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45149

            Bug ID: 45149
           Summary: Codegen being moved outside of volatile block
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: andrea.dibiagio at gmail.com, craig.topper at gmail.com,
                    greg.bedwell at sony.com, llvm-bugs at lists.llvm.org,
                    matze at braunis.de, spatel+llvm at rotateright.com

https://godbolt.org/z/bo6w2F

#include <x86intrin.h>

__v16qi foo(__v16qi a, __v16qi b) {
  __asm volatile("# LLVM-MCA-BEGIN foo");
  __v16qi result = a + b;
  __asm volatile("# LLVM-MCA-END foo");
  return result;
}

I'm seeing an issue where depending on the target cpu the generated asm is
getting moved out of the volatile comment block.

clang -g0 -O3:

# %bb.0:
        #APP
        # LLVM-MCA-BEGIN foo
        #NO_APP
        paddb   %xmm1, %xmm0
        #APP
        # LLVM-MCA-END foo
        #NO_APP
        retq


clang -g0 -O3 -march=sandybridge:

# %bb.0:
        #APP
        # LLVM-MCA-BEGIN foo
        #NO_APP
        vpaddb  %xmm0, %xmm1, %xmm0
        #APP
        # LLVM-MCA-END foo
        #NO_APP
        retq


clang -g0 -O3 -march=btver2:

# %bb.0:
        vpaddb  %xmm0, %xmm1, %xmm0
        #APP
        # LLVM-MCA-BEGIN foo
        #NO_APP
        #APP
        # LLVM-MCA-END foo
        #NO_APP
        retq

which prevents llvm-mca from reporting on the code snippet.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200309/1e762cb6/attachment.html>


More information about the llvm-bugs mailing list