aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/arm64_vdupq_n_f64.c
blob: ffba55cf8f560e28c1f4f574fcb463c3f2a9b845 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// RUN: %clang_cc1 -O3 -triple arm64-apple-ios7 -target-feature +neon -ffreestanding -S -o - %s | FileCheck %s
// RUN: %clang_cc1 -O3 -triple arm64-apple-ios7 -target-feature +neon -ffreestanding -S -o - -emit-llvm %s | \
// RUN:   FileCheck -check-prefix=CHECK-IR %s
// REQUIRES: aarch64-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{{ *$}}
}