183 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s | FileCheck %s3; RUN: llc --fast-isel < %s | FileCheck %s4; RUN: llc --global-isel --global-isel-abort=2 < %s | FileCheck %s5 6; Source to regenerate:7; struct Foo {8; int * __ptr32 p32;9; int * __ptr64 p64;10; __attribute__((address_space(9))) int *p_other;11; };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) {15; f->p64 = i;16; use_foo(f);17; }18; extern "C" void test_sign_ext_store_load(int * __ptr32 __sptr i) {19; *i = use_int(*i);20; }21; extern "C" void test_zero_ext(Foo *f, int * __ptr32 __uptr i) {22; f->p64 = i;23; use_foo(f);24; }25; extern "C" void test_zero_ext_store_load(int * __ptr32 __uptr i) {26; *i = use_int(*i);27; }28; extern "C" void test_trunc(Foo *f, int * __ptr64 i) {29; f->p32 = i;30; use_foo(f);31; }32; extern "C" void test_noop1(Foo *f, int * __ptr32 i) {33; f->p32 = i;34; use_foo(f);35; }36; extern "C" void test_noop2(Foo *f, int * __ptr64 i) {37; f->p64 = i;38; use_foo(f);39; }40; extern "C" void test_null_arg(Foo *f, int * __ptr32 i) {41; test_noop1(f, 0);42; }43; extern "C" void test_unrecognized(Foo *f, __attribute__((address_space(14))) int *i) {44; f->p32 = (int * __ptr32)i;45; use_foo(f);46; }47;48; $ clang --target=aarch64-windows-msvc -fms-extensions -O2 -S -emit-llvm t.cpp49 50target 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"51target triple = "aarch64-unknown-windows-msvc"52 53; Function Attrs: mustprogress uwtable54define 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: // %entry57; CHECK-NEXT: // kill: def $w1 killed $w1 def $x158; CHECK-NEXT: sxtw x8, w159; CHECK-NEXT: str x8, [x0, #8]60; CHECK-NEXT: b use_foo61entry:62 %0 = addrspacecast ptr addrspace(270) %i to ptr63 %p64 = getelementptr inbounds nuw i8, ptr %f, i64 864 store ptr %0, ptr %p64, align 865 tail call void @use_foo(ptr noundef %f)66 ret void67}68 69declare dso_local void @use_foo(ptr noundef) local_unnamed_addr #170 71; Function Attrs: mustprogress uwtable72define 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: // %entry75; CHECK: sxtw x19, w076; CHECK-NEXT: ldr w0, [x19]77; CHECK-NEXT: bl use_int78; CHECK-NEXT: str w0, [x19]79entry:80 %0 = load i32, ptr addrspace(270) %i, align 481 %call = tail call i32 @use_int(i32 noundef %0)82 store i32 %call, ptr addrspace(270) %i, align 483 ret void84}85 86declare dso_local i32 @use_int(i32 noundef) local_unnamed_addr #187 88; Function Attrs: mustprogress uwtable89define 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: // %entry92; CHECK-NEXT: mov w8, w193; CHECK-NEXT: str x8, [x0, #8]94; CHECK-NEXT: b use_foo95entry:96 %0 = addrspacecast ptr addrspace(271) %i to ptr97 %p64 = getelementptr inbounds nuw i8, ptr %f, i64 898 store ptr %0, ptr %p64, align 899 tail call void @use_foo(ptr noundef %f)100 ret void101}102 103; Function Attrs: mustprogress uwtable104define 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: // %entry107; CHECK: mov w19, w0108; CHECK-NEXT: ldr w0, [x19]109; CHECK-NEXT: bl use_int110; CHECK-NEXT: str w0, [x19]111entry:112 %0 = load i32, ptr addrspace(271) %i, align 4113 %call = tail call i32 @use_int(i32 noundef %0)114 store i32 %call, ptr addrspace(271) %i, align 4115 ret void116}117 118; Function Attrs: mustprogress uwtable119define dso_local void @test_trunc(ptr noundef %f, ptr noundef %i) local_unnamed_addr #0 {120; CHECK-LABEL: test_trunc:121; CHECK: // %bb.0: // %entry122; CHECK-NEXT: str w1, [x0]123; CHECK-NEXT: b use_foo124entry:125 %0 = addrspacecast ptr %i to ptr addrspace(270)126 store ptr addrspace(270) %0, ptr %f, align 8127 tail call void @use_foo(ptr noundef nonnull %f)128 ret void129}130 131; Function Attrs: mustprogress uwtable132define 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: // %entry135; CHECK-NEXT: str w1, [x0]136; CHECK-NEXT: b use_foo137entry:138 store ptr addrspace(270) %i, ptr %f, align 8139 tail call void @use_foo(ptr noundef nonnull %f)140 ret void141}142 143; Function Attrs: mustprogress uwtable144define dso_local void @test_noop2(ptr noundef %f, ptr noundef %i) local_unnamed_addr #0 {145; CHECK-LABEL: test_noop2:146; CHECK: // %bb.0: // %entry147; CHECK-NEXT: str x1, [x0, #8]148; CHECK-NEXT: b use_foo149entry:150 %p64 = getelementptr inbounds nuw i8, ptr %f, i64 8151 store ptr %i, ptr %p64, align 8152 tail call void @use_foo(ptr noundef %f)153 ret void154}155 156; Function Attrs: mustprogress uwtable157define 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: // %entry160; CHECK-NEXT: str wzr, [x0]161; CHECK-NEXT: b use_foo162entry:163 store ptr addrspace(270) null, ptr %f, align 8164 tail call void @use_foo(ptr noundef nonnull %f)165 ret void166}167 168; Function Attrs: mustprogress uwtable169define 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: // %entry172; CHECK-NEXT: str w1, [x0]173; CHECK-NEXT: b use_foo174entry:175 %0 = addrspacecast ptr addrspace(14) %i to ptr addrspace(270)176 store ptr addrspace(270) %0, ptr %f, align 8177 tail call void @use_foo(ptr noundef nonnull %f)178 ret void179}180 181attributes #0 = { mustprogress uwtable "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+fp-armv8,+neon,+v8a,-fmv" }182attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+fp-armv8,+neon,+v8a,-fmv" }183