; RUN: llc -mtriple=aarch64--linux-gnu -mattr=+sve -asm-verbose=0 < %s 2>%t | FileCheck %s ; RUN: FileCheck --check-prefix=WARN --allow-empty %s <%t ; If this check fails please read test/CodeGen/AArch64/README for instructions on how to resolve it. ; WARN-NOT: warning ; ; Masked Loads ; define @masked_load_nxv2i64( *%a, %mask) nounwind { ; CHECK-LABEL: masked_load_nxv2i64: ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.masked.load.nxv2i64( *%a, i32 8, %mask, undef) ret %load } define @masked_load_nxv4i32( *%a, %mask) nounwind { ; CHECK-LABEL: masked_load_nxv4i32: ; CHECK-NEXT: ld1w { z0.s }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.masked.load.nxv4i32( *%a, i32 4, %mask, undef) ret %load } define @masked_load_nxv8i16( *%a, %mask) nounwind { ; CHECK-LABEL: masked_load_nxv8i16: ; CHECK-NEXT: ld1h { z0.h }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.masked.load.nxv8i16( *%a, i32 2, %mask, undef) ret %load } define @masked_load_nxv16i8( *%a, %mask) nounwind { ; CHECK-LABEL: masked_load_nxv16i8: ; CHECK-NEXT: ld1b { z0.b }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.masked.load.nxv16i8( *%a, i32 1, %mask, undef) ret %load } define @masked_load_nxv2f64( *%a, %mask) nounwind { ; CHECK-LABEL: masked_load_nxv2f64: ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.masked.load.nxv2f64( *%a, i32 8, %mask, undef) ret %load } define @masked_load_nxv2f32( *%a, %mask) nounwind { ; CHECK-LABEL: masked_load_nxv2f32: ; CHECK-NEXT: ld1w { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.masked.load.nxv2f32( *%a, i32 4, %mask, undef) ret %load } define @masked_load_nxv2f16( *%a, %mask) nounwind { ; CHECK-LABEL: masked_load_nxv2f16: ; CHECK-NEXT: ld1h { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.masked.load.nxv2f16( *%a, i32 2, %mask, undef) ret %load } define @masked_load_nxv4f32( *%a, %mask) nounwind { ; CHECK-LABEL: masked_load_nxv4f32: ; CHECK-NEXT: ld1w { z0.s }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.masked.load.nxv4f32( *%a, i32 4, %mask, undef) ret %load } define @masked_load_nxv4f16( *%a, %mask) nounwind { ; CHECK-LABEL: masked_load_nxv4f16: ; CHECK-NEXT: ld1h { z0.s }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.masked.load.nxv4f16( *%a, i32 2, %mask, undef) ret %load } define @masked_load_nxv8f16( *%a, %mask) nounwind { ; CHECK-LABEL: masked_load_nxv8f16: ; CHECK-NEXT: ld1h { z0.h }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.masked.load.nxv8f16( *%a, i32 2, %mask, undef) ret %load } define @masked_load_nxv8bf16( *%a, %mask) nounwind #0 { ; CHECK-LABEL: masked_load_nxv8bf16: ; CHECK-NEXT: ld1h { z0.h }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.masked.load.nxv8bf16( *%a, i32 2, %mask, undef) ret %load } ; ; Masked Stores ; define void @masked_store_nxv2i64( *%a, %val, %mask) nounwind { ; CHECK-LABEL: masked_store_nxv2i64: ; CHECK-NEXT: st1d { z0.d }, p0, [x0] ; CHECK-NEXT: ret call void @llvm.masked.store.nxv2i64( %val, *%a, i32 8, %mask) ret void } define void @masked_store_nxv4i32( *%a, %val, %mask) nounwind { ; CHECK-LABEL: masked_store_nxv4i32: ; CHECK-NEXT: st1w { z0.s }, p0, [x0] ; CHECK-NEXT: ret call void @llvm.masked.store.nxv4i32( %val, *%a, i32 4, %mask) ret void } define void @masked_store_nxv8i16( *%a, %val, %mask) nounwind { ; CHECK-LABEL: masked_store_nxv8i16: ; CHECK-NEXT: st1h { z0.h }, p0, [x0] ; CHECK-NEXT: ret call void @llvm.masked.store.nxv8i16( %val, *%a, i32 2, %mask) ret void } define void @masked_store_nxv16i8( *%a, %val, %mask) nounwind { ; CHECK-LABEL: masked_store_nxv16i8: ; CHECK-NEXT: st1b { z0.b }, p0, [x0] ; CHECK-NEXT: ret call void @llvm.masked.store.nxv16i8( %val, *%a, i32 1, %mask) ret void } define void @masked_store_nxv2f64( *%a, %val, %mask) nounwind { ; CHECK-LABEL: masked_store_nxv2f64: ; CHECK-NEXT: st1d { z0.d }, p0, [x0] ; CHECK-NEXT: ret call void @llvm.masked.store.nxv2f64( %val, *%a, i32 8, %mask) ret void } define void @masked_store_nxv2f32( *%a, %val, %mask) nounwind { ; CHECK-LABEL: masked_store_nxv2f32: ; CHECK-NEXT: st1w { z0.d }, p0, [x0] ; CHECK-NEXT: ret call void @llvm.masked.store.nxv2f32( %val, *%a, i32 4, %mask) ret void } define void @masked_store_nxv2f16( *%a, %val, %mask) nounwind { ; CHECK-LABEL: masked_store_nxv2f16: ; CHECK-NEXT: st1h { z0.d }, p0, [x0] ; CHECK-NEXT: ret call void @llvm.masked.store.nxv2f16( %val, *%a, i32 4, %mask) ret void } define void @masked_store_nxv4f32( *%a, %val, %mask) nounwind { ; CHECK-LABEL: masked_store_nxv4f32: ; CHECK-NEXT: st1w { z0.s }, p0, [x0] ; CHECK-NEXT: ret call void @llvm.masked.store.nxv4f32( %val, *%a, i32 4, %mask) ret void } define void @masked_store_nxv4f16( *%a, %val, %mask) nounwind { ; CHECK-LABEL: masked_store_nxv4f16: ; CHECK-NEXT: st1h { z0.s }, p0, [x0] ; CHECK-NEXT: ret call void @llvm.masked.store.nxv4f16( %val, *%a, i32 2, %mask) ret void } define void @masked_store_nxv8f16( *%a, %val, %mask) nounwind { ; CHECK-LABEL: masked_store_nxv8f16: ; CHECK-NEXT: st1h { z0.h }, p0, [x0] ; CHECK-NEXT: ret call void @llvm.masked.store.nxv8f16( %val, *%a, i32 2, %mask) ret void } define void @masked_store_nxv8bf16( *%a, %val, %mask) nounwind #0 { ; CHECK-LABEL: masked_store_nxv8bf16: ; CHECK-NEXT: st1h { z0.h }, p0, [x0] ; CHECK-NEXT: ret call void @llvm.masked.store.nxv8bf16( %val, *%a, i32 2, %mask) ret void } ; ; Masked load store of pointer data type ; ; Pointer of integer type define @masked.load.nxv2p0i8(* %vector_ptr, %mask) nounwind { ; CHECK-LABEL: masked.load.nxv2p0i8: ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %v = call @llvm.masked.load.nxv2p0i8.p0nxv2p0i8(* %vector_ptr, i32 8, %mask, undef) ret %v } define @masked.load.nxv2p0i16(* %vector_ptr, %mask) nounwind { ; CHECK-LABEL: masked.load.nxv2p0i16: ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %v = call @llvm.masked.load.nxv2p0i16.p0nxv2p0i16(* %vector_ptr, i32 8, %mask, undef) ret %v } define @masked.load.nxv2p0i32(* %vector_ptr, %mask) nounwind { ; CHECK-LABEL: masked.load.nxv2p0i32: ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %v = call @llvm.masked.load.nxv2p0i32.p0nxv2p0i32(* %vector_ptr, i32 8, %mask, undef) ret %v } define @masked.load.nxv2p0i64(* %vector_ptr, %mask) nounwind { ; CHECK-LABEL: masked.load.nxv2p0i64: ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %v = call @llvm.masked.load.nxv2p0i64.p0nxv2p0i64(* %vector_ptr, i32 8, %mask, undef) ret %v } ; Pointer of floating-point type define @masked.load.nxv2p0bf16(* %vector_ptr, %mask) nounwind #0 { ; CHECK-LABEL: masked.load.nxv2p0bf16: ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %v = call @llvm.masked.load.nxv2p0bf16.p0nxv2p0bf16(* %vector_ptr, i32 8, %mask, undef) ret %v } define @masked.load.nxv2p0f16(* %vector_ptr, %mask) nounwind { ; CHECK-LABEL: masked.load.nxv2p0f16: ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %v = call @llvm.masked.load.nxv2p0f16.p0nxv2p0f16(* %vector_ptr, i32 8, %mask, undef) ret %v } define @masked.load.nxv2p0f32(* %vector_ptr, %mask) nounwind { ; CHECK-LABEL: masked.load.nxv2p0f32: ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %v = call @llvm.masked.load.nxv2p0f32.p0nxv2p0f32(* %vector_ptr, i32 8, %mask, undef) ret %v } define @masked.load.nxv2p0f64(* %vector_ptr, %mask) nounwind { ; CHECK-LABEL: masked.load.nxv2p0f64: ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %v = call @llvm.masked.load.nxv2p0f64.p0nxv2p0f64(* %vector_ptr, i32 8, %mask, undef) ret %v } ; Pointer of array type define void @masked.store.nxv2p0a64i16( %data, * %vector_ptr, %mask) nounwind { ; CHECK-LABEL: masked.store.nxv2p0a64i16: ; CHECK-NEXT: st1d { z0.d }, p0, [x0] ; CHECK-NEXT: ret call void @llvm.masked.store.nxv2p0a64i16.p0nxv2p0a64i16( %data, * %vector_ptr, i32 8, %mask) ret void } ; Pointer of struct type %struct = type { i8*, i32 } define void @masked.store.nxv2p0s_struct( %data, * %vector_ptr, %mask) nounwind { ; CHECK-LABEL: masked.store.nxv2p0s_struct: ; CHECK-NEXT: st1d { z0.d }, p0, [x0] ; CHECK-NEXT: ret call void @llvm.masked.store.nxv2p0s_struct.p0nxv2p0s_struct( %data, * %vector_ptr, i32 8, %mask) ret void } declare @llvm.masked.load.nxv2i64(*, i32, , ) declare @llvm.masked.load.nxv4i32(*, i32, , ) declare @llvm.masked.load.nxv8i16(*, i32, , ) declare @llvm.masked.load.nxv16i8(*, i32, , ) declare @llvm.masked.load.nxv2f64(*, i32, , ) declare @llvm.masked.load.nxv2f32(*, i32, , ) declare @llvm.masked.load.nxv2f16(*, i32, , ) declare @llvm.masked.load.nxv4f32(*, i32, , ) declare @llvm.masked.load.nxv4f16(*, i32, , ) declare @llvm.masked.load.nxv8f16(*, i32, , ) declare @llvm.masked.load.nxv8bf16(*, i32, , ) declare void @llvm.masked.store.nxv2i64(, *, i32, ) declare void @llvm.masked.store.nxv4i32(, *, i32, ) declare void @llvm.masked.store.nxv8i16(, *, i32, ) declare void @llvm.masked.store.nxv16i8(, *, i32, ) declare void @llvm.masked.store.nxv2f64(, *, i32, ) declare void @llvm.masked.store.nxv2f32(, *, i32, ) declare void @llvm.masked.store.nxv2f16(, *, i32, ) declare void @llvm.masked.store.nxv4f32(, *, i32, ) declare void @llvm.masked.store.nxv4f16(, *, i32, ) declare void @llvm.masked.store.nxv8f16(, *, i32, ) declare void @llvm.masked.store.nxv8bf16(, *, i32, ) declare @llvm.masked.load.nxv2p0i8.p0nxv2p0i8(*, i32 immarg, , ) declare @llvm.masked.load.nxv2p0i16.p0nxv2p0i16(*, i32 immarg, , ) declare @llvm.masked.load.nxv2p0i32.p0nxv2p0i32(*, i32 immarg, , ) declare @llvm.masked.load.nxv2p0i64.p0nxv2p0i64(*, i32 immarg, , ) declare @llvm.masked.load.nxv2p0bf16.p0nxv2p0bf16(*, i32 immarg, , ) declare @llvm.masked.load.nxv2p0f16.p0nxv2p0f16(*, i32 immarg, , ) declare @llvm.masked.load.nxv2p0f32.p0nxv2p0f32(*, i32 immarg, , ) declare @llvm.masked.load.nxv2p0f64.p0nxv2p0f64(*, i32 immarg, , ) declare void @llvm.masked.store.nxv2p0a64i16.p0nxv2p0a64i16(, *, i32 immarg, ) declare void @llvm.masked.store.nxv2p0s_struct.p0nxv2p0s_struct(, *, i32 immarg, ) ; +bf16 is required for the bfloat version. attributes #0 = { "target-features"="+sve,+bf16" }