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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to