• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -loweratomic -S | FileCheck %s
2; RUN: opt < %s -passes=loweratomic -S | FileCheck %s
3
4define i8 @add() {
5; CHECK-LABEL: @add(
6  %i = alloca i8
7  %j = atomicrmw add i8* %i, i8 42 monotonic
8; CHECK: [[INST:%[a-z0-9]+]] = load
9; CHECK-NEXT: add
10; CHECK-NEXT: store
11  ret i8 %j
12; CHECK: ret i8 [[INST]]
13}
14
15define i8 @nand() {
16; CHECK-LABEL: @nand(
17  %i = alloca i8
18  %j = atomicrmw nand i8* %i, i8 42 monotonic
19; CHECK: [[INST:%[a-z0-9]+]] = load
20; CHECK-NEXT: and
21; CHECK-NEXT: xor
22; CHECK-NEXT: store
23  ret i8 %j
24; CHECK: ret i8 [[INST]]
25}
26
27define i8 @min() {
28; CHECK-LABEL: @min(
29  %i = alloca i8
30  %j = atomicrmw min i8* %i, i8 42 monotonic
31; CHECK: [[INST:%[a-z0-9]+]] = load
32; CHECK-NEXT: icmp
33; CHECK-NEXT: select
34; CHECK-NEXT: store
35  ret i8 %j
36; CHECK: ret i8 [[INST]]
37}
38