1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s | FileCheck %s
3 ; RUN: llc --fast-isel < %s | FileCheck %s
4 ; RUN: llc --global-isel --global-isel-abort=2 < %s | FileCheck %s
6 ; Source to regenerate:
10 ; __attribute__((address_space(9))) int *p_other;
12 ; extern "C" void use_foo(Foo *f);
13 ; extern "C" int use_int(int i);
14 ; extern "C" void test_sign_ext(Foo *f, int * __ptr32 __sptr i) {
18 ; extern "C" void test_sign_ext_store_load(int * __ptr32 __sptr i) {
21 ; extern "C" void test_zero_ext(Foo *f, int * __ptr32 __uptr i) {
25 ; extern "C" void test_zero_ext_store_load(int * __ptr32 __uptr i) {
28 ; extern "C" void test_trunc(Foo *f, int * __ptr64 i) {
32 ; extern "C" void test_noop1(Foo *f, int * __ptr32 i) {
36 ; extern "C" void test_noop2(Foo *f, int * __ptr64 i) {
40 ; extern "C" void test_null_arg(Foo *f, int * __ptr32 i) {
43 ; extern "C" void test_unrecognized(Foo *f, __attribute__((address_space(14))) int *i) {
44 ; f->p32 = (int * __ptr32)i;
48 ; $ clang --target=aarch64-windows-msvc -fms-extensions -O2 -S -emit-llvm t.cpp
50 target datalayout = "e-m:w-p:64:64-i32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32"
51 target triple = "aarch64-unknown-windows-msvc"
53 ; Function Attrs: mustprogress uwtable
54 define dso_local void @test_sign_ext(ptr noundef %f, ptr addrspace(270) noundef %i) local_unnamed_addr #0 {
55 ; CHECK-LABEL: test_sign_ext:
56 ; CHECK: // %bb.0: // %entry
57 ; CHECK-NEXT: // kill: def $w1 killed $w1 def $x1
58 ; CHECK-NEXT: sxtw x8, w1
59 ; CHECK-NEXT: str x8, [x0, #8]
60 ; CHECK-NEXT: b use_foo
62 %0 = addrspacecast ptr addrspace(270) %i to ptr
63 %p64 = getelementptr inbounds nuw i8, ptr %f, i64 8
64 store ptr %0, ptr %p64, align 8
65 tail call void @use_foo(ptr noundef %f)
69 declare dso_local void @use_foo(ptr noundef) local_unnamed_addr #1
71 ; Function Attrs: mustprogress uwtable
72 define dso_local void @test_sign_ext_store_load(ptr addrspace(270) nocapture noundef %i) local_unnamed_addr #0 {
73 ; CHECK-LABEL: test_sign_ext_store_load:
74 ; CHECK: // %bb.0: // %entry
76 ; CHECK-NEXT: ldr w0, [x19]
77 ; CHECK-NEXT: bl use_int
78 ; CHECK-NEXT: str w0, [x19]
80 %0 = load i32, ptr addrspace(270) %i, align 4
81 %call = tail call i32 @use_int(i32 noundef %0)
82 store i32 %call, ptr addrspace(270) %i, align 4
86 declare dso_local i32 @use_int(i32 noundef) local_unnamed_addr #1
88 ; Function Attrs: mustprogress uwtable
89 define dso_local void @test_zero_ext(ptr noundef %f, ptr addrspace(271) noundef %i) local_unnamed_addr #0 {
90 ; CHECK-LABEL: test_zero_ext:
91 ; CHECK: // %bb.0: // %entry
92 ; CHECK-NEXT: mov w8, w1
93 ; CHECK-NEXT: str x8, [x0, #8]
94 ; CHECK-NEXT: b use_foo
96 %0 = addrspacecast ptr addrspace(271) %i to ptr
97 %p64 = getelementptr inbounds nuw i8, ptr %f, i64 8
98 store ptr %0, ptr %p64, align 8
99 tail call void @use_foo(ptr noundef %f)
103 ; Function Attrs: mustprogress uwtable
104 define dso_local void @test_zero_ext_store_load(ptr addrspace(271) nocapture noundef %i) local_unnamed_addr #0 {
105 ; CHECK-LABEL: test_zero_ext_store_load:
106 ; CHECK: // %bb.0: // %entry
108 ; CHECK-NEXT: ldr w0, [x19]
109 ; CHECK-NEXT: bl use_int
110 ; CHECK-NEXT: str w0, [x19]
112 %0 = load i32, ptr addrspace(271) %i, align 4
113 %call = tail call i32 @use_int(i32 noundef %0)
114 store i32 %call, ptr addrspace(271) %i, align 4
118 ; Function Attrs: mustprogress uwtable
119 define dso_local void @test_trunc(ptr noundef %f, ptr noundef %i) local_unnamed_addr #0 {
120 ; CHECK-LABEL: test_trunc:
121 ; CHECK: // %bb.0: // %entry
122 ; CHECK-NEXT: str w1, [x0]
123 ; CHECK-NEXT: b use_foo
125 %0 = addrspacecast ptr %i to ptr addrspace(270)
126 store ptr addrspace(270) %0, ptr %f, align 8
127 tail call void @use_foo(ptr noundef nonnull %f)
131 ; Function Attrs: mustprogress uwtable
132 define dso_local void @test_noop1(ptr noundef %f, ptr addrspace(270) noundef %i) local_unnamed_addr #0 {
133 ; CHECK-LABEL: test_noop1:
134 ; CHECK: // %bb.0: // %entry
135 ; CHECK-NEXT: str w1, [x0]
136 ; CHECK-NEXT: b use_foo
138 store ptr addrspace(270) %i, ptr %f, align 8
139 tail call void @use_foo(ptr noundef nonnull %f)
143 ; Function Attrs: mustprogress uwtable
144 define dso_local void @test_noop2(ptr noundef %f, ptr noundef %i) local_unnamed_addr #0 {
145 ; CHECK-LABEL: test_noop2:
146 ; CHECK: // %bb.0: // %entry
147 ; CHECK-NEXT: str x1, [x0, #8]
148 ; CHECK-NEXT: b use_foo
150 %p64 = getelementptr inbounds nuw i8, ptr %f, i64 8
151 store ptr %i, ptr %p64, align 8
152 tail call void @use_foo(ptr noundef %f)
156 ; Function Attrs: mustprogress uwtable
157 define dso_local void @test_null_arg(ptr noundef %f, ptr addrspace(270) nocapture noundef readnone %i) local_unnamed_addr #0 {
158 ; CHECK-LABEL: test_null_arg:
159 ; CHECK: // %bb.0: // %entry
160 ; CHECK-NEXT: str wzr, [x0]
161 ; CHECK-NEXT: b use_foo
163 store ptr addrspace(270) null, ptr %f, align 8
164 tail call void @use_foo(ptr noundef nonnull %f)
168 ; Function Attrs: mustprogress uwtable
169 define dso_local void @test_unrecognized(ptr noundef %f, ptr addrspace(14) noundef %i) local_unnamed_addr #0 {
170 ; CHECK-LABEL: test_unrecognized:
171 ; CHECK: // %bb.0: // %entry
172 ; CHECK-NEXT: str w1, [x0]
173 ; CHECK-NEXT: b use_foo
175 %0 = addrspacecast ptr addrspace(14) %i to ptr addrspace(270)
176 store ptr addrspace(270) %0, ptr %f, align 8
177 tail call void @use_foo(ptr noundef nonnull %f)
181 attributes #0 = { mustprogress uwtable "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+fp-armv8,+neon,+v8a,-fmv" }
182 attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+fp-armv8,+neon,+v8a,-fmv" }