membarrier.ll 557 Bytes
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-- -mattr=-sse -O0 | FileCheck %s
; PR9675

define i32 @t() {
; CHECK-LABEL: t:
; CHECK:       # %bb.0:
; CHECK-NEXT:    xorl %eax, %eax
; CHECK-NEXT:    movl $1, -{{[0-9]+}}(%rsp)
; CHECK-NEXT:    mfence
; CHECK-NEXT:    lock decl -{{[0-9]+}}(%rsp)
; CHECK-NEXT:    mfence
; CHECK-NEXT:    retq
  %i = alloca i32, align 4
  store i32 1, i32* %i, align 4
  fence seq_cst
  %t0 = atomicrmw sub i32* %i, i32 1 monotonic
  fence seq_cst
  ret i32 0
}