; RUN: llc -mtriple=aarch64--linux-gnu -mattr=+sve --asm-verbose=false < %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 ; Range checks: for all the instruction tested in this file, the ; immediate must be within the range [-8, 7] (4-bit immediate). Out of ; range values are tested only in one case (following). Valid values ; are tested all through the rest of the file. define void @imm_out_of_range( * %base, %mask) nounwind { ; CHECK-LABEL: imm_out_of_range: ; CHECK-NEXT: rdvl x8, #8 ; CHECK-NEXT: add x8, x0, x8 ; CHECK-NEXT: ldnt1d { z[[DATA:[0-9]+]].d }, p0/z, [x{{[0-9]+}}] ; CHECK-NEXT: rdvl x8, #-9 ; CHECK-NEXT: add x8, x0, x8 ; CHECK-NEXT: stnt1d { z[[DATA]].d }, p0, [x{{[0-9]+}}] ; CHECK-NEXT: ret %base_load = getelementptr , * %base, i64 8 %base_load_bc = bitcast * %base_load to i64* %data = call @llvm.aarch64.sve.ldnt1.nxv2i64( %mask, i64* %base_load_bc) %base_store = getelementptr , * %base, i64 -9 %base_store_bc = bitcast * %base_store to i64* call void @llvm.aarch64.sve.stnt1.nxv2i64( %data, %mask, i64* %base_store_bc) ret void } ; 2-lane non-temporal load/stores define void @test_masked_ldst_sv2i64( * %base, %mask) nounwind { ; CHECK-LABEL: test_masked_ldst_sv2i64: ; CHECK-NEXT: ldnt1d { z[[DATA:[0-9]+]].d }, p0/z, [x0, #-8, mul vl] ; CHECK-NEXT: stnt1d { z[[DATA]].d }, p0, [x0, #-7, mul vl] ; CHECK-NEXT: ret %base_load = getelementptr , * %base, i64 -8 %base_load_bc = bitcast * %base_load to i64* %data = call @llvm.aarch64.sve.ldnt1.nxv2i64( %mask, i64* %base_load_bc) %base_store = getelementptr , * %base, i64 -7 %base_store_bc = bitcast * %base_store to i64* call void @llvm.aarch64.sve.stnt1.nxv2i64( %data, %mask, i64* %base_store_bc) ret void } define void @test_masked_ldst_sv2f64( * %base, %mask) nounwind { ; CHECK-LABEL: test_masked_ldst_sv2f64: ; CHECK-NEXT: ldnt1d { z[[DATA:[0-9]+]].d }, p0/z, [x0, #-6, mul vl] ; CHECK-NEXT: stnt1d { z[[DATA]].d }, p0, [x0, #-5, mul vl] ; CHECK-NEXT: ret %base_load = getelementptr , * %base, i64 -6 %base_load_bc = bitcast * %base_load to double* %data = call @llvm.aarch64.sve.ldnt1.nxv2f64( %mask, double* %base_load_bc) %base_store = getelementptr , * %base, i64 -5 %base_store_bc = bitcast * %base_store to double* call void @llvm.aarch64.sve.stnt1.nxv2f64( %data, %mask, double* %base_store_bc) ret void } ; 4-lane non-temporal load/stores. define void @test_masked_ldst_sv4i32( * %base, %mask) nounwind { ; CHECK-LABEL: test_masked_ldst_sv4i32: ; CHECK-NEXT: ldnt1w { z[[DATA:[0-9]+]].s }, p0/z, [x0, #6, mul vl] ; CHECK-NEXT: stnt1w { z[[DATA]].s }, p0, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_load = getelementptr , * %base, i64 6 %base_load_bc = bitcast * %base_load to i32* %data = call @llvm.aarch64.sve.ldnt1.nxv4i32( %mask, i32* %base_load_bc) %base_store = getelementptr , * %base, i64 7 %base_store_bc = bitcast * %base_store to i32* call void @llvm.aarch64.sve.stnt1.nxv4i32( %data, %mask, i32* %base_store_bc) ret void } define void @test_masked_ldst_sv4f32( * %base, %mask) nounwind { ; CHECK-LABEL: test_masked_ldst_sv4f32: ; CHECK-NEXT: ldnt1w { z[[DATA:[0-9]+]].s }, p0/z, [x0, #-1, mul vl] ; CHECK-NEXT: stnt1w { z[[DATA]].s }, p0, [x0, #2, mul vl] ; CHECK-NEXT: ret %base_load = getelementptr , * %base, i64 -1 %base_load_bc = bitcast * %base_load to float* %data = call @llvm.aarch64.sve.ldnt1.nxv4f32( %mask, float* %base_load_bc) %base_store = getelementptr , * %base, i64 2 %base_store_bc = bitcast * %base_store to float* call void @llvm.aarch64.sve.stnt1.nxv4f32( %data, %mask, float* %base_store_bc) ret void } ; 8-lane non-temporal load/stores. define void @test_masked_ldst_sv8i16( * %base, %mask) nounwind { ; CHECK-LABEL: test_masked_ldst_sv8i16: ; CHECK-NEXT: ldnt1h { z[[DATA:[0-9]+]].h }, p0/z, [x0, #6, mul vl] ; CHECK-NEXT: stnt1h { z[[DATA]].h }, p0, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_load = getelementptr , * %base, i64 6 %base_load_bc = bitcast * %base_load to i16* %data = call @llvm.aarch64.sve.ldnt1.nxv8i16( %mask, i16* %base_load_bc) %base_store = getelementptr , * %base, i64 7 %base_store_bc = bitcast * %base_store to i16* call void @llvm.aarch64.sve.stnt1.nxv8i16( %data, %mask, i16* %base_store_bc) ret void } define void @test_masked_ldst_sv8f16( * %base, %mask) nounwind { ; CHECK-LABEL: test_masked_ldst_sv8f16: ; CHECK-NEXT: ldnt1h { z[[DATA:[0-9]+]].h }, p0/z, [x0, #-1, mul vl] ; CHECK-NEXT: stnt1h { z[[DATA]].h }, p0, [x0, #2, mul vl] ; CHECK-NEXT: ret %base_load = getelementptr , * %base, i64 -1 %base_load_bc = bitcast * %base_load to half* %data = call @llvm.aarch64.sve.ldnt1.nxv8f16( %mask, half* %base_load_bc) %base_store = getelementptr , * %base, i64 2 %base_store_bc = bitcast * %base_store to half* call void @llvm.aarch64.sve.stnt1.nxv8f16( %data, %mask, half* %base_store_bc) ret void } define void @test_masked_ldst_sv8bf16( * %base, %mask) nounwind #0 { ; CHECK-LABEL: test_masked_ldst_sv8bf16: ; CHECK-NEXT: ldnt1h { z[[DATA:[0-9]+]].h }, p0/z, [x0, #-1, mul vl] ; CHECK-NEXT: stnt1h { z[[DATA]].h }, p0, [x0, #2, mul vl] ; CHECK-NEXT: ret %base_load = getelementptr , * %base, i64 -1 %base_load_bc = bitcast * %base_load to bfloat* %data = call @llvm.aarch64.sve.ldnt1.nxv8bf16( %mask, bfloat* %base_load_bc) %base_store = getelementptr , * %base, i64 2 %base_store_bc = bitcast * %base_store to bfloat* call void @llvm.aarch64.sve.stnt1.nxv8bf16( %data, %mask, bfloat* %base_store_bc) ret void } ; 16-lane non-temporal load/stores. define void @test_masked_ldst_sv16i8( * %base, %mask) nounwind { ; CHECK-LABEL: test_masked_ldst_sv16i8: ; CHECK-NEXT: ldnt1b { z[[DATA:[0-9]+]].b }, p0/z, [x0, #6, mul vl] ; CHECK-NEXT: stnt1b { z[[DATA]].b }, p0, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_load = getelementptr , * %base, i64 6 %base_load_bc = bitcast * %base_load to i8* %data = call @llvm.aarch64.sve.ldnt1.nxv16i8( %mask, i8* %base_load_bc) %base_store = getelementptr , * %base, i64 7 %base_store_bc = bitcast * %base_store to i8* call void @llvm.aarch64.sve.stnt1.nxv16i8( %data, %mask, i8* %base_store_bc) ret void } ; 2-element non-temporal loads. declare @llvm.aarch64.sve.ldnt1.nxv2i64(, i64*) declare @llvm.aarch64.sve.ldnt1.nxv2f64(, double*) ; 4-element non-temporal loads. declare @llvm.aarch64.sve.ldnt1.nxv4i32(, i32*) declare @llvm.aarch64.sve.ldnt1.nxv4f32(, float*) ; 8-element non-temporal loads. declare @llvm.aarch64.sve.ldnt1.nxv8i16(, i16*) declare @llvm.aarch64.sve.ldnt1.nxv8f16(, half*) declare @llvm.aarch64.sve.ldnt1.nxv8bf16(, bfloat*) ; 16-element non-temporal loads. declare @llvm.aarch64.sve.ldnt1.nxv16i8(, i8*) ; 2-element non-temporal stores. declare void @llvm.aarch64.sve.stnt1.nxv2i64(, , i64*) declare void @llvm.aarch64.sve.stnt1.nxv2f64(, , double*) ; 4-element non-temporal stores. declare void @llvm.aarch64.sve.stnt1.nxv4i32(, , i32*) declare void @llvm.aarch64.sve.stnt1.nxv4f32(, , float*) ; 8-element non-temporal stores. declare void @llvm.aarch64.sve.stnt1.nxv8i16(, , i16*) declare void @llvm.aarch64.sve.stnt1.nxv8f16(, , half*) declare void @llvm.aarch64.sve.stnt1.nxv8bf16(, , bfloat*) ; 16-element non-temporal stores. declare void @llvm.aarch64.sve.stnt1.nxv16i8(, , i8*) ; +bf16 is required for the bfloat version. attributes #0 = { "target-features"="+sve,+bf16" }