[LLVMbugs] [Bug 14314] New: Codegen for atomicrmw sub i64 is broken for x86-32

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Nov 10 17:14:21 PST 2012


             Bug #: 14314
           Summary: Codegen for atomicrmw sub i64 is broken for x86-32
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: tjablin at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 9522
  --> http://llvm.org/bugs/attachment.cgi?id=9522

The following program should should print -1.

#include <stdio.h>
#include <stdint.h>

int64_t atomicSub(int64_t *a, int64_t b) {
  return __sync_fetch_and_sub(a, b);

int main(int argc, char **argv) {
  int64_t a = 0;
  atomicSub(&a, 1);
  printf("a = %lli\n", a);
  return 0;

clang on x86-64 and gcc on all architectures compile the program correctly.
clang on x86-32 prints 1. The last working revision of clang was 164820. The
bug first appears in 164821 after a checkin from Michael Liao titled, "Re-work
X86 code generation of atomic ops with spin-loop."

I have attached LLVM IR for the test case. The LLVM IR is generated correctly
in both 164820 and 164821.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list