sve-vector-splat.ll
4.9 KB
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
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
;; Splats of legal integer vector types
define <vscale x 16 x i8> @sve_splat_16xi8(i8 %val) {
; CHECK-LABEL: @sve_splat_16xi8
; CHECK: mov z0.b, w0
; CHECK-NEXT: ret
%ins = insertelement <vscale x 16 x i8> undef, i8 %val, i32 0
%splat = shufflevector <vscale x 16 x i8> %ins, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
ret <vscale x 16 x i8> %splat
}
define <vscale x 8 x i16> @sve_splat_8xi16(i16 %val) {
; CHECK-LABEL: @sve_splat_8xi16
; CHECK: mov z0.h, w0
; CHECK-NEXT: ret
%ins = insertelement <vscale x 8 x i16> undef, i16 %val, i32 0
%splat = shufflevector <vscale x 8 x i16> %ins, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
ret <vscale x 8 x i16> %splat
}
define <vscale x 4 x i32> @sve_splat_4xi32(i32 %val) {
; CHECK-LABEL: @sve_splat_4xi32
; CHECK: mov z0.s, w0
; CHECK-NEXT: ret
%ins = insertelement <vscale x 4 x i32> undef, i32 %val, i32 0
%splat = shufflevector <vscale x 4 x i32> %ins, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
ret <vscale x 4 x i32> %splat
}
define <vscale x 2 x i64> @sve_splat_2xi64(i64 %val) {
; CHECK-LABEL: @sve_splat_2xi64
; CHECK: mov z0.d, x0
; CHECK-NEXT: ret
%ins = insertelement <vscale x 2 x i64> undef, i64 %val, i32 0
%splat = shufflevector <vscale x 2 x i64> %ins, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
ret <vscale x 2 x i64> %splat
}
;; Promote splats of smaller illegal integer vector types
define <vscale x 2 x i8> @sve_splat_2xi8(i8 %val) {
; CHECK-LABEL: @sve_splat_2xi8
; CHECK: mov z0.d, x0
; CHECK-NEXT: ret
%ins = insertelement <vscale x 2 x i8> undef, i8 %val, i32 0
%splat = shufflevector <vscale x 2 x i8> %ins, <vscale x 2 x i8> undef, <vscale x 2 x i32> zeroinitializer
ret <vscale x 2 x i8> %splat
}
define <vscale x 4 x i8> @sve_splat_4xi8(i8 %val) {
; CHECK-LABEL: @sve_splat_4xi8
; CHECK: mov z0.s, w0
; CHECK-NEXT: ret
%ins = insertelement <vscale x 4 x i8> undef, i8 %val, i32 0
%splat = shufflevector <vscale x 4 x i8> %ins, <vscale x 4 x i8> undef, <vscale x 4 x i32> zeroinitializer
ret <vscale x 4 x i8> %splat
}
define <vscale x 8 x i8> @sve_splat_8xi8(i8 %val) {
; CHECK-LABEL: @sve_splat_8xi8
; CHECK: mov z0.h, w0
; CHECK-NEXT: ret
%ins = insertelement <vscale x 8 x i8> undef, i8 %val, i32 0
%splat = shufflevector <vscale x 8 x i8> %ins, <vscale x 8 x i8> undef, <vscale x 8 x i32> zeroinitializer
ret <vscale x 8 x i8> %splat
}
define <vscale x 2 x i16> @sve_splat_2xi16(i16 %val) {
; CHECK-LABEL: @sve_splat_2xi16
; CHECK: mov z0.d, x0
; CHECK-NEXT: ret
%ins = insertelement <vscale x 2 x i16> undef, i16 %val, i32 0
%splat = shufflevector <vscale x 2 x i16> %ins, <vscale x 2 x i16> undef, <vscale x 2 x i32> zeroinitializer
ret <vscale x 2 x i16> %splat
}
define <vscale x 4 x i16> @sve_splat_4xi16(i16 %val) {
; CHECK-LABEL: @sve_splat_4xi16
; CHECK: mov z0.s, w0
; CHECK-NEXT: ret
%ins = insertelement <vscale x 4 x i16> undef, i16 %val, i32 0
%splat = shufflevector <vscale x 4 x i16> %ins, <vscale x 4 x i16> undef, <vscale x 4 x i32> zeroinitializer
ret <vscale x 4 x i16> %splat
}
define <vscale x 2 x i32> @sve_splat_2xi32(i32 %val) {
; CHECK-LABEL: @sve_splat_2xi32
; CHECK: mov z0.d, x0
; CHECK-NEXT: ret
%ins = insertelement <vscale x 2 x i32> undef, i32 %val, i32 0
%splat = shufflevector <vscale x 2 x i32> %ins, <vscale x 2 x i32> undef, <vscale x 2 x i32> zeroinitializer
ret <vscale x 2 x i32> %splat
}
define <vscale x 2 x i1> @sve_splat_2xi1(i1 %val) {
; CHECK-LABEL: @sve_splat_2xi1
; CHECK: sbfx x8, x0, #0, #1
; CHECK-NEXT: whilelo p0.d, xzr, x8
; CHECK-NEXT: ret
%ins = insertelement <vscale x 2 x i1> undef, i1 %val, i32 0
%splat = shufflevector <vscale x 2 x i1> %ins, <vscale x 2 x i1> undef, <vscale x 2 x i32> zeroinitializer
ret <vscale x 2 x i1> %splat
}
define <vscale x 4 x i1> @sve_splat_4xi1(i1 %val) {
; CHECK-LABEL: @sve_splat_4xi1
; CHECK: sbfx x8, x0, #0, #1
; CHECK-NEXT: whilelo p0.s, xzr, x8
; CHECK-NEXT: ret
%ins = insertelement <vscale x 4 x i1> undef, i1 %val, i32 0
%splat = shufflevector <vscale x 4 x i1> %ins, <vscale x 4 x i1> undef, <vscale x 4 x i32> zeroinitializer
ret <vscale x 4 x i1> %splat
}
define <vscale x 8 x i1> @sve_splat_8xi1(i1 %val) {
; CHECK-LABEL: @sve_splat_8xi1
; CHECK: sbfx x8, x0, #0, #1
; CHECK-NEXT: whilelo p0.h, xzr, x8
; CHECK-NEXT: ret
%ins = insertelement <vscale x 8 x i1> undef, i1 %val, i32 0
%splat = shufflevector <vscale x 8 x i1> %ins, <vscale x 8 x i1> undef, <vscale x 8 x i32> zeroinitializer
ret <vscale x 8 x i1> %splat
}
define <vscale x 16 x i1> @sve_splat_16xi1(i1 %val) {
; CHECK-LABEL: @sve_splat_16xi1
; CHECK: sbfx x8, x0, #0, #1
; CHECK-NEXT: whilelo p0.b, xzr, x8
; CHECK-NEXT: ret
%ins = insertelement <vscale x 16 x i1> undef, i1 %val, i32 0
%splat = shufflevector <vscale x 16 x i1> %ins, <vscale x 16 x i1> undef, <vscale x 16 x i32> zeroinitializer
ret <vscale x 16 x i1> %splat
}