1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
4 ; Test that DAGCombiner doesn't drop the scalable flag when it tries to fold:
5 ; extract_subv (bitcast X), Index --> bitcast (extract_subv X, Index')
6 define <vscale x 16 x i8> @extract_nxv16i8_nxv4i64(<vscale x 4 x i64> %z0_z1) {
7 ; CHECK-LABEL: extract_nxv16i8_nxv4i64:
9 ; CHECK-NEXT: mov z0.d, z1.d
11 %z0_z1_bc = bitcast <vscale x 4 x i64> %z0_z1 to <vscale x 32 x i8>
12 %ext = call <vscale x 16 x i8> @llvm.aarch64.sve.tuple.get.nxv32i8(<vscale x 32 x i8> %z0_z1_bc, i32 1)
13 ret <vscale x 16 x i8> %ext
17 define <vscale x 2 x i64> @extract_nxv2i64_nxv32i8(<vscale x 32 x i8> %z0_z1) {
18 ; CHECK-LABEL: extract_nxv2i64_nxv32i8:
20 ; CHECK-NEXT: mov z0.d, z1.d
22 %z0_z1_bc = bitcast <vscale x 32 x i8> %z0_z1 to <vscale x 4 x i64>
23 %ext = call <vscale x 2 x i64> @llvm.aarch64.sve.tuple.get.nxv4i64(<vscale x 4 x i64> %z0_z1_bc, i32 1)
24 ret <vscale x 2 x i64> %ext
27 define <vscale x 4 x half> @extract_lo_nxv4f16_nxv8f16(<vscale x 8 x half> %z0) {
28 ; CHECK-LABEL: extract_lo_nxv4f16_nxv8f16:
30 ; CHECK-NEXT: uunpklo z0.s, z0.h
32 %ext = call <vscale x 4 x half> @llvm.aarch64.sve.tuple.get.nxv8f16(<vscale x 8 x half> %z0, i32 0)
33 ret <vscale x 4 x half> %ext
36 define <vscale x 4 x half> @extract_hi_nxv4f16_nxv8f16(<vscale x 8 x half> %z0) {
37 ; CHECK-LABEL: extract_hi_nxv4f16_nxv8f16:
39 ; CHECK-NEXT: uunpkhi z0.s, z0.h
41 %ext = call <vscale x 4 x half> @llvm.aarch64.sve.tuple.get.nxv8f16(<vscale x 8 x half> %z0, i32 1)
42 ret <vscale x 4 x half> %ext
45 define <vscale x 2 x float> @extract_lo_nxv2f32_nxv4f32(<vscale x 4 x float> %z0) {
46 ; CHECK-LABEL: extract_lo_nxv2f32_nxv4f32:
48 ; CHECK-NEXT: uunpklo z0.d, z0.s
50 %ext = call <vscale x 2 x float> @llvm.aarch64.sve.tuple.get.nxv4f32(<vscale x 4 x float> %z0, i32 0)
51 ret <vscale x 2 x float> %ext
54 define <vscale x 2 x float> @extract_hi_nxv2f32_nxv4f32(<vscale x 4 x float> %z0) {
55 ; CHECK-LABEL: extract_hi_nxv2f32_nxv4f32:
57 ; CHECK-NEXT: uunpkhi z0.d, z0.s
59 %ext = call <vscale x 2 x float> @llvm.aarch64.sve.tuple.get.nxv4f32(<vscale x 4 x float> %z0, i32 1)
60 ret <vscale x 2 x float> %ext
63 define <vscale x 4 x float> @load_extract_nxv4f32_nxv8f32(<vscale x 8 x float>* %p) {
64 ; CHECK-LABEL: load_extract_nxv4f32_nxv8f32:
66 ; CHECK-NEXT: ptrue p0.s
67 ; CHECK-NEXT: ld1w { z0.s }, p0/z, [x0, #1, mul vl]
69 %tmp1 = load <vscale x 8 x float>, <vscale x 8 x float>* %p, align 16
70 %tmp2 = call <vscale x 4 x float> @llvm.aarch64.sve.tuple.get.nxv8f32(<vscale x 8 x float> %tmp1, i32 1)
71 ret <vscale x 4 x float> %tmp2
74 declare <vscale x 2 x i64> @llvm.aarch64.sve.tuple.get.nxv4i64(<vscale x 4 x i64>, i32)
75 declare <vscale x 16 x i8> @llvm.aarch64.sve.tuple.get.nxv32i8(<vscale x 32 x i8>, i32)
76 declare <vscale x 2 x float> @llvm.aarch64.sve.tuple.get.nxv4f32(<vscale x 4 x float>, i32)
77 declare <vscale x 4 x half> @llvm.aarch64.sve.tuple.get.nxv8f16(<vscale x 8 x half>, i32)
78 declare <vscale x 4 x float> @llvm.aarch64.sve.tuple.get.nxv8f32(<vscale x 8 x float>, i32)