; 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 ; ; INDEX (IMMEDIATES) ; define @index_ii_i8() { ; CHECK-LABEL: index_ii_i8: ; CHECK: index z0.b, #-16, #15 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv16i8(i8 -16, i8 15) ret %out } define @index_ii_i16() { ; CHECK-LABEL: index_ii_i16: ; CHECK: index z0.h, #15, #-16 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv8i16(i16 15, i16 -16) ret %out } define @index_ii_i32() { ; CHECK-LABEL: index_ii_i32: ; CHECK: index z0.s, #-16, #15 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv4i32(i32 -16, i32 15) ret %out } define @index_ii_i64() { ; CHECK-LABEL: index_ii_i64: ; CHECK: index z0.d, #15, #-16 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv2i64(i64 15, i64 -16) ret %out } define @index_ii_range() { ; CHECK-LABEL: index_ii_range: ; CHECK: mov w8, #16 ; CHECK-NEXT: mov x9, #-17 ; CHECK-NEXT: index z0.d, x9, x8 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv2i64(i64 -17, i64 16) ret %out } ; ; INDEX (IMMEDIATE, SCALAR) ; define @index_ir_i8(i8 %a) { ; CHECK-LABEL: index_ir_i8: ; CHECK: index z0.b, #15, w0 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv16i8(i8 15, i8 %a) ret %out } define @index_ir_i16(i16 %a) { ; CHECK-LABEL: index_ir_i16: ; CHECK: index z0.h, #-16, w0 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv8i16(i16 -16, i16 %a) ret %out } define @index_ir_i32(i32 %a) { ; CHECK-LABEL: index_ir_i32: ; CHECK: index z0.s, #15, w0 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv4i32(i32 15, i32 %a) ret %out } define @index_ir_i64(i64 %a) { ; CHECK-LABEL: index_ir_i64: ; CHECK: index z0.d, #-16, x0 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv2i64(i64 -16, i64 %a) ret %out } define @index_ir_range(i32 %a) { ; CHECK-LABEL: index_ir_range: ; CHECK: mov w8, #-17 ; CHECK: index z0.s, w8, w0 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv4i32(i32 -17, i32 %a) ret %out } ; ; INDEX (SCALAR, IMMEDIATE) ; define @index_ri_i8(i8 %a) { ; CHECK-LABEL: index_ri_i8: ; CHECK: index z0.b, w0, #-16 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv16i8(i8 %a, i8 -16) ret %out } define @index_ri_i16(i16 %a) { ; CHECK-LABEL: index_ri_i16: ; CHECK: index z0.h, w0, #15 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv8i16(i16 %a, i16 15) ret %out } define @index_ri_i32(i32 %a) { ; CHECK-LABEL: index_ri_i32: ; CHECK: index z0.s, w0, #-16 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv4i32(i32 %a, i32 -16) ret %out } define @index_ri_i64(i64 %a) { ; CHECK-LABEL: index_ri_i64: ; CHECK: index z0.d, x0, #15 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv2i64(i64 %a, i64 15) ret %out } define @index_ri_range(i16 %a) { ; CHECK-LABEL: index_ri_range: ; CHECK: mov w8, #16 ; CHECK: index z0.h, w0, w8 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv8i16(i16 %a, i16 16) ret %out } ; ; INDEX (SCALARS) ; define @index_rr_i8(i8 %a, i8 %b) { ; CHECK-LABEL: index_rr_i8: ; CHECK: index z0.b, w0, w1 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv16i8(i8 %a, i8 %b) ret %out } define @index_rr_i16(i16 %a, i16 %b) { ; CHECK-LABEL: index_rr_i16: ; CHECK: index z0.h, w0, w1 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv8i16(i16 %a, i16 %b) ret %out } define @index_rr_i32(i32 %a, i32 %b) { ; CHECK-LABEL: index_rr_i32: ; CHECK: index z0.s, w0, w1 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv4i32(i32 %a, i32 %b) ret %out } define @index_rr_i64(i64 %a, i64 %b) { ; CHECK-LABEL: index_rr_i64: ; CHECK: index z0.d, x0, x1 ; CHECK-NEXT: ret %out = call @llvm.aarch64.sve.index.nxv2i64(i64 %a, i64 %b) ret %out } declare @llvm.aarch64.sve.index.nxv16i8(i8, i8) declare @llvm.aarch64.sve.index.nxv8i16(i16, i16) declare @llvm.aarch64.sve.index.nxv4i32(i32, i32) declare @llvm.aarch64.sve.index.nxv2i64(i64, i64)