1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt --bpf-check-and-opt-ir -S -mtriple=bpf-pc-linux < %s | FileCheck %s
4 define void @simple_store(ptr addrspace(272) %foo) {
5 ; CHECK-LABEL: define void @simple_store(
6 ; CHECK-SAME: ptr addrspace(272) [[FOO:%.*]]) {
8 ; CHECK-NEXT: [[FOO1:%.*]] = addrspacecast ptr addrspace(272) [[FOO]] to ptr
9 ; CHECK-NEXT: [[ADD_PTR2:%.*]] = getelementptr inbounds i8, ptr [[FOO1]], i64 16
10 ; CHECK-NEXT: store volatile i32 57005, ptr [[ADD_PTR2]], align 4
11 ; CHECK-NEXT: [[ADD_PTR13:%.*]] = getelementptr inbounds i8, ptr [[FOO1]], i64 12
12 ; CHECK-NEXT: store volatile i32 48879, ptr [[ADD_PTR13]], align 4
13 ; CHECK-NEXT: ret void
16 %add.ptr = getelementptr inbounds i8, ptr addrspace(272) %foo, i64 16
17 store volatile i32 57005, ptr addrspace(272) %add.ptr, align 4
18 %add.ptr1 = getelementptr inbounds i8, ptr addrspace(272) %foo, i64 12
19 store volatile i32 48879, ptr addrspace(272) %add.ptr1, align 4
23 define void @separate_addr_store(ptr addrspace(272) %foo, ptr addrspace(272) %bar) {
24 ; CHECK-LABEL: define void @separate_addr_store(
25 ; CHECK-SAME: ptr addrspace(272) [[FOO:%.*]], ptr addrspace(272) [[BAR:%.*]]) {
27 ; CHECK-NEXT: [[BAR3:%.*]] = addrspacecast ptr addrspace(272) [[BAR]] to ptr
28 ; CHECK-NEXT: [[FOO1:%.*]] = addrspacecast ptr addrspace(272) [[FOO]] to ptr
29 ; CHECK-NEXT: [[ADD_PTR2:%.*]] = getelementptr inbounds i8, ptr [[FOO1]], i64 16
30 ; CHECK-NEXT: store volatile i32 57005, ptr [[ADD_PTR2]], align 4
31 ; CHECK-NEXT: [[ADD_PTR14:%.*]] = getelementptr inbounds i8, ptr [[BAR3]], i64 12
32 ; CHECK-NEXT: store volatile i32 48879, ptr [[ADD_PTR14]], align 4
33 ; CHECK-NEXT: ret void
36 %add.ptr = getelementptr inbounds i8, ptr addrspace(272) %foo, i64 16
37 store volatile i32 57005, ptr addrspace(272) %add.ptr, align 4
38 %add.ptr1 = getelementptr inbounds i8, ptr addrspace(272) %bar, i64 12
39 store volatile i32 48879, ptr addrspace(272) %add.ptr1, align 4
43 define i32 @simple_load(ptr addrspace(272) %foo) {
44 ; CHECK-LABEL: define i32 @simple_load(
45 ; CHECK-SAME: ptr addrspace(272) [[FOO:%.*]]) {
47 ; CHECK-NEXT: [[FOO1:%.*]] = addrspacecast ptr addrspace(272) [[FOO]] to ptr
48 ; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[FOO1]], align 4
49 ; CHECK-NEXT: ret i32 [[TMP0]]
52 %0 = load i32, ptr addrspace(272) %foo, align 4
56 define { i32, i1 } @simple_cmpxchg(ptr addrspace(1) %i) {
57 ; CHECK-LABEL: define { i32, i1 } @simple_cmpxchg(
58 ; CHECK-SAME: ptr addrspace(1) [[I:%.*]]) {
60 ; CHECK-NEXT: [[I1:%.*]] = addrspacecast ptr addrspace(1) [[I]] to ptr
61 ; CHECK-NEXT: [[A:%.*]] = cmpxchg ptr [[I1]], i32 7, i32 42 monotonic monotonic, align 4
62 ; CHECK-NEXT: ret { i32, i1 } [[A]]
65 %a = cmpxchg ptr addrspace(1) %i, i32 7, i32 42 monotonic monotonic, align 4
69 define void @simple_atomicrmw(ptr addrspace(1) %p) {
70 ; CHECK-LABEL: define void @simple_atomicrmw(
71 ; CHECK-SAME: ptr addrspace(1) [[P:%.*]]) {
72 ; CHECK-NEXT: [[P1:%.*]] = addrspacecast ptr addrspace(1) [[P]] to ptr
73 ; CHECK-NEXT: [[A:%.*]] = atomicrmw add ptr [[P1]], i64 42 monotonic, align 8
74 ; CHECK-NEXT: ret void
76 %a = atomicrmw add ptr addrspace(1) %p, i64 42 monotonic, align 8