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
5 ; Unpredicated dup instruction (which is an alias for mov):
6 ; * register + register,
7 ; * register + immediate
10 define <vscale x 16 x i8> @dup_i8(i8 %b) {
11 ; CHECK-LABEL: dup_i8:
13 ; CHECK-NEXT: mov z0.b, w0
15 %out = call <vscale x 16 x i8> @llvm.aarch64.sve.dup.x.nxv16i8(i8 %b)
16 ret <vscale x 16 x i8> %out
19 define <vscale x 16 x i8> @dup_imm_i8() {
20 ; CHECK-LABEL: dup_imm_i8:
22 ; CHECK-NEXT: mov z0.b, #16 // =0x10
24 %out = call <vscale x 16 x i8> @llvm.aarch64.sve.dup.x.nxv16i8(i8 16)
25 ret <vscale x 16 x i8> %out
28 define <vscale x 8 x i16> @dup_i16(i16 %b) {
29 ; CHECK-LABEL: dup_i16:
31 ; CHECK-NEXT: mov z0.h, w0
33 %out = call <vscale x 8 x i16> @llvm.aarch64.sve.dup.x.nxv8i16(i16 %b)
34 ret <vscale x 8 x i16> %out
37 define <vscale x 8 x i16> @dup_imm_i16(i16 %b) {
38 ; CHECK-LABEL: dup_imm_i16:
40 ; CHECK-NEXT: mov z0.h, #16 // =0x10
42 %out = call <vscale x 8 x i16> @llvm.aarch64.sve.dup.x.nxv8i16(i16 16)
43 ret <vscale x 8 x i16> %out
46 define <vscale x 4 x i32> @dup_i32(i32 %b) {
47 ; CHECK-LABEL: dup_i32:
49 ; CHECK-NEXT: mov z0.s, w0
51 %out = call <vscale x 4 x i32> @llvm.aarch64.sve.dup.x.nxv4i32(i32 %b)
52 ret <vscale x 4 x i32> %out
55 define <vscale x 4 x i32> @dup_imm_i32(i32 %b) {
56 ; CHECK-LABEL: dup_imm_i32:
58 ; CHECK-NEXT: mov z0.s, #16 // =0x10
60 %out = call <vscale x 4 x i32> @llvm.aarch64.sve.dup.x.nxv4i32(i32 16)
61 ret <vscale x 4 x i32> %out
64 define <vscale x 2 x i64> @dup_i64(i64 %b) {
65 ; CHECK-LABEL: dup_i64:
67 ; CHECK-NEXT: mov z0.d, x0
69 %out = call <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i64 %b)
70 ret <vscale x 2 x i64> %out
73 define <vscale x 2 x i64> @dup_imm_i64(i64 %b) {
74 ; CHECK-LABEL: dup_imm_i64:
76 ; CHECK-NEXT: mov z0.d, #16 // =0x10
78 %out = call <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i64 16)
79 ret <vscale x 2 x i64> %out
82 define <vscale x 8 x half> @dup_f16(half %b) {
83 ; CHECK-LABEL: dup_f16:
85 ; CHECK-NEXT: // kill: def $h0 killed $h0 def $z0
86 ; CHECK-NEXT: mov z0.h, h0
88 %out = call <vscale x 8 x half> @llvm.aarch64.sve.dup.x.nxv8f16(half %b)
89 ret <vscale x 8 x half> %out
92 define <vscale x 8 x bfloat> @dup_bf16(bfloat %b) #0 {
93 ; CHECK-LABEL: dup_bf16:
95 ; CHECK-NEXT: // kill: def $h0 killed $h0 def $z0
96 ; CHECK-NEXT: mov z0.h, h0
98 %out = call <vscale x 8 x bfloat> @llvm.aarch64.sve.dup.x.nxv8bf16(bfloat %b)
99 ret <vscale x 8 x bfloat> %out
102 define <vscale x 8 x half> @dup_imm_f16(half %b) {
103 ; CHECK-LABEL: dup_imm_f16:
105 ; CHECK-NEXT: fmov z0.h, #16.00000000
107 %out = call <vscale x 8 x half> @llvm.aarch64.sve.dup.x.nxv8f16(half 16.)
108 ret <vscale x 8 x half> %out
111 define <vscale x 4 x float> @dup_f32(float %b) {
112 ; CHECK-LABEL: dup_f32:
114 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $z0
115 ; CHECK-NEXT: mov z0.s, s0
117 %out = call <vscale x 4 x float> @llvm.aarch64.sve.dup.x.nxv4f32(float %b)
118 ret <vscale x 4 x float> %out
121 define <vscale x 4 x float> @dup_imm_f32(float %b) {
122 ; CHECK-LABEL: dup_imm_f32:
124 ; CHECK-NEXT: fmov z0.s, #16.00000000
126 %out = call <vscale x 4 x float> @llvm.aarch64.sve.dup.x.nxv4f32(float 16.)
127 ret <vscale x 4 x float> %out
130 define <vscale x 2 x double> @dup_f64(double %b) {
131 ; CHECK-LABEL: dup_f64:
133 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
134 ; CHECK-NEXT: mov z0.d, d0
136 %out = call <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double %b)
137 ret <vscale x 2 x double> %out
140 define <vscale x 2 x double> @dup_imm_f64(double %b) {
141 ; CHECK-LABEL: dup_imm_f64:
143 ; CHECK-NEXT: fmov z0.d, #16.00000000
145 %out = call <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double 16.)
146 ret <vscale x 2 x double> %out
149 define <vscale x 2 x float> @dup_fmov_imm_f32_2() {
150 ; CHECK-LABEL: dup_fmov_imm_f32_2:
152 ; CHECK-NEXT: mov w8, #1109917696
153 ; CHECK-NEXT: mov z0.s, w8
155 %out = tail call <vscale x 2 x float> @llvm.aarch64.sve.dup.x.nxv2f32(float 4.200000e+01)
156 ret <vscale x 2 x float> %out
159 define <vscale x 4 x float> @dup_fmov_imm_f32_4() {
160 ; CHECK-LABEL: dup_fmov_imm_f32_4:
162 ; CHECK-NEXT: mov w8, #1109917696
163 ; CHECK-NEXT: mov z0.s, w8
165 %out = tail call <vscale x 4 x float> @llvm.aarch64.sve.dup.x.nxv4f32(float 4.200000e+01)
166 ret <vscale x 4 x float> %out
169 define <vscale x 2 x double> @dup_fmov_imm_f64_2() {
170 ; CHECK-LABEL: dup_fmov_imm_f64_2:
172 ; CHECK-NEXT: mov x8, #4631107791820423168
173 ; CHECK-NEXT: mov z0.d, x8
175 %out = tail call <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double 4.200000e+01)
176 ret <vscale x 2 x double> %out
179 declare <vscale x 16 x i8> @llvm.aarch64.sve.dup.x.nxv16i8( i8)
180 declare <vscale x 8 x i16> @llvm.aarch64.sve.dup.x.nxv8i16(i16)
181 declare <vscale x 4 x i32> @llvm.aarch64.sve.dup.x.nxv4i32(i32)
182 declare <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i64)
183 declare <vscale x 8 x half> @llvm.aarch64.sve.dup.x.nxv8f16(half)
184 declare <vscale x 8 x bfloat> @llvm.aarch64.sve.dup.x.nxv8bf16(bfloat)
185 declare <vscale x 2 x float> @llvm.aarch64.sve.dup.x.nxv2f32(float)
186 declare <vscale x 4 x float> @llvm.aarch64.sve.dup.x.nxv4f32(float)
187 declare <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double)
189 ; +bf16 is required for the bfloat version.
190 attributes #0 = { "target-features"="+sve,+bf16" }