1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple arm64-apple-ios7 -target-feature +neon -ffreestanding -S -o - -emit-llvm %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc // Test ARM64 SIMD duplicate lane and n intrinsics
3*0a6a1f1dSLionel Sambuc
4*0a6a1f1dSLionel Sambuc #include <arm_neon.h>
5*0a6a1f1dSLionel Sambuc
test_vdup_lane_s64(int64x1_t a1)6*0a6a1f1dSLionel Sambuc void test_vdup_lane_s64(int64x1_t a1) {
7*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vdup_lane_s64
8*0a6a1f1dSLionel Sambuc vdup_lane_s64(a1, 0);
9*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
10*0a6a1f1dSLionel Sambuc }
11*0a6a1f1dSLionel Sambuc
test_vdup_lane_u64(uint64x1_t a1)12*0a6a1f1dSLionel Sambuc void test_vdup_lane_u64(uint64x1_t a1) {
13*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vdup_lane_u64
14*0a6a1f1dSLionel Sambuc vdup_lane_u64(a1, 0);
15*0a6a1f1dSLionel Sambuc // CHECK: shufflevector
16*0a6a1f1dSLionel Sambuc }
17*0a6a1f1dSLionel Sambuc
18*0a6a1f1dSLionel Sambuc // uncomment out the following code once scalar_to_vector in the backend
19*0a6a1f1dSLionel Sambuc // works (for 64 bit?). Change the "CHECK@" to "CHECK<colon>"
20*0a6a1f1dSLionel Sambuc /*
21*0a6a1f1dSLionel Sambuc float64x1_t test_vdup_n_f64(float64_t a1) {
22*0a6a1f1dSLionel Sambuc // CHECK-LABEL@ test_vdup_n_f64
23*0a6a1f1dSLionel Sambuc return vdup_n_f64(a1);
24*0a6a1f1dSLionel Sambuc // match that an element is inserted into part 0
25*0a6a1f1dSLionel Sambuc // CHECK@ insertelement {{.*, i32 0 *$}}
26*0a6a1f1dSLionel Sambuc }
27*0a6a1f1dSLionel Sambuc */
28*0a6a1f1dSLionel Sambuc
test_vdupq_n_f16(float16_t * a1)29*0a6a1f1dSLionel Sambuc float16x8_t test_vdupq_n_f16(float16_t *a1) {
30*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vdupq_n_f16
31*0a6a1f1dSLionel Sambuc return vdupq_n_f16(*a1);
32*0a6a1f1dSLionel Sambuc // match that an element is inserted into parts 0-7. The backend better
33*0a6a1f1dSLionel Sambuc // turn that into a single dup intruction
34*0a6a1f1dSLionel Sambuc // CHECK: insertelement {{.*, i32 0 *$}}
35*0a6a1f1dSLionel Sambuc // CHECK: insertelement {{.*, i32 1 *$}}
36*0a6a1f1dSLionel Sambuc // CHECK: insertelement {{.*, i32 2 *$}}
37*0a6a1f1dSLionel Sambuc // CHECK: insertelement {{.*, i32 3 *$}}
38*0a6a1f1dSLionel Sambuc // CHECK: insertelement {{.*, i32 4 *$}}
39*0a6a1f1dSLionel Sambuc // CHECK: insertelement {{.*, i32 5 *$}}
40*0a6a1f1dSLionel Sambuc // CHECK: insertelement {{.*, i32 6 *$}}
41*0a6a1f1dSLionel Sambuc // CHECK: insertelement {{.*, i32 7 *$}}
42*0a6a1f1dSLionel Sambuc }
43