1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
|
; RUN: llc -mtriple aarch64 -mattr=+sve -asm-verbose=0 < %s | FileCheck %s
; All these tests create a vector tuple, insert z5 into one of the elements,
; and finally extracts that element from the wide vector to return it. These
; checks ensure that z5 is always the value that is returned.
;
; Insert into two element tuples
;
; tuple: { tuple2.res0, tuple2.res1 }
; insert z5: { z5 , tuple2.res1 }
; extract z5: ^^
define <vscale x 4 x i32> @set_tuple2_nxv8i32_elt0(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1,
<vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3,
<vscale x 4 x i32> %z4, <vscale x 4 x i32> %z5) #0 {
; CHECK-LABEL: set_tuple2_nxv8i32_elt0:
; CHECK-NEXT: mov z0.d, z5.d
; CHECK-NEXT: ret
%tuple = call <vscale x 8 x i32> @llvm.aarch64.sve.tuple.create2.nxv8i32.nxv4i32(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1)
%ins = call <vscale x 8 x i32> @llvm.aarch64.sve.tuple.set.nxv8i32.nxv4i32(<vscale x 8 x i32> %tuple, i32 0, <vscale x 4 x i32> %z5)
%ext = call <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv8i32(<vscale x 8 x i32> %ins, i32 0)
ret <vscale x 4 x i32> %ext
}
; tuple: { tuple2.res0, tuple2.res1 }
; insert z5: { tuple2.res0, z5 }
; extract z5: ^^
define <vscale x 4 x i32> @set_tuple2_nxv8i32_elt1(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1,
<vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3,
<vscale x 4 x i32> %z4, <vscale x 4 x i32> %z5) #0 {
; CHECK-LABEL: set_tuple2_nxv8i32_elt1:
; CHECK-NEXT: mov z0.d, z5.d
; CHECK-NEXT: ret
%tuple = call <vscale x 8 x i32> @llvm.aarch64.sve.tuple.create2.nxv8i32.nxv4i32(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1)
%ins = call <vscale x 8 x i32> @llvm.aarch64.sve.tuple.set.nxv8i32.nxv4i32(<vscale x 8 x i32> %tuple, i32 1, <vscale x 4 x i32> %z5)
%ext = call <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv8i32(<vscale x 8 x i32> %ins, i32 1)
ret <vscale x 4 x i32> %ext
}
; This test checks the elements _not_ being set aren't changed.
; tuple: { tuple2.res0, tuple2.res1 }
; insert z5: { tuple2.res0, z5 }
; extract z0: ^^
define <vscale x 4 x i32> @set_tuple2_nxv8i32_elt1_ret_elt0(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1,
<vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3,
<vscale x 4 x i32> %z4, <vscale x 4 x i32> %z5) #0 {
; CHECK-LABEL: set_tuple2_nxv8i32_elt1_ret_elt0:
; CHECK-NEXT: ret
%tuple = call <vscale x 8 x i32> @llvm.aarch64.sve.tuple.create2.nxv8i32.nxv4i32(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1)
%ins = call <vscale x 8 x i32> @llvm.aarch64.sve.tuple.set.nxv8i32.nxv4i32(<vscale x 8 x i32> %tuple, i32 1, <vscale x 4 x i32> %z5)
%ext = call <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv8i32(<vscale x 8 x i32> %ins, i32 0)
ret <vscale x 4 x i32> %ext
}
; Test extract of tuple passed into function
define <vscale x 4 x i32> @get_tuple2_nxv8i32_elt1(<vscale x 8 x i32> %tuple) #0 {
; CHECK-LABEL: get_tuple2_nxv8i32_elt1:
; CHECK-NEXT: mov z0.d, z1.d
; CHECK-NEXT: ret
%ext = call <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv8i32(<vscale x 8 x i32> %tuple, i32 1)
ret <vscale x 4 x i32> %ext
}
;
; Insert into three element tuples
;
; tuple: { tuple3.res0, tuple3.res1, tuple3.res2 }
; insert z5: { z5 , tuple3.res0, tuple3.res2 }
; extract z5: ^^
define <vscale x 4 x i32> @set_tuple3_nxv12i32_elt0(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1,
<vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3,
<vscale x 4 x i32> %z4, <vscale x 4 x i32> %z5) #0 {
; CHECK-LABEL: set_tuple3_nxv12i32_elt0:
; CHECK-NEXT: mov z0.d, z5.d
; CHECK-NEXT: ret
%tuple = call <vscale x 12 x i32> @llvm.aarch64.sve.tuple.create3.nxv12i32.nxv4i32(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1, <vscale x 4 x i32> %z2)
%ins = call <vscale x 12 x i32> @llvm.aarch64.sve.tuple.set.nxv12i32.nxv4i32(<vscale x 12 x i32> %tuple, i32 0, <vscale x 4 x i32> %z5)
%ext = call <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv12i32(<vscale x 12 x i32> %ins, i32 0)
ret <vscale x 4 x i32> %ext
}
; tuple: { tuple3.res0, tuple3.res1, tuple3.res2 }
; insert z5: { tuple3.res0, z5 , tuple3.res2 }
; extract z5: ^^
define <vscale x 4 x i32> @set_tuple3_nxv12i32_elt1(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1,
<vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3,
<vscale x 4 x i32> %z4, <vscale x 4 x i32> %z5) #0 {
; CHECK-LABEL: set_tuple3_nxv12i32_elt1:
; CHECK-NEXT: mov z0.d, z5.d
; CHECK-NEXT: ret
%tuple = call <vscale x 12 x i32> @llvm.aarch64.sve.tuple.create3.nxv12i32.nxv4i32(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1, <vscale x 4 x i32> %z2)
%ins = call <vscale x 12 x i32> @llvm.aarch64.sve.tuple.set.nxv12i32.nxv4i32(<vscale x 12 x i32> %tuple, i32 1, <vscale x 4 x i32> %z5)
%ext = call <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv12i32(<vscale x 12 x i32> %ins, i32 1)
ret <vscale x 4 x i32> %ext
}
; tuple: { tuple3.res0, tuple3.res1, tuple3.res2 }
; insert z5: { tuple3.res0, tuple3.res1, z5 }
; extract z5: ^^
define <vscale x 4 x i32> @set_tuple3_nxv12i32_elt2(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1,
<vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3,
<vscale x 4 x i32> %z4, <vscale x 4 x i32> %z5) #0 {
; CHECK-LABEL: set_tuple3_nxv12i32_elt2:
; CHECK-NEXT: mov z0.d, z5.d
; CHECK-NEXT: ret
%tuple = call <vscale x 12 x i32> @llvm.aarch64.sve.tuple.create3.nxv12i32.nxv4i32(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1, <vscale x 4 x i32> %z2)
%ins = call <vscale x 12 x i32> @llvm.aarch64.sve.tuple.set.nxv12i32.nxv4i32(<vscale x 12 x i32> %tuple, i32 2, <vscale x 4 x i32> %z5)
%ext = call <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv12i32(<vscale x 12 x i32> %ins, i32 2)
ret <vscale x 4 x i32> %ext
}
; This test checks the elements _not_ being set aren't changed.
; tuple: { tuple3.res0, tuple3.res1, tuple3.res2 }
; insert z5: { tuple3.res0, z5 , tuple3.res2 }
; extract z2: ^^
define <vscale x 4 x i32> @set_tuple3_nxv12i32_elt1_ret_elt2(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1,
<vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3,
<vscale x 4 x i32> %z4, <vscale x 4 x i32> %z5) #0 {
; CHECK-LABEL: set_tuple3_nxv12i32_elt1_ret_elt2:
; CHECK-NEXT: mov z0.d, z2.d
; CHECK-NEXT: ret
%tuple = call <vscale x 12 x i32> @llvm.aarch64.sve.tuple.create3.nxv12i32.nxv4i32(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1, <vscale x 4 x i32> %z2)
%ins = call <vscale x 12 x i32> @llvm.aarch64.sve.tuple.set.nxv12i32.nxv4i32(<vscale x 12 x i32> %tuple, i32 1, <vscale x 4 x i32> %z5)
%ext = call <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv12i32(<vscale x 12 x i32> %ins, i32 2)
ret <vscale x 4 x i32> %ext
}
; Test extract of tuple passed into function
define <vscale x 4 x i32> @get_tuple3_nxv12i32_elt2(<vscale x 4 x i32> %z0, <vscale x 12 x i32> %tuple) #0 {
; CHECK-LABEL: get_tuple3_nxv12i32_elt2:
; CHECK-NEXT: mov z0.d, z3.d
; CHECK-NEXT: ret
%ext = call <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv12i32(<vscale x 12 x i32> %tuple, i32 2)
ret <vscale x 4 x i32> %ext
}
;
; Insert into four element tuples
;
; tuple: { tuple4.res0, tuple4.res1, tuple4.res2, tuple4.res3 }
; insert z5: { z5 , tuple4.res1, tuple4.res2, tuple4.res3 }
; extract z5: ^^
define <vscale x 4 x i32> @set_tuple4_nxv16i32_elt0(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1,
<vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3,
<vscale x 4 x i32> %z4, <vscale x 4 x i32> %z5) #0 {
; CHECK-LABEL: set_tuple4_nxv16i32_elt0:
; CHECK-NEXT: mov z0.d, z5.d
; CHECK-NEXT: ret
%tuple = tail call <vscale x 16 x i32> @llvm.aarch64.sve.tuple.create4.nxv16i32.nxv4i32(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1, <vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3)
%ins = call <vscale x 16 x i32> @llvm.aarch64.sve.tuple.set.nxv16i32.nxv4i32(<vscale x 16 x i32> %tuple, i32 0, <vscale x 4 x i32> %z5)
%ext = call <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv16i32(<vscale x 16 x i32> %ins, i32 0)
ret <vscale x 4 x i32> %ext
}
; tuple: { tuple4.res0, tuple4.res1, tuple4.res2, tuple4.res3 }
; insert z5: { tuple4.res0, z5 , tuple4.res2, tuple4.res3 }
; extract z5: ^^
define <vscale x 4 x i32> @set_tuple4_nxv16i32_elt1(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1,
<vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3,
<vscale x 4 x i32> %z4, <vscale x 4 x i32> %z5) #0 {
; CHECK-LABEL: set_tuple4_nxv16i32_elt1:
; CHECK-NEXT: mov z0.d, z5.d
; CHECK-NEXT: ret
%tuple = tail call <vscale x 16 x i32> @llvm.aarch64.sve.tuple.create4.nxv16i32.nxv4i32(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1, <vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3)
%ins = call <vscale x 16 x i32> @llvm.aarch64.sve.tuple.set.nxv16i32.nxv4i32(<vscale x 16 x i32> %tuple, i32 1, <vscale x 4 x i32> %z5)
%ext = call <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv16i32(<vscale x 16 x i32> %ins, i32 1)
ret <vscale x 4 x i32> %ext
}
; tuple: { tuple4.res0, tuple4.res1, tuple4.res2, tuple4.res3 }
; insert z5: { tuple4.res0, tuple4.res1, z5 , tuple4.res3 }
; extract z5: ^^
define <vscale x 4 x i32> @set_tuple4_nxv16i32_elt2(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1,
<vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3,
<vscale x 4 x i32> %z4, <vscale x 4 x i32> %z5) #0 {
; CHECK-LABEL: set_tuple4_nxv16i32_elt2:
; CHECK-NEXT: mov z0.d, z5.d
; CHECK-NEXT: ret
%tuple = tail call <vscale x 16 x i32> @llvm.aarch64.sve.tuple.create4.nxv16i32.nxv4i32(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1, <vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3)
%ins = call <vscale x 16 x i32> @llvm.aarch64.sve.tuple.set.nxv16i32.nxv4i32(<vscale x 16 x i32> %tuple, i32 2, <vscale x 4 x i32> %z5)
%ext = call <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv16i32(<vscale x 16 x i32> %ins, i32 2)
ret <vscale x 4 x i32> %ext
}
; tuple: { tuple4.res0, tuple4.res1, tuple4.res2, tuple4.res3 }
; insert z5: { tuple4.res0, tuple4.res1, tuple4.res2, z5 }
; extract z5: ^^
define <vscale x 4 x i32> @set_tuple4_nxv16i32_elt3(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1,
<vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3,
<vscale x 4 x i32> %z4, <vscale x 4 x i32> %z5) #0 {
; CHECK-LABEL: set_tuple4_nxv16i32_elt3:
; CHECK-NEXT: mov z0.d, z5.d
; CHECK-NEXT: ret
%tuple = tail call <vscale x 16 x i32> @llvm.aarch64.sve.tuple.create4.nxv16i32.nxv4i32(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1, <vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3)
%ins = call <vscale x 16 x i32> @llvm.aarch64.sve.tuple.set.nxv16i32.nxv4i32(<vscale x 16 x i32> %tuple, i32 3, <vscale x 4 x i32> %z5)
%ext = call <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv16i32(<vscale x 16 x i32> %ins, i32 3)
ret <vscale x 4 x i32> %ext
}
; This test checks the elements _not_ being set aren't changed.
; tuple: { tuple4.res0, tuple4.res1, tuple4.res2, tuple4.res3 }
; insert z5: { tuple4.res0, tuple4.res1, tuple4.res2, z5 }
; extract z2: ^^
define <vscale x 4 x i32> @set_tuple4_nxv16i32_elt3_ret_elt2(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1,
<vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3,
<vscale x 4 x i32> %z4, <vscale x 4 x i32> %z5) #0 {
; CHECK-LABEL: set_tuple4_nxv16i32_elt3_ret_elt2:
; CHECK-NEXT: mov z0.d, z2.d
; CHECK-NEXT: ret
%tuple = tail call <vscale x 16 x i32> @llvm.aarch64.sve.tuple.create4.nxv16i32.nxv4i32(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1, <vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3)
%ins = call <vscale x 16 x i32> @llvm.aarch64.sve.tuple.set.nxv16i32.nxv4i32(<vscale x 16 x i32> %tuple, i32 3, <vscale x 4 x i32> %z5)
%ext = call <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv16i32(<vscale x 16 x i32> %ins, i32 2)
ret <vscale x 4 x i32> %ext
}
; Test extract of tuple passed into function
define <vscale x 4 x i32> @get_tuple4_nxv16i32_elt3(<vscale x 16 x i32> %tuple) #0 {
; CHECK-LABEL: get_tuple4_nxv16i32_elt3:
; CHECK-NEXT: mov z0.d, z3.d
; CHECK-NEXT: ret
%ext = call <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv16i32(<vscale x 16 x i32> %tuple, i32 3)
ret <vscale x 4 x i32> %ext
}
attributes #0 = { nounwind "target-features"="+sve" }
declare <vscale x 8 x i32> @llvm.aarch64.sve.tuple.create2.nxv8i32.nxv4i32(<vscale x 4 x i32>, <vscale x 4 x i32>)
declare <vscale x 8 x i32> @llvm.aarch64.sve.tuple.set.nxv8i32.nxv4i32(<vscale x 8 x i32>, i32, <vscale x 4 x i32>)
declare <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv8i32(<vscale x 8 x i32>, i32)
declare <vscale x 12 x i32> @llvm.aarch64.sve.tuple.create3.nxv12i32.nxv4i32(<vscale x 4 x i32>, <vscale x 4 x i32>, <vscale x 4 x i32>)
declare <vscale x 12 x i32> @llvm.aarch64.sve.tuple.set.nxv12i32.nxv4i32(<vscale x 12 x i32>, i32, <vscale x 4 x i32>)
declare <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv12i32(<vscale x 12 x i32>, i32)
declare <vscale x 16 x i32> @llvm.aarch64.sve.tuple.create4.nxv16i32.nxv4i32(<vscale x 4 x i32>, <vscale x 4 x i32>, <vscale x 4 x i32>, <vscale x 4 x i32>)
declare <vscale x 16 x i32> @llvm.aarch64.sve.tuple.set.nxv16i32.nxv4i32(<vscale x 16 x i32>, i32, <vscale x 4 x i32>)
declare <vscale x 4 x i32> @llvm.aarch64.sve.tuple.get.nxv16i32(<vscale x 16 x i32>, i32)
|