1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple aarch64-none-linux-gnu -mattr=+sve | FileCheck %s
4 define <vscale x 16 x i8> @dup_extract_i8(<vscale x 16 x i8> %data) {
5 ; CHECK-LABEL: dup_extract_i8:
7 ; CHECK-NEXT: mov z0.b, z0.b[1]
9 %1 = extractelement <vscale x 16 x i8> %data, i8 1
10 %.splatinsert = insertelement <vscale x 16 x i8> poison, i8 %1, i32 0
11 %.splat = shufflevector <vscale x 16 x i8> %.splatinsert, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
12 ret <vscale x 16 x i8> %.splat
15 define <vscale x 8 x i16> @dup_extract_i16(<vscale x 8 x i16> %data) {
16 ; CHECK-LABEL: dup_extract_i16:
18 ; CHECK-NEXT: mov z0.h, z0.h[1]
20 %1 = extractelement <vscale x 8 x i16> %data, i16 1
21 %.splatinsert = insertelement <vscale x 8 x i16> poison, i16 %1, i32 0
22 %.splat = shufflevector <vscale x 8 x i16> %.splatinsert, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
23 ret <vscale x 8 x i16> %.splat
26 define <vscale x 4 x i32> @dup_extract_i32(<vscale x 4 x i32> %data) {
27 ; CHECK-LABEL: dup_extract_i32:
29 ; CHECK-NEXT: mov z0.s, z0.s[1]
31 %1 = extractelement <vscale x 4 x i32> %data, i32 1
32 %.splatinsert = insertelement <vscale x 4 x i32> poison, i32 %1, i32 0
33 %.splat = shufflevector <vscale x 4 x i32> %.splatinsert, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
34 ret <vscale x 4 x i32> %.splat
37 define <vscale x 2 x i64> @dup_extract_i64(<vscale x 2 x i64> %data) {
38 ; CHECK-LABEL: dup_extract_i64:
40 ; CHECK-NEXT: mov z0.d, z0.d[1]
42 %1 = extractelement <vscale x 2 x i64> %data, i64 1
43 %.splatinsert = insertelement <vscale x 2 x i64> poison, i64 %1, i32 0
44 %.splat = shufflevector <vscale x 2 x i64> %.splatinsert, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
45 ret <vscale x 2 x i64> %.splat
48 define <vscale x 8 x half> @dup_extract_f16(<vscale x 8 x half> %data) {
49 ; CHECK-LABEL: dup_extract_f16:
51 ; CHECK-NEXT: mov z0.h, z0.h[1]
53 %1 = extractelement <vscale x 8 x half> %data, i16 1
54 %.splatinsert = insertelement <vscale x 8 x half> poison, half %1, i32 0
55 %.splat = shufflevector <vscale x 8 x half> %.splatinsert, <vscale x 8 x half> poison, <vscale x 8 x i32> zeroinitializer
56 ret <vscale x 8 x half> %.splat
59 define <vscale x 4 x half> @dup_extract_f16_4(<vscale x 4 x half> %data) {
60 ; CHECK-LABEL: dup_extract_f16_4:
62 ; CHECK-NEXT: mov z0.s, z0.s[1]
64 %1 = extractelement <vscale x 4 x half> %data, i16 1
65 %.splatinsert = insertelement <vscale x 4 x half> poison, half %1, i32 0
66 %.splat = shufflevector <vscale x 4 x half> %.splatinsert, <vscale x 4 x half> poison, <vscale x 4 x i32> zeroinitializer
67 ret <vscale x 4 x half> %.splat
70 define <vscale x 2 x half> @dup_extract_f16_2(<vscale x 2 x half> %data) {
71 ; CHECK-LABEL: dup_extract_f16_2:
73 ; CHECK-NEXT: mov z0.d, z0.d[1]
75 %1 = extractelement <vscale x 2 x half> %data, i16 1
76 %.splatinsert = insertelement <vscale x 2 x half> poison, half %1, i32 0
77 %.splat = shufflevector <vscale x 2 x half> %.splatinsert, <vscale x 2 x half> poison, <vscale x 2 x i32> zeroinitializer
78 ret <vscale x 2 x half> %.splat
81 define <vscale x 8 x bfloat> @dup_extract_bf16(<vscale x 8 x bfloat> %data) #0 {
82 ; CHECK-LABEL: dup_extract_bf16:
84 ; CHECK-NEXT: mov z0.h, z0.h[1]
86 %1 = extractelement <vscale x 8 x bfloat> %data, i16 1
87 %.splatinsert = insertelement <vscale x 8 x bfloat> poison, bfloat %1, i32 0
88 %.splat = shufflevector <vscale x 8 x bfloat> %.splatinsert, <vscale x 8 x bfloat> poison, <vscale x 8 x i32> zeroinitializer
89 ret <vscale x 8 x bfloat> %.splat
92 define <vscale x 4 x float> @dup_extract_f32(<vscale x 4 x float> %data) {
93 ; CHECK-LABEL: dup_extract_f32:
95 ; CHECK-NEXT: mov z0.s, z0.s[1]
97 %1 = extractelement <vscale x 4 x float> %data, i32 1
98 %.splatinsert = insertelement <vscale x 4 x float> poison, float %1, i32 0
99 %.splat = shufflevector <vscale x 4 x float> %.splatinsert, <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
100 ret <vscale x 4 x float> %.splat
103 define <vscale x 2 x float> @dup_extract_f32_2(<vscale x 2 x float> %data) {
104 ; CHECK-LABEL: dup_extract_f32_2:
106 ; CHECK-NEXT: mov z0.d, z0.d[1]
108 %1 = extractelement <vscale x 2 x float> %data, i32 1
109 %.splatinsert = insertelement <vscale x 2 x float> poison, float %1, i32 0
110 %.splat = shufflevector <vscale x 2 x float> %.splatinsert, <vscale x 2 x float> poison, <vscale x 2 x i32> zeroinitializer
111 ret <vscale x 2 x float> %.splat
114 define <vscale x 2 x double> @dup_extract_f64(<vscale x 2 x double> %data) {
115 ; CHECK-LABEL: dup_extract_f64:
117 ; CHECK-NEXT: mov z0.d, z0.d[1]
119 %1 = extractelement <vscale x 2 x double> %data, i64 1
120 %.splatinsert = insertelement <vscale x 2 x double> poison, double %1, i32 0
121 %.splat = shufflevector <vscale x 2 x double> %.splatinsert, <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer
122 ret <vscale x 2 x double> %.splat
125 ; +bf16 is required for the bfloat version.
126 attributes #0 = { "target-features"="+sve,+bf16" }