summaryrefslogtreecommitdiff
path: root/test/CodeGen/arm64_vdupq_n_f64.c
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2014-03-29 15:09:45 +0000
committerTim Northover <tnorthover@apple.com>2014-03-29 15:09:45 +0000
commit7e0e8ef787107d4f646254130625d83c67a617bf (patch)
tree8ff59170f29defadd4d7bea0156c174fd1619a4d /test/CodeGen/arm64_vdupq_n_f64.c
parent6614bf2dd1f7e09bbef38b243fd42f7182897908 (diff)
downloadclang-7e0e8ef787107d4f646254130625d83c67a617bf.tar.gz
ARM64: initial clang support commit.
This adds Clang support for the ARM64 backend. There are definitely still some rough edges, so please bring up any issues you see with this patch. As with the LLVM commit though, we think it'll be more useful for merging with AArch64 from within the tree. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205100 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/arm64_vdupq_n_f64.c')
-rw-r--r--test/CodeGen/arm64_vdupq_n_f64.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/test/CodeGen/arm64_vdupq_n_f64.c b/test/CodeGen/arm64_vdupq_n_f64.c
new file mode 100644
index 0000000000..139bfffb8d
--- /dev/null
+++ b/test/CodeGen/arm64_vdupq_n_f64.c
@@ -0,0 +1,88 @@
+// RUN: %clang -O3 -target arm64-apple-ios7 -ffreestanding -S -o - %s | FileCheck %s
+// RUN: %clang -O3 -target arm64-apple-ios7 -ffreestanding -S -o - -emit-llvm %s | \
+// RUN: FileCheck -check-prefix=CHECK-IR %s
+// REQUIRES: arm64-registered-target
+
+/// Test vdupq_n_f64 and vmovq_nf64 ARM64 intrinsics
+// <rdar://problem/11778405> ARM64: vdupq_n_f64 and vdupq_lane_f64 intrinsics
+// missing
+
+
+#include <arm_neon.h>
+
+// vdupq_n_f64 -> dup.2d v0, v0[0]
+//
+float64x2_t test_vdupq_n_f64(float64_t w)
+{
+ return vdupq_n_f64(w);
+ // CHECK-LABEL: test_vdupq_n_f64:
+ // CHECK: dup.2d v0, v0[0]
+ // CHECK-NEXT: ret
+}
+
+// might as well test this while we're here
+// vdupq_n_f32 -> dup.4s v0, v0[0]
+float32x4_t test_vdupq_n_f32(float32_t w)
+{
+ return vdupq_n_f32(w);
+ // CHECK-LABEL: test_vdupq_n_f32:
+ // CHECK: dup.4s v0, v0[0]
+ // CHECK-NEXT: ret
+}
+
+// vdupq_lane_f64 -> dup.2d v0, v0[0]
+// this was in <rdar://problem/11778405>, but had already been implemented,
+// test anyway
+float64x2_t test_vdupq_lane_f64(float64x1_t V)
+{
+ return vdupq_lane_f64(V, 0);
+ // CHECK-LABEL: test_vdupq_lane_f64:
+ // CHECK: dup.2d v0, v0[0]
+ // CHECK-NEXT: ret
+}
+
+// vmovq_n_f64 -> dup Vd.2d,X0
+// this wasn't in <rdar://problem/11778405>, but it was between the vdups
+float64x2_t test_vmovq_n_f64(float64_t w)
+{
+ return vmovq_n_f64(w);
+ // CHECK-LABEL: test_vmovq_n_f64:
+ // CHECK: dup.2d v0, v0[0]
+ // CHECK-NEXT: ret
+}
+
+float16x4_t test_vmov_n_f16(float16_t *a1)
+{
+ // CHECK-IR-LABEL: test_vmov_n_f16
+ return vmov_n_f16(*a1);
+ // CHECK-IR: insertelement {{.*}} i32 0{{ *$}}
+ // CHECK-IR: insertelement {{.*}} i32 1{{ *$}}
+ // CHECK-IR: insertelement {{.*}} i32 2{{ *$}}
+ // CHECK-IR: insertelement {{.*}} i32 3{{ *$}}
+}
+
+// Disable until scalar problem in backend is fixed. Change CHECK-IR@ to
+// CHECK-IR<colon>
+/*
+float64x1_t test_vmov_n_f64(float64_t a1)
+{
+ // CHECK-IR@ test_vmov_n_f64
+ return vmov_n_f64(a1);
+ // CHECK-IR@ insertelement {{.*}} i32 0{{ *$}}
+}
+*/
+
+float16x8_t test_vmovq_n_f16(float16_t *a1)
+{
+ // CHECK-IR-LABEL: test_vmovq_n_f16
+ return vmovq_n_f16(*a1);
+ // CHECK-IR: insertelement {{.*}} i32 0{{ *$}}
+ // CHECK-IR: insertelement {{.*}} i32 1{{ *$}}
+ // CHECK-IR: insertelement {{.*}} i32 2{{ *$}}
+ // CHECK-IR: insertelement {{.*}} i32 3{{ *$}}
+ // CHECK-IR: insertelement {{.*}} i32 4{{ *$}}
+ // CHECK-IR: insertelement {{.*}} i32 5{{ *$}}
+ // CHECK-IR: insertelement {{.*}} i32 6{{ *$}}
+ // CHECK-IR: insertelement {{.*}} i32 7{{ *$}}
+}
+