R600/SI: Add global atomicrmw and
[oota-llvm.git] / test / CodeGen / AArch64 / neon-scalar-copy.ll
1 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mattr=+neon < %s | FileCheck %s --check-prefix=CHECK
2
3
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
8  ret float  %tmp1
9 }
10
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]+}}
15  ; CHECK: ret
16  %tmp1 = extractelement <2 x float> %v, i32 0
17  ret float  %tmp1
18 }
19
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]+}}
24  ; CHECK: ret
25  %tmp1 = extractelement <4 x float> %v, i32 0
26  ret float  %tmp1
27 }
28
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]+}}
33  ; CHECK: ret
34  %tmp1 = extractelement <1 x double> %v, i32 0
35  ret double  %tmp1
36 }
37
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
42  ret double  %tmp1
43 }
44
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]
48  ; CHECK: ret
49  %tmp1 = extractelement <2 x double> %v, i32 1
50  ret double  %tmp1
51 }
52
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
57 }
58
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
63 }
64
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
69 }
70
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
75 }
76
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
81 }
82
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
87 }
88
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
94 }
95
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
102 }
103
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:
108 ; CHECK: ret
109   %elt = extractelement <4 x i32> %vec, i32 4
110   ret i32 %elt
111 }
112
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:
117 ; CHECK: ret
118   insertelement <4 x i32> %vec, i32 %elt, i32 4
119   ret void
120 }