1 // REQUIRES: aarch64-registered-target
2 // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \
3 // RUN:   -ffp-contract=fast -S -O3 -o - %s | FileCheck %s
4 
5 
6 #include <arm_neon.h>
7 
8 // CHECK-LABEL: test_vdups_lane_f32
test_vdups_lane_f32(float32x2_t a)9 float32_t test_vdups_lane_f32(float32x2_t a) {
10   return vdups_lane_f32(a, 1);
11 // CHECK: ret
12 // CHECK-NOT: dup {{s[0-9]+}}, {{v[0-9]+}}.s[1]
13 }
14 
15 
16 // CHECK-LABEL: test_vdupd_lane_f64
test_vdupd_lane_f64(float64x1_t a)17 float64_t test_vdupd_lane_f64(float64x1_t a) {
18   return vdupd_lane_f64(a, 0);
19 // CHECK: ret
20 // CHECK-NOT: dup {{d[0-9]+}}, {{v[0-9]+}}.d[0]
21 }
22 
23 
24 // CHECK-LABEL: test_vdups_laneq_f32
test_vdups_laneq_f32(float32x4_t a)25 float32_t test_vdups_laneq_f32(float32x4_t a) {
26   return vdups_laneq_f32(a, 3);
27 // CHECK: ret
28 // CHECK-NOT: dup {{s[0-9]+}}, {{v[0-9]+}}.s[3]
29 }
30 
31 
32 // CHECK-LABEL: test_vdupd_laneq_f64
test_vdupd_laneq_f64(float64x2_t a)33 float64_t test_vdupd_laneq_f64(float64x2_t a) {
34   return vdupd_laneq_f64(a, 1);
35 // CHECK: ret
36 // CHECK-NOT: dup {{d[0-9]+}}, {{v[0-9]+}}.d[1]
37 }
38 
39 
40 // CHECK-LABEL: test_vdupb_lane_s8
test_vdupb_lane_s8(int8x8_t a)41 int8_t test_vdupb_lane_s8(int8x8_t a) {
42   return vdupb_lane_s8(a, 7);
43 // CHECK: {{umov|smov}} {{w[0-9]+}}, {{v[0-9]+}}.b[7]
44 }
45 
46 
47 // CHECK-LABEL: test_vduph_lane_s16
test_vduph_lane_s16(int16x4_t a)48 int16_t test_vduph_lane_s16(int16x4_t a) {
49   return vduph_lane_s16(a, 3);
50 // CHECK: {{umov|smov}} {{w[0-9]+}}, {{v[0-9]+}}.h[3]
51 }
52 
53 
54 // CHECK-LABEL: test_vdups_lane_s32
test_vdups_lane_s32(int32x2_t a)55 int32_t test_vdups_lane_s32(int32x2_t a) {
56   return vdups_lane_s32(a, 1);
57 // CHECK: {{mov|umov}} {{w[0-9]+}}, {{v[0-9]+}}.s[1]
58 }
59 
60 
61 // CHECK-LABEL: test_vdupd_lane_s64
test_vdupd_lane_s64(int64x1_t a)62 int64_t test_vdupd_lane_s64(int64x1_t a) {
63   return vdupd_lane_s64(a, 0);
64 // CHECK: fmov {{x[0-9]+}}, {{d[0-9]+}}
65 }
66 
67 
68 // CHECK-LABEL: test_vdupb_lane_u8
test_vdupb_lane_u8(uint8x8_t a)69 uint8_t test_vdupb_lane_u8(uint8x8_t a) {
70   return vdupb_lane_u8(a, 7);
71 // CHECK: {{mov|umov}} {{w[0-9]+}}, {{v[0-9]+}}.b[7]
72 }
73 
74 
75 // CHECK-LABEL: test_vduph_lane_u16
test_vduph_lane_u16(uint16x4_t a)76 uint16_t test_vduph_lane_u16(uint16x4_t a) {
77   return vduph_lane_u16(a, 3);
78 // CHECK: {{mov|umov}} {{w[0-9]+}}, {{v[0-9]+}}.h[3]
79 }
80 
81 
82 // CHECK-LABEL: test_vdups_lane_u32
test_vdups_lane_u32(uint32x2_t a)83 uint32_t test_vdups_lane_u32(uint32x2_t a) {
84   return vdups_lane_u32(a, 1);
85 // CHECK: {{mov|umov}} {{w[0-9]+}}, {{v[0-9]+}}.s[1]
86 }
87 
88 
89 // CHECK-LABEL: test_vdupd_lane_u64
test_vdupd_lane_u64(uint64x1_t a)90 uint64_t test_vdupd_lane_u64(uint64x1_t a) {
91   return vdupd_lane_u64(a, 0);
92 // CHECK: fmov {{x[0-9]+}}, {{d[0-9]+}}
93 }
94 
95 // CHECK-LABEL: test_vdupb_laneq_s8
test_vdupb_laneq_s8(int8x16_t a)96 int8_t test_vdupb_laneq_s8(int8x16_t a) {
97   return vdupb_laneq_s8(a, 15);
98 // CHECK: {{umov|smov}} {{w[0-9]+}}, {{v[0-9]+}}.b[15]
99 }
100 
101 
102 // CHECK-LABEL: test_vduph_laneq_s16
test_vduph_laneq_s16(int16x8_t a)103 int16_t test_vduph_laneq_s16(int16x8_t a) {
104   return vduph_laneq_s16(a, 7);
105 // CHECK: {{umov|smov}} {{w[0-9]+}}, {{v[0-9]+}}.h[7]
106 }
107 
108 
109 // CHECK-LABEL: test_vdups_laneq_s32
test_vdups_laneq_s32(int32x4_t a)110 int32_t test_vdups_laneq_s32(int32x4_t a) {
111   return vdups_laneq_s32(a, 3);
112 // CHECK: {{mov|umov}} {{w[0-9]+}}, {{v[0-9]+}}.s[3]
113 }
114 
115 
116 // CHECK-LABEL: test_vdupd_laneq_s64
test_vdupd_laneq_s64(int64x2_t a)117 int64_t test_vdupd_laneq_s64(int64x2_t a) {
118   return vdupd_laneq_s64(a, 1);
119 // CHECK: {{mov|umov}} {{x[0-9]+}}, {{v[0-9]+}}.d[1]
120 }
121 
122 
123 // CHECK-LABEL: test_vdupb_laneq_u8
test_vdupb_laneq_u8(uint8x16_t a)124 uint8_t test_vdupb_laneq_u8(uint8x16_t a) {
125   return vdupb_laneq_u8(a, 15);
126 // CHECK: {{mov|umov}} {{w[0-9]+}}, {{v[0-9]+}}.b[15]
127 }
128 
129 
130 // CHECK-LABEL: test_vduph_laneq_u16
test_vduph_laneq_u16(uint16x8_t a)131 uint16_t test_vduph_laneq_u16(uint16x8_t a) {
132   return vduph_laneq_u16(a, 7);
133 // CHECK: {{mov|umov}} {{w[0-9]+}}, {{v[0-9]+}}.h[7]
134 }
135 
136 
137 // CHECK-LABEL: test_vdups_laneq_u32
test_vdups_laneq_u32(uint32x4_t a)138 uint32_t test_vdups_laneq_u32(uint32x4_t a) {
139   return vdups_laneq_u32(a, 3);
140 // CHECK: {{mov|umov}} {{w[0-9]+}}, {{v[0-9]+}}.s[3]
141 }
142 
143 
144 // CHECK-LABEL: test_vdupd_laneq_u64
test_vdupd_laneq_u64(uint64x2_t a)145 uint64_t test_vdupd_laneq_u64(uint64x2_t a) {
146   return vdupd_laneq_u64(a, 1);
147 // CHECK: {{mov|umov}} {{x[0-9]+}}, {{v[0-9]+}}.d[1]
148 }
149 
150 // CHECK-LABEL: test_vdupb_lane_p8
test_vdupb_lane_p8(poly8x8_t a)151 poly8_t test_vdupb_lane_p8(poly8x8_t a) {
152   return vdupb_lane_p8(a, 7);
153 // CHECK: {{mov|umov}} {{w[0-9]+}}, {{v[0-9]+}}.b[7]
154 }
155 
156 // CHECK-LABEL: test_vduph_lane_p16
test_vduph_lane_p16(poly16x4_t a)157 poly16_t test_vduph_lane_p16(poly16x4_t a) {
158   return vduph_lane_p16(a, 3);
159 // CHECK: {{mov|umov}} {{w[0-9]+}}, {{v[0-9]+}}.h[3]
160 }
161 
162 // CHECK-LABEL: test_vdupb_laneq_p8
test_vdupb_laneq_p8(poly8x16_t a)163 poly8_t test_vdupb_laneq_p8(poly8x16_t a) {
164   return vdupb_laneq_p8(a, 15);
165 // CHECK: {{mov|umov}} {{w[0-9]+}}, {{v[0-9]+}}.b[15]
166 }
167 
168 // CHECK-LABEL: test_vduph_laneq_p16
test_vduph_laneq_p16(poly16x8_t a)169 poly16_t test_vduph_laneq_p16(poly16x8_t a) {
170   return vduph_laneq_p16(a, 7);
171 // CHECK: {{mov|umov}} {{w[0-9]+}}, {{v[0-9]+}}.h[7]
172 }
173 
174