blob: ffba55cf8f560e28c1f4f574fcb463c3f2a9b845 [file] [log] [blame]
James Molloy75f5f9e2014-04-16 15:33:48 +00001// RUN: %clang_cc1 -O3 -triple arm64-apple-ios7 -target-feature +neon -ffreestanding -S -o - %s | FileCheck %s
2// RUN: %clang_cc1 -O3 -triple arm64-apple-ios7 -target-feature +neon -ffreestanding -S -o - -emit-llvm %s | \
Tim Northovera2ee4332014-03-29 15:09:45 +00003// RUN: FileCheck -check-prefix=CHECK-IR %s
Tim Northover831d7282014-06-18 08:37:28 +00004// REQUIRES: aarch64-registered-target
Tim Northovera2ee4332014-03-29 15:09:45 +00005
6/// Test vdupq_n_f64 and vmovq_nf64 ARM64 intrinsics
7// <rdar://problem/11778405> ARM64: vdupq_n_f64 and vdupq_lane_f64 intrinsics
8// missing
9
10
11#include <arm_neon.h>
12
13// vdupq_n_f64 -> dup.2d v0, v0[0]
14//
15float64x2_t test_vdupq_n_f64(float64_t w)
16{
17 return vdupq_n_f64(w);
18 // CHECK-LABEL: test_vdupq_n_f64:
19 // CHECK: dup.2d v0, v0[0]
20 // CHECK-NEXT: ret
21}
22
23// might as well test this while we're here
24// vdupq_n_f32 -> dup.4s v0, v0[0]
25float32x4_t test_vdupq_n_f32(float32_t w)
26{
27 return vdupq_n_f32(w);
28 // CHECK-LABEL: test_vdupq_n_f32:
29 // CHECK: dup.4s v0, v0[0]
30 // CHECK-NEXT: ret
31}
32
33// vdupq_lane_f64 -> dup.2d v0, v0[0]
34// this was in <rdar://problem/11778405>, but had already been implemented,
35// test anyway
36float64x2_t test_vdupq_lane_f64(float64x1_t V)
37{
38 return vdupq_lane_f64(V, 0);
39 // CHECK-LABEL: test_vdupq_lane_f64:
40 // CHECK: dup.2d v0, v0[0]
41 // CHECK-NEXT: ret
42}
43
44// vmovq_n_f64 -> dup Vd.2d,X0
45// this wasn't in <rdar://problem/11778405>, but it was between the vdups
46float64x2_t test_vmovq_n_f64(float64_t w)
47{
48 return vmovq_n_f64(w);
49 // CHECK-LABEL: test_vmovq_n_f64:
50 // CHECK: dup.2d v0, v0[0]
51 // CHECK-NEXT: ret
52}
53
54float16x4_t test_vmov_n_f16(float16_t *a1)
55{
56 // CHECK-IR-LABEL: test_vmov_n_f16
57 return vmov_n_f16(*a1);
58 // CHECK-IR: insertelement {{.*}} i32 0{{ *$}}
59 // CHECK-IR: insertelement {{.*}} i32 1{{ *$}}
60 // CHECK-IR: insertelement {{.*}} i32 2{{ *$}}
61 // CHECK-IR: insertelement {{.*}} i32 3{{ *$}}
62}
63
64// Disable until scalar problem in backend is fixed. Change CHECK-IR@ to
65// CHECK-IR<colon>
66/*
67float64x1_t test_vmov_n_f64(float64_t a1)
68{
69 // CHECK-IR@ test_vmov_n_f64
70 return vmov_n_f64(a1);
71 // CHECK-IR@ insertelement {{.*}} i32 0{{ *$}}
72}
73*/
74
75float16x8_t test_vmovq_n_f16(float16_t *a1)
76{
77 // CHECK-IR-LABEL: test_vmovq_n_f16
78 return vmovq_n_f16(*a1);
79 // CHECK-IR: insertelement {{.*}} i32 0{{ *$}}
80 // CHECK-IR: insertelement {{.*}} i32 1{{ *$}}
81 // CHECK-IR: insertelement {{.*}} i32 2{{ *$}}
82 // CHECK-IR: insertelement {{.*}} i32 3{{ *$}}
83 // CHECK-IR: insertelement {{.*}} i32 4{{ *$}}
84 // CHECK-IR: insertelement {{.*}} i32 5{{ *$}}
85 // CHECK-IR: insertelement {{.*}} i32 6{{ *$}}
86 // CHECK-IR: insertelement {{.*}} i32 7{{ *$}}
87}
88