; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %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 testing for the immediate in the reg+imm(mulvl) addressing ; mode is done only for one instruction. The rest of the instrucions ; test only one immediate value in bound. define @ldnf1b( %pg, i8* %a) { ; CHECK-LABEL: ldnf1b: ; CHECK: ldnf1b { z0.b }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv16i8( %pg, i8* %a) ret %load } define @ldnf1b_out_of_lower_bound( %pg, i8* %a) { ; CHECK-LABEL: ldnf1b_out_of_lower_bound: ; CHECK: rdvl x[[OFFSET:[0-9]+]], #-9 ; CHECK-NEXT: add x[[BASE:[0-9]+]], x0, x[[OFFSET]] ; CHECK-NEXT: ldnf1b { z0.b }, p0/z, [x[[BASE]]] ; CHECK-NEXT: ret %base_scalable = bitcast i8* %a to * %base = getelementptr , * %base_scalable, i64 -9 %base_scalar = bitcast * %base to i8* %load = call @llvm.aarch64.sve.ldnf1.nxv16i8( %pg, i8* %base_scalar) ret %load } define @ldnf1b_lower_bound( %pg, i8* %a) { ; CHECK-LABEL: ldnf1b_lower_bound: ; CHECK: ldnf1b { z0.b }, p0/z, [x0, #-8, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i8* %a to * %base = getelementptr , * %base_scalable, i64 -8 %base_scalar = bitcast * %base to i8* %load = call @llvm.aarch64.sve.ldnf1.nxv16i8( %pg, i8* %base_scalar) ret %load } define @ldnf1b_inbound( %pg, i8* %a) { ; CHECK-LABEL: ldnf1b_inbound: ; CHECK: ldnf1b { z0.b }, p0/z, [x0, #1, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i8* %a to * %base = getelementptr , * %base_scalable, i64 1 %base_scalar = bitcast * %base to i8* %load = call @llvm.aarch64.sve.ldnf1.nxv16i8( %pg, i8* %base_scalar) ret %load } define @ldnf1b_upper_bound( %pg, i8* %a) { ; CHECK-LABEL: ldnf1b_upper_bound: ; CHECK: ldnf1b { z0.b }, p0/z, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i8* %a to * %base = getelementptr , * %base_scalable, i64 7 %base_scalar = bitcast * %base to i8* %load = call @llvm.aarch64.sve.ldnf1.nxv16i8( %pg, i8* %base_scalar) ret %load } define @ldnf1b_out_of_upper_bound( %pg, i8* %a) { ; CHECK-LABEL: ldnf1b_out_of_upper_bound: ; CHECK: rdvl x[[OFFSET:[0-9]+]], #8 ; CHECK-NEXT: add x[[BASE:[0-9]+]], x0, x[[OFFSET]] ; CHECK-NEXT: ldnf1b { z0.b }, p0/z, [x[[BASE]]] ; CHECK-NEXT: ret %base_scalable = bitcast i8* %a to * %base = getelementptr , * %base_scalable, i64 8 %base_scalar = bitcast * %base to i8* %load = call @llvm.aarch64.sve.ldnf1.nxv16i8( %pg, i8* %base_scalar) ret %load } define @ldnf1b_h( %pg, i8* %a) { ; CHECK-LABEL: ldnf1b_h: ; CHECK: ldnf1b { z0.h }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv8i8( %pg, i8* %a) %res = zext %load to ret %res } define @ldnf1b_h_inbound( %pg, i8* %a) { ; CHECK-LABEL: ldnf1b_h_inbound: ; CHECK: ldnf1b { z0.h }, p0/z, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i8* %a to * %base = getelementptr , * %base_scalable, i64 7 %base_scalar = bitcast * %base to i8* %load = call @llvm.aarch64.sve.ldnf1.nxv8i8( %pg, i8* %base_scalar) %res = zext %load to ret %res } define @ldnf1sb_h( %pg, i8* %a) { ; CHECK-LABEL: ldnf1sb_h: ; CHECK: ldnf1sb { z0.h }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv8i8( %pg, i8* %a) %res = sext %load to ret %res } define @ldnf1sb_h_inbound( %pg, i8* %a) { ; CHECK-LABEL: ldnf1sb_h_inbound: ; CHECK: ldnf1sb { z0.h }, p0/z, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i8* %a to * %base = getelementptr , * %base_scalable, i64 7 %base_scalar = bitcast * %base to i8* %load = call @llvm.aarch64.sve.ldnf1.nxv8i8( %pg, i8* %base_scalar) %res = sext %load to ret %res } define @ldnf1h( %pg, i16* %a) { ; CHECK-LABEL: ldnf1h: ; CHECK: ldnf1h { z0.h }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv8i16( %pg, i16* %a) ret %load } define @ldnf1h_inbound( %pg, i16* %a) { ; CHECK-LABEL: ldnf1h_inbound: ; CHECK: ldnf1h { z0.h }, p0/z, [x0, #1, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i16* %a to * %base = getelementptr , * %base_scalable, i64 1 %base_scalar = bitcast * %base to i16* %load = call @llvm.aarch64.sve.ldnf1.nxv8i16( %pg, i16* %base_scalar) ret %load } define @ldnf1h_f16( %pg, half* %a) { ; CHECK-LABEL: ldnf1h_f16: ; CHECK: ldnf1h { z0.h }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv8f16( %pg, half* %a) ret %load } define @ldnf1h_bf16( %pg, bfloat* %a) #0 { ; CHECK-LABEL: ldnf1h_bf16: ; CHECK: ldnf1h { z0.h }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv8bf16( %pg, bfloat* %a) ret %load } define @ldnf1h_f16_inbound( %pg, half* %a) { ; CHECK-LABEL: ldnf1h_f16_inbound: ; CHECK: ldnf1h { z0.h }, p0/z, [x0, #1, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast half* %a to * %base = getelementptr , * %base_scalable, i64 1 %base_scalar = bitcast * %base to half* %load = call @llvm.aarch64.sve.ldnf1.nxv8f16( %pg, half* %base_scalar) ret %load } define @ldnf1h_bf16_inbound( %pg, bfloat* %a) #0 { ; CHECK-LABEL: ldnf1h_bf16_inbound: ; CHECK: ldnf1h { z0.h }, p0/z, [x0, #1, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast bfloat* %a to * %base = getelementptr , * %base_scalable, i64 1 %base_scalar = bitcast * %base to bfloat* %load = call @llvm.aarch64.sve.ldnf1.nxv8bf16( %pg, bfloat* %base_scalar) ret %load } define @ldnf1b_s( %pg, i8* %a) { ; CHECK-LABEL: ldnf1b_s: ; CHECK: ldnf1b { z0.s }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv4i8( %pg, i8* %a) %res = zext %load to ret %res } define @ldnf1b_s_inbound( %pg, i8* %a) { ; CHECK-LABEL: ldnf1b_s_inbound: ; CHECK: ldnf1b { z0.s }, p0/z, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i8* %a to * %base = getelementptr , * %base_scalable, i64 7 %base_scalar = bitcast * %base to i8* %load = call @llvm.aarch64.sve.ldnf1.nxv4i8( %pg, i8* %base_scalar) %res = zext %load to ret %res } define @ldnf1sb_s( %pg, i8* %a) { ; CHECK-LABEL: ldnf1sb_s: ; CHECK: ldnf1sb { z0.s }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv4i8( %pg, i8* %a) %res = sext %load to ret %res } define @ldnf1sb_s_inbound( %pg, i8* %a) { ; CHECK-LABEL: ldnf1sb_s_inbound: ; CHECK: ldnf1sb { z0.s }, p0/z, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i8* %a to * %base = getelementptr , * %base_scalable, i64 7 %base_scalar = bitcast * %base to i8* %load = call @llvm.aarch64.sve.ldnf1.nxv4i8( %pg, i8* %base_scalar) %res = sext %load to ret %res } define @ldnf1h_s( %pg, i16* %a) { ; CHECK-LABEL: ldnf1h_s: ; CHECK: ldnf1h { z0.s }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv4i16( %pg, i16* %a) %res = zext %load to ret %res } define @ldnf1h_s_inbound( %pg, i16* %a) { ; CHECK-LABEL: ldnf1h_s_inbound: ; CHECK: ldnf1h { z0.s }, p0/z, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i16* %a to * %base = getelementptr , * %base_scalable, i64 7 %base_scalar = bitcast * %base to i16* %load = call @llvm.aarch64.sve.ldnf1.nxv4i16( %pg, i16* %base_scalar) %res = zext %load to ret %res } define @ldnf1sh_s( %pg, i16* %a) { ; CHECK-LABEL: ldnf1sh_s: ; CHECK: ldnf1sh { z0.s }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv4i16( %pg, i16* %a) %res = sext %load to ret %res } define @ldnf1sh_s_inbound( %pg, i16* %a) { ; CHECK-LABEL: ldnf1sh_s_inbound: ; CHECK: ldnf1sh { z0.s }, p0/z, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i16* %a to * %base = getelementptr , * %base_scalable, i64 7 %base_scalar = bitcast * %base to i16* %load = call @llvm.aarch64.sve.ldnf1.nxv4i16( %pg, i16* %base_scalar) %res = sext %load to ret %res } define @ldnf1w( %pg, i32* %a) { ; CHECK-LABEL: ldnf1w: ; CHECK: ldnf1w { z0.s }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv4i32( %pg, i32* %a) ret %load } define @ldnf1w_inbound( %pg, i32* %a) { ; CHECK-LABEL: ldnf1w_inbound: ; CHECK: ldnf1w { z0.s }, p0/z, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i32* %a to * %base = getelementptr , * %base_scalable, i64 7 %base_scalar = bitcast * %base to i32* %load = call @llvm.aarch64.sve.ldnf1.nxv4i32( %pg, i32* %base_scalar) ret %load } define @ldnf1w_f32( %pg, float* %a) { ; CHECK-LABEL: ldnf1w_f32: ; CHECK: ldnf1w { z0.s }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv4f32( %pg, float* %a) ret %load } define @ldnf1w_f32_inbound( %pg, float* %a) { ; CHECK-LABEL: ldnf1w_f32_inbound: ; CHECK: ldnf1w { z0.s }, p0/z, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast float* %a to * %base = getelementptr , * %base_scalable, i64 7 %base_scalar = bitcast * %base to float* %load = call @llvm.aarch64.sve.ldnf1.nxv4f32( %pg, float* %base_scalar) ret %load } define @ldnf1b_d( %pg, i8* %a) { ; CHECK-LABEL: ldnf1b_d: ; CHECK: ldnf1b { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv2i8( %pg, i8* %a) %res = zext %load to ret %res } define @ldnf1b_d_inbound( %pg, i8* %a) { ; CHECK-LABEL: ldnf1b_d_inbound: ; CHECK: ldnf1b { z0.d }, p0/z, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i8* %a to * %base = getelementptr , * %base_scalable, i64 7 %base_scalar = bitcast * %base to i8* %load = call @llvm.aarch64.sve.ldnf1.nxv2i8( %pg, i8* %base_scalar) %res = zext %load to ret %res } define @ldnf1sb_d( %pg, i8* %a) { ; CHECK-LABEL: ldnf1sb_d: ; CHECK: ldnf1sb { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv2i8( %pg, i8* %a) %res = sext %load to ret %res } define @ldnf1sb_d_inbound( %pg, i8* %a) { ; CHECK-LABEL: ldnf1sb_d_inbound: ; CHECK: ldnf1sb { z0.d }, p0/z, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i8* %a to * %base = getelementptr , * %base_scalable, i64 7 %base_scalar = bitcast * %base to i8* %load = call @llvm.aarch64.sve.ldnf1.nxv2i8( %pg, i8* %base_scalar) %res = sext %load to ret %res } define @ldnf1h_d( %pg, i16* %a) { ; CHECK-LABEL: ldnf1h_d: ; CHECK: ldnf1h { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv2i16( %pg, i16* %a) %res = zext %load to ret %res } define @ldnf1h_d_inbound( %pg, i16* %a) { ; CHECK-LABEL: ldnf1h_d_inbound: ; CHECK: ldnf1h { z0.d }, p0/z, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i16* %a to * %base = getelementptr , * %base_scalable, i64 7 %base_scalar = bitcast * %base to i16* %load = call @llvm.aarch64.sve.ldnf1.nxv2i16( %pg, i16* %base_scalar) %res = zext %load to ret %res } define @ldnf1sh_d( %pg, i16* %a) { ; CHECK-LABEL: ldnf1sh_d: ; CHECK: ldnf1sh { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv2i16( %pg, i16* %a) %res = sext %load to ret %res } define @ldnf1sh_d_inbound( %pg, i16* %a) { ; CHECK-LABEL: ldnf1sh_d_inbound: ; CHECK: ldnf1sh { z0.d }, p0/z, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i16* %a to * %base = getelementptr , * %base_scalable, i64 7 %base_scalar = bitcast * %base to i16* %load = call @llvm.aarch64.sve.ldnf1.nxv2i16( %pg, i16* %base_scalar) %res = sext %load to ret %res } define @ldnf1w_d( %pg, i32* %a) { ; CHECK-LABEL: ldnf1w_d: ; CHECK: ldnf1w { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv2i32( %pg, i32* %a) %res = zext %load to ret %res } define @ldnf1w_d_inbound( %pg, i32* %a) { ; CHECK-LABEL: ldnf1w_d_inbound: ; CHECK: ldnf1w { z0.d }, p0/z, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i32* %a to * %base = getelementptr , * %base_scalable, i64 7 %base_scalar = bitcast * %base to i32* %load = call @llvm.aarch64.sve.ldnf1.nxv2i32( %pg, i32* %base_scalar) %res = zext %load to ret %res } define @ldnf1sw_d( %pg, i32* %a) { ; CHECK-LABEL: ldnf1sw_d: ; CHECK: ldnf1sw { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv2i32( %pg, i32* %a) %res = sext %load to ret %res } define @ldnf1sw_d_inbound( %pg, i32* %a) { ; CHECK-LABEL: ldnf1sw_d_inbound: ; CHECK: ldnf1sw { z0.d }, p0/z, [x0, #7, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i32* %a to * %base = getelementptr , * %base_scalable, i64 7 %base_scalar = bitcast * %base to i32* %load = call @llvm.aarch64.sve.ldnf1.nxv2i32( %pg, i32* %base_scalar) %res = sext %load to ret %res } define @ldnf1d( %pg, i64* %a) { ; CHECK-LABEL: ldnf1d: ; CHECK: ldnf1d { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv2i64( %pg, i64* %a) ret %load } define @ldnf1d_inbound( %pg, i64* %a) { ; CHECK-LABEL: ldnf1d_inbound: ; CHECK: ldnf1d { z0.d }, p0/z, [x0, #1, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast i64* %a to * %base = getelementptr , * %base_scalable, i64 1 %base_scalar = bitcast * %base to i64* %load = call @llvm.aarch64.sve.ldnf1.nxv2i64( %pg, i64* %base_scalar) ret %load } define @ldnf1d_f64( %pg, double* %a) { ; CHECK-LABEL: ldnf1d_f64: ; CHECK: ldnf1d { z0.d }, p0/z, [x0] ; CHECK-NEXT: ret %load = call @llvm.aarch64.sve.ldnf1.nxv2f64( %pg, double* %a) ret %load } define @ldnf1d_f64_inbound( %pg, double* %a) { ; CHECK-LABEL: ldnf1d_f64_inbound: ; CHECK: ldnf1d { z0.d }, p0/z, [x0, #1, mul vl] ; CHECK-NEXT: ret %base_scalable = bitcast double* %a to * %base = getelementptr , * %base_scalable, i64 1 %base_scalar = bitcast * %base to double* %load = call @llvm.aarch64.sve.ldnf1.nxv2f64( %pg, double* %base_scalar) ret %load } declare @llvm.aarch64.sve.ldnf1.nxv16i8(, i8*) declare @llvm.aarch64.sve.ldnf1.nxv8i8(, i8*) declare @llvm.aarch64.sve.ldnf1.nxv8i16(, i16*) declare @llvm.aarch64.sve.ldnf1.nxv8f16(, half*) declare @llvm.aarch64.sve.ldnf1.nxv8bf16(, bfloat*) declare @llvm.aarch64.sve.ldnf1.nxv4i8(, i8*) declare @llvm.aarch64.sve.ldnf1.nxv4i16(, i16*) declare @llvm.aarch64.sve.ldnf1.nxv4i32(, i32*) declare @llvm.aarch64.sve.ldnf1.nxv4f32(, float*) declare @llvm.aarch64.sve.ldnf1.nxv2i8(, i8*) declare @llvm.aarch64.sve.ldnf1.nxv2i16(, i16*) declare @llvm.aarch64.sve.ldnf1.nxv2i32(, i32*) declare @llvm.aarch64.sve.ldnf1.nxv2i64(, i64*) declare @llvm.aarch64.sve.ldnf1.nxv2f64(, double*) ; +bf16 is required for the bfloat version. attributes #0 = { "target-features"="+sve,+bf16" }