1 // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \
2 // RUN: -disable-O0-optnone -fallow-half-arguments-and-returns -emit-llvm -o - %s \
3 // RUN: | opt -S -mem2reg | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=UNCONSTRAINED %s
4 // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \
5 // RUN: -ffp-exception-behavior=strict \
6 // RUN: -fexperimental-strict-floating-point \
7 // RUN: -disable-O0-optnone -fallow-half-arguments-and-returns -emit-llvm -o - %s \
8 // RUN: | opt -S -mem2reg | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=CONSTRAINED %s
9 // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \
10 // RUN: -disable-O0-optnone -fallow-half-arguments-and-returns -S -o - %s \
11 // RUN: | FileCheck --check-prefix=COMMON --check-prefix=CHECK-ASM %s
12 // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \
13 // RUN: -ffp-exception-behavior=strict \
14 // RUN: -fexperimental-strict-floating-point \
15 // RUN: -disable-O0-optnone -fallow-half-arguments-and-returns -S -o - %s \
16 // RUN: | FileCheck --check-prefix=COMMON --check-prefix=CHECK-ASM %s
17
18 // REQUIRES: aarch64-registered-target
19
20 // Test new aarch64 intrinsics and types but constrained
21
22 #include <arm_neon.h>
23
24 // COMMON-LABEL: test_vrndaq_f64
25 // COMMONIR: [[TMP0:%.*]] = bitcast <2 x double> %a to <16 x i8>
26 // UNCONSTRAINED: [[VRNDA1_I:%.*]] = call <2 x double> @llvm.round.v2f64(<2 x double> %a)
27 // CONSTRAINED: [[VRNDA1_I:%.*]] = call <2 x double> @llvm.experimental.constrained.round.v2f64(<2 x double> %a, metadata !"fpexcept.strict")
28 // CHECK-ASM: frinta v{{[0-9]+}}.2d, v{{[0-9]+}}.2d
29 // COMMONIR: ret <2 x double> [[VRNDA1_I]]
test_vrndaq_f64(float64x2_t a)30 float64x2_t test_vrndaq_f64(float64x2_t a) {
31 return vrndaq_f64(a);
32 }
33
34 // COMMON-LABEL: test_vrndpq_f64
35 // COMMONIR: [[TMP0:%.*]] = bitcast <2 x double> %a to <16 x i8>
36 // UNCONSTRAINED: [[VRNDP1_I:%.*]] = call <2 x double> @llvm.ceil.v2f64(<2 x double> %a)
37 // CONSTRAINED: [[VRNDP1_I:%.*]] = call <2 x double> @llvm.experimental.constrained.ceil.v2f64(<2 x double> %a, metadata !"fpexcept.strict")
38 // CHECK-ASM: frintp v{{[0-9]+}}.2d, v{{[0-9]+}}.2d
39 // COMMONIR: ret <2 x double> [[VRNDP1_I]]
test_vrndpq_f64(float64x2_t a)40 float64x2_t test_vrndpq_f64(float64x2_t a) {
41 return vrndpq_f64(a);
42 }
43
44 // COMMON-LABEL: test_vsqrtq_f32
45 // COMMONIR: [[TMP0:%.*]] = bitcast <4 x float> %a to <16 x i8>
46 // UNCONSTRAINED: [[VSQRT_I:%.*]] = call <4 x float> @llvm.sqrt.v4f32(<4 x float> %a)
47 // CONSTRAINED: [[VSQRT_I:%.*]] = call <4 x float> @llvm.experimental.constrained.sqrt.v4f32(<4 x float> %a, metadata !"round.tonearest", metadata !"fpexcept.strict")
48 // CHECK-ASM: fsqrt v{{[0-9]+}}.4s, v{{[0-9]+}}.4s
49 // COMMONIR: ret <4 x float> [[VSQRT_I]]
test_vsqrtq_f32(float32x4_t a)50 float32x4_t test_vsqrtq_f32(float32x4_t a) {
51 return vsqrtq_f32(a);
52 }
53
54 // COMMON-LABEL: test_vsqrtq_f64
55 // COMMONIR: [[TMP0:%.*]] = bitcast <2 x double> %a to <16 x i8>
56 // UNCONSTRAINED: [[VSQRT_I:%.*]] = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %a)
57 // CONSTRAINED: [[VSQRT_I:%.*]] = call <2 x double> @llvm.experimental.constrained.sqrt.v2f64(<2 x double> %a, metadata !"round.tonearest", metadata !"fpexcept.strict")
58 // CHECK-ASM: fsqrt v{{[0-9]+}}.2d, v{{[0-9]+}}.2d
59 // COMMONIR: ret <2 x double> [[VSQRT_I]]
test_vsqrtq_f64(float64x2_t a)60 float64x2_t test_vsqrtq_f64(float64x2_t a) {
61 return vsqrtq_f64(a);
62 }
63