1; RUN: llc -mattr=avr6 < %s -march=avr | FileCheck %s
2
3; CHECK-LABEL: atomic_swap8
4; CHECK: call __sync_lock_test_and_set_1
5define i8 @atomic_swap8(i8* %foo) {
6  %val = atomicrmw xchg i8* %foo, i8 13 seq_cst
7  ret i8 %val
8}
9
10; CHECK-LABEL: atomic_swap16
11; CHECK: call __sync_lock_test_and_set_2
12define i16 @atomic_swap16(i16* %foo) {
13  %val = atomicrmw xchg i16* %foo, i16 13 seq_cst
14  ret i16 %val
15}
16
17; CHECK-LABEL: atomic_swap32
18; CHECK: call __sync_lock_test_and_set_4
19define i32 @atomic_swap32(i32* %foo) {
20  %val = atomicrmw xchg i32* %foo, i32 13 seq_cst
21  ret i32 %val
22}
23
24; CHECK-LABEL: atomic_swap64
25; CHECK: call __sync_lock_test_and_set_8
26define i64 @atomic_swap64(i64* %foo) {
27  %val = atomicrmw xchg i64* %foo, i64 13 seq_cst
28  ret i64 %val
29}
30
31