1 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mattr=+neon < %s | FileCheck %s --check-prefix=CHECK
4 define float @test_dup_sv2S(<2 x float> %v) {
5 ; CHECK-LABEL: test_dup_sv2S
6 ; CHECK: ins {{v[0-9]+}}.s[0], {{v[0-9]+}}.s[1]
7 %tmp1 = extractelement <2 x float> %v, i32 1
11 define float @test_dup_sv2S_0(<2 x float> %v) {
12 ; CHECK-LABEL: test_dup_sv2S_0
13 ; CHECK-NOT: dup {{[vsd][0-9]+}}
14 ; CHECK-NOT: ins {{[vsd][0-9]+}}
16 %tmp1 = extractelement <2 x float> %v, i32 0
20 define float @test_dup_sv4S(<4 x float> %v) {
21 ; CHECK-LABEL: test_dup_sv4S
22 ; CHECK-NOT: dup {{[vsd][0-9]+}}
23 ; CHECK-NOT: ins {{[vsd][0-9]+}}
25 %tmp1 = extractelement <4 x float> %v, i32 0
29 define double @test_dup_dvD(<1 x double> %v) {
30 ; CHECK-LABEL: test_dup_dvD
31 ; CHECK-NOT: dup {{[vsd][0-9]+}}
32 ; CHECK-NOT: ins {{[vsd][0-9]+}}
34 %tmp1 = extractelement <1 x double> %v, i32 0
38 define double @test_dup_dv2D(<2 x double> %v) {
39 ; CHECK-LABEL: test_dup_dv2D
40 ; CHECK: ins {{v[0-9]+}}.d[0], {{v[0-9]+}}.d[1]
41 %tmp1 = extractelement <2 x double> %v, i32 1
45 define double @test_dup_dv2D_0(<2 x double> %v) {
46 ; CHECK-LABEL: test_dup_dv2D_0
47 ; CHECK: ins {{v[0-9]+}}.d[0], {{v[0-9]+}}.d[1]
49 %tmp1 = extractelement <2 x double> %v, i32 1
53 define <1 x i8> @test_vector_dup_bv16B(<16 x i8> %v1) {
54 ; CHECK-LABEL: test_vector_dup_bv16B
55 %shuffle.i = shufflevector <16 x i8> %v1, <16 x i8> undef, <1 x i32> <i32 14>
56 ret <1 x i8> %shuffle.i
59 define <1 x i8> @test_vector_dup_bv8B(<8 x i8> %v1) {
60 ; CHECK-LABEL: test_vector_dup_bv8B
61 %shuffle.i = shufflevector <8 x i8> %v1, <8 x i8> undef, <1 x i32> <i32 7>
62 ret <1 x i8> %shuffle.i
65 define <1 x i16> @test_vector_dup_hv8H(<8 x i16> %v1) {
66 ; CHECK-LABEL: test_vector_dup_hv8H
67 %shuffle.i = shufflevector <8 x i16> %v1, <8 x i16> undef, <1 x i32> <i32 7>
68 ret <1 x i16> %shuffle.i
71 define <1 x i16> @test_vector_dup_hv4H(<4 x i16> %v1) {
72 ; CHECK-LABEL: test_vector_dup_hv4H
73 %shuffle.i = shufflevector <4 x i16> %v1, <4 x i16> undef, <1 x i32> <i32 3>
74 ret <1 x i16> %shuffle.i
77 define <1 x i32> @test_vector_dup_sv4S(<4 x i32> %v1) {
78 ; CHECK-LABEL: test_vector_dup_sv4S
79 %shuffle = shufflevector <4 x i32> %v1, <4 x i32> undef, <1 x i32> <i32 3>
80 ret <1 x i32> %shuffle
83 define <1 x i32> @test_vector_dup_sv2S(<2 x i32> %v1) {
84 ; CHECK-LABEL: test_vector_dup_sv2S
85 %shuffle = shufflevector <2 x i32> %v1, <2 x i32> undef, <1 x i32> <i32 1>
86 ret <1 x i32> %shuffle
89 define <1 x i64> @test_vector_dup_dv2D(<2 x i64> %v1) {
90 ; CHECK-LABEL: test_vector_dup_dv2D
91 ; CHECK: ext {{v[0-9]+}}.16b, {{v[0-9]+}}.16b, {{v[0-9]+}}.16b, #8
92 %shuffle.i = shufflevector <2 x i64> %v1, <2 x i64> undef, <1 x i32> <i32 1>
93 ret <1 x i64> %shuffle.i
96 define <1 x i64> @test_vector_copy_dup_dv2D(<1 x i64> %a, <2 x i64> %c) {
97 ; CHECK-LABEL: test_vector_copy_dup_dv2D
98 ; CHECK: {{dup|mov}} {{d[0-9]+}}, {{v[0-9]+}}.d[1]
99 %vget_lane = extractelement <2 x i64> %c, i32 1
100 %vset_lane = insertelement <1 x i64> undef, i64 %vget_lane, i32 0
101 ret <1 x i64> %vset_lane
104 ; Undefined behaviour, so we really don't care what actually gets emitted, just
105 ; as long as we don't crash (since it could be dynamically unreachable).
106 define i32 @test_out_of_range_extract(<4 x i32> %vec) {
107 ; CHECK-LABEL: test_out_of_range_extract:
109 %elt = extractelement <4 x i32> %vec, i32 4
113 ; Undefined behaviour, so we really don't care what actually gets emitted, just
114 ; as long as we don't crash (since it could be dynamically unreachable).
115 define void @test_out_of_range_insert(<4 x i32> %vec, i32 %elt) {
116 ; CHECK-LABEL: test_out_of_range_insert:
118 insertelement <4 x i32> %vec, i32 %elt, i32 4