1 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fms-extensions %s -emit-llvm -o - | FileCheck %s
2
test1(long * p)3 long test1(long *p) {
4 return _InterlockedIncrement(p);
5 }
6 // CHECK-DAG: define i64 @test1(
7 // CHECK: %[[p_addr:.*]] = alloca i64*, align 8
8 // CHECK: store i64* %p, i64** %[[p_addr]], align 8
9 // CHECK: %[[p_load:.*]] = load i64*, i64** %[[p_addr]], align 8
10 // CHECK: %[[atomic_add:.*]] = atomicrmw volatile add i64* %[[p_load]], i64 1 seq_cst
11 // CHECK: %[[res:.*]] = add i64 %[[atomic_add]], 1
12 // CHECK: ret i64 %[[res]]
13
test2(long * p)14 long test2(long *p) {
15 return _InterlockedDecrement(p);
16 }
17 // CHECK-DAG: define i64 @test2(
18 // CHECK: %[[p_addr:.*]] = alloca i64*, align 8
19 // CHECK: store i64* %p, i64** %[[p_addr]], align 8
20 // CHECK: %[[p_load:.*]] = load i64*, i64** %[[p_addr]], align 8
21 // CHECK: %[[atomic_sub:.*]] = atomicrmw volatile sub i64* %[[p_load]], i64 1 seq_cst
22 // CHECK: %[[res:.*]] = sub i64 %[[atomic_sub]], 1
23 // CHECK: ret i64 %[[res]]
24