[llvm-bugs] [Bug 34625] New: -mtune when targeting AArch64 can incorrectly affect the architecture version code is generated for

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 15 07:34:10 PDT 2017


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

            Bug ID: 34625
           Summary: -mtune when targeting AArch64 can incorrectly affect
                    the architecture version code is generated for
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: AArch64
          Assignee: unassignedbugs at nondot.org
          Reporter: kristof.beyls at arm.com
                CC: llvm-bugs at lists.llvm.org

$ cat t.c
int f(int *a, int b, int c) {
  return __sync_val_compare_and_swap (a, b, c);
}

# cas[al] is an instruction introduced in armv8.1, so with the below command
line, generation of the cas instruction is OK (-march=armv8.1a):
$ clang -target aarch64-linux-gnu -march=armv8.1a -S t.c -O2 -o- | grep cas
        casal   w1, w2, [x0]

# thunderx2t99 is a cpu implementing armv8.1a, so generation of the cas
instruction is OK in the below command line (mcpu=thunderx2t99):
$ clang -target aarch64-linux-gnu -mcpu=thunderx2t99 -march=armv8a -S t.c -O2
-o- | grep cas
        casal   w1, w2, [x0]

# mtune shouldn't affect the architecture version targeted, so in the below
command line (march=armv8a mtune=thunderx2t99), the cas instruction should not
have been generated:
$ clang -target aarch64-linux-gnu -mtune=thunderx2t99 -march=armv8a -S t.c -O2
-o- | grep cas
        casal   w1, w2, [x0]

-- 
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/20170915/d037459b/attachment.html>


More information about the llvm-bugs mailing list