atomic-load.ll
1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
; RUN: opt < %s -loweratomic -S | FileCheck %s
; RUN: opt < %s -passes=loweratomic -S | FileCheck %s
define i8 @add() {
; CHECK-LABEL: @add(
%i = alloca i8
%j = atomicrmw add i8* %i, i8 42 monotonic
; CHECK: [[INST:%[a-z0-9]+]] = load
; CHECK-NEXT: add
; CHECK-NEXT: store
ret i8 %j
; CHECK: ret i8 [[INST]]
}
define i8 @nand() {
; CHECK-LABEL: @nand(
%i = alloca i8
%j = atomicrmw nand i8* %i, i8 42 monotonic
; CHECK: [[INST:%[a-z0-9]+]] = load
; CHECK-NEXT: and
; CHECK-NEXT: xor
; CHECK-NEXT: store
ret i8 %j
; CHECK: ret i8 [[INST]]
}
define i8 @min() {
; CHECK-LABEL: @min(
%i = alloca i8
%j = atomicrmw min i8* %i, i8 42 monotonic
; CHECK: [[INST:%[a-z0-9]+]] = load
; CHECK-NEXT: icmp
; CHECK-NEXT: select
; CHECK-NEXT: store
ret i8 %j
; CHECK: ret i8 [[INST]]
}
define float @fadd() {
; CHECK-LABEL: @fadd(
%i = alloca float
%j = atomicrmw fadd float* %i, float 42.0 monotonic
; CHECK: [[INST:%[a-z0-9]+]] = load
; CHECK-NEXT: fadd
; CHECK-NEXT: store
ret float %j
; CHECK: ret float [[INST]]
}
define float @fsub() {
; CHECK-LABEL: @fsub(
%i = alloca float
%j = atomicrmw fsub float* %i, float 42.0 monotonic
; CHECK: [[INST:%[a-z0-9]+]] = load
; CHECK-NEXT: fsub
; CHECK-NEXT: store
ret float %j
; CHECK: ret float [[INST]]
}