mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
ab043ff680
Essentially the same as the GEP change in r230786. A similar migration script can be used to update test cases, though a few more test case improvements/changes were required this time around: (r229269-r229278) import fileinput import sys import re pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)") for line in sys.stdin: sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line)) Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7649 llvm-svn: 230794
29 lines
943 B
LLVM
29 lines
943 B
LLVM
; RUN: opt < %s -loweratomic -S | FileCheck %s
|
|
|
|
define i8 @cmpswap() {
|
|
; CHECK-LABEL: @cmpswap(
|
|
%i = alloca i8
|
|
%pair = cmpxchg i8* %i, i8 0, i8 42 monotonic monotonic
|
|
%j = extractvalue { i8, i1 } %pair, 0
|
|
; CHECK: [[OLDVAL:%[a-z0-9]+]] = load i8, i8* [[ADDR:%[a-z0-9]+]]
|
|
; CHECK-NEXT: [[SAME:%[a-z0-9]+]] = icmp eq i8 [[OLDVAL]], 0
|
|
; CHECK-NEXT: [[TO_STORE:%[a-z0-9]+]] = select i1 [[SAME]], i8 42, i8 [[OLDVAL]]
|
|
; CHECK-NEXT: store i8 [[TO_STORE]], i8* [[ADDR]]
|
|
; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = insertvalue { i8, i1 } undef, i8 [[OLDVAL]], 0
|
|
; CHECK-NEXT: [[RES:%[a-z0-9]+]] = insertvalue { i8, i1 } [[TMP]], i1 [[SAME]], 1
|
|
; CHECK-NEXT: [[VAL:%[a-z0-9]+]] = extractvalue { i8, i1 } [[RES]], 0
|
|
ret i8 %j
|
|
; CHECK: ret i8 [[VAL]]
|
|
}
|
|
|
|
|
|
define i8 @swap() {
|
|
; CHECK-LABEL: @swap(
|
|
%i = alloca i8
|
|
%j = atomicrmw xchg i8* %i, i8 42 monotonic
|
|
; CHECK: [[INST:%[a-z0-9]+]] = load
|
|
; CHECK-NEXT: store
|
|
ret i8 %j
|
|
; CHECK: ret i8 [[INST]]
|
|
}
|