llvm-mirror/test/Verifier/atomics.ll
JF Bastien 4730f05bb8 Polish atomic pointers
Summary:
I didn't realize that we already allowed atomic load/store of pointers,
it was added in 2012 by r162146. This patch updates the documentation
and tightens the verifier by using DataLayout to make sure that the
stored size is byte-sized and power-of-two. DataLayout is also used for
integers, and while I'm here I updated the corresponding code for
cmpxchg and rmw.

See the following discussion for context and upcoming changes to
add floating-point and vector atomics:
  https://groups.google.com/forum/#!topic/llvm-dev/Nh0P_E3CRoo/discussion

Reviewers: reames

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D15512

llvm-svn: 255931
2015-12-17 22:09:19 +00:00

15 lines
442 B
LLVM

; RUN: not opt -verify < %s 2>&1 | FileCheck %s
; CHECK: atomic store operand must have integer, pointer, or floating point type!
; CHECK: atomic load operand must have integer, pointer, or floating point type!
define void @foo(x86_mmx* %P, x86_mmx %v) {
store atomic x86_mmx %v, x86_mmx* %P unordered, align 8
ret void
}
define x86_mmx @bar(x86_mmx* %P) {
%v = load atomic x86_mmx, x86_mmx* %P unordered, align 8
ret x86_mmx %v
}