1; Test basic address sanitizer instrumentation.
2;
3; RUN: opt < %s -hwasan -S | FileCheck %s
4
5target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
6target triple = "aarch64--linux-android"
7
8define void @atomicrmw(i64* %ptr) sanitize_hwaddress {
9; CHECK-LABEL: @atomicrmw(
10; CHECK: lshr i64 %[[A:[^ ]*]], 56
11; CHECK: call void asm sideeffect "brk #2323", "{x0}"(i64 %[[A]])
12; CHECK: atomicrmw add i64* %ptr, i64 1 seq_cst
13; CHECK: ret void
14
15entry:
16  %0 = atomicrmw add i64* %ptr, i64 1 seq_cst
17  ret void
18}
19
20define void @cmpxchg(i64* %ptr, i64 %compare_to, i64 %new_value) sanitize_hwaddress {
21; CHECK-LABEL: @cmpxchg(
22; CHECK: lshr i64 %[[A:[^ ]*]], 56
23; CHECK: call void asm sideeffect "brk #2323", "{x0}"(i64 %[[A]])
24; CHECK: cmpxchg i64* %ptr, i64 %compare_to, i64 %new_value seq_cst seq_cst
25; CHECK: ret void
26
27entry:
28  %0 = cmpxchg i64* %ptr, i64 %compare_to, i64 %new_value seq_cst seq_cst
29  ret void
30}
31