Debian Codegraph @

clang/test/CodeGen/AArch64/neon-misc-constrained.c

raw
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
2 // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \
3 // RUN: -disable-O0-optnone -emit-llvm -o - %s \
4 // RUN: | opt -S -passes=mem2reg,sroa | FileCheck --check-prefix=UNCONSTRAINED %s
5 // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \
6 // RUN: -ffp-exception-behavior=strict \
7 // RUN: -disable-O0-optnone -emit-llvm -o - %s \
8 // RUN: | opt -S -passes=mem2reg,sroa | FileCheck --check-prefix=CONSTRAINED %s
9
10 // REQUIRES: aarch64-registered-target
11
12 // Test new aarch64 intrinsics and types but constrained
13
14 #include <arm_neon.h>
15
16 // UNCONSTRAINED-LABEL: define dso_local <2 x double> @test_vrndaq_f64(
17 // UNCONSTRAINED-SAME: <2 x double> noundef [[A:%.*]]) #[[ATTR0:[0-9]+]] {
18 // UNCONSTRAINED-NEXT: [[ENTRY:.*:]]
19 // UNCONSTRAINED-NEXT: [[TMP0:%.*]] = bitcast <2 x double> [[A]] to <2 x i64>
20 // UNCONSTRAINED-NEXT: [[TMP1:%.*]] = bitcast <2 x i64> [[TMP0]] to <16 x i8>
21 // UNCONSTRAINED-NEXT: [[VRNDA_I:%.*]] = bitcast <16 x i8> [[TMP1]] to <2 x double>
22 // UNCONSTRAINED-NEXT: [[VRNDA1_I:%.*]] = call <2 x double> @llvm.round.v2f64(<2 x double> [[VRNDA_I]])
23 // UNCONSTRAINED-NEXT: ret <2 x double> [[VRNDA1_I]]
24 //
25 // CONSTRAINED-LABEL: define dso_local <2 x double> @test_vrndaq_f64(
26 // CONSTRAINED-SAME: <2 x double> noundef [[A:%.*]]) #[[ATTR0:[0-9]+]] {
27 // CONSTRAINED-NEXT: [[ENTRY:.*:]]
28 // CONSTRAINED-NEXT: [[TMP0:%.*]] = bitcast <2 x double> [[A]] to <2 x i64>
29 // CONSTRAINED-NEXT: [[TMP1:%.*]] = bitcast <2 x i64> [[TMP0]] to <16 x i8>
30 // CONSTRAINED-NEXT: [[VRNDA_I:%.*]] = bitcast <16 x i8> [[TMP1]] to <2 x double>
31 // CONSTRAINED-NEXT: [[VRNDA1_I:%.*]] = call <2 x double> @llvm.experimental.constrained.round.v2f64(<2 x double> [[VRNDA_I]], metadata !"fpexcept.strict") #[[ATTR2:[0-9]+]]
32 // CONSTRAINED-NEXT: ret <2 x double> [[VRNDA1_I]]
33 //
34 float64x2_t test_vrndaq_f64(float64x2_t a) {
35 return vrndaq_f64(a);
36 }
37
38
39 // UNCONSTRAINED-LABEL: define dso_local <2 x double> @test_vrndpq_f64(
40 // UNCONSTRAINED-SAME: <2 x double> noundef [[A:%.*]]) #[[ATTR0]] {
41 // UNCONSTRAINED-NEXT: [[ENTRY:.*:]]
42 // UNCONSTRAINED-NEXT: [[TMP0:%.*]] = bitcast <2 x double> [[A]] to <2 x i64>
43 // UNCONSTRAINED-NEXT: [[TMP1:%.*]] = bitcast <2 x i64> [[TMP0]] to <16 x i8>
44 // UNCONSTRAINED-NEXT: [[VRNDP_I:%.*]] = bitcast <16 x i8> [[TMP1]] to <2 x double>
45 // UNCONSTRAINED-NEXT: [[VRNDP1_I:%.*]] = call <2 x double> @llvm.ceil.v2f64(<2 x double> [[VRNDP_I]])
46 // UNCONSTRAINED-NEXT: ret <2 x double> [[VRNDP1_I]]
47 //
48 // CONSTRAINED-LABEL: define dso_local <2 x double> @test_vrndpq_f64(
49 // CONSTRAINED-SAME: <2 x double> noundef [[A:%.*]]) #[[ATTR0]] {
50 // CONSTRAINED-NEXT: [[ENTRY:.*:]]
51 // CONSTRAINED-NEXT: [[TMP0:%.*]] = bitcast <2 x double> [[A]] to <2 x i64>
52 // CONSTRAINED-NEXT: [[TMP1:%.*]] = bitcast <2 x i64> [[TMP0]] to <16 x i8>
53 // CONSTRAINED-NEXT: [[VRNDP_I:%.*]] = bitcast <16 x i8> [[TMP1]] to <2 x double>
54 // CONSTRAINED-NEXT: [[VRNDP1_I:%.*]] = call <2 x double> @llvm.experimental.constrained.ceil.v2f64(<2 x double> [[VRNDP_I]], metadata !"fpexcept.strict") #[[ATTR2]]
55 // CONSTRAINED-NEXT: ret <2 x double> [[VRNDP1_I]]
56 //
57 float64x2_t test_vrndpq_f64(float64x2_t a) {
58 return vrndpq_f64(a);
59 }
60
61
62 // UNCONSTRAINED-LABEL: define dso_local <4 x float> @test_vsqrtq_f32(
63 // UNCONSTRAINED-SAME: <4 x float> noundef [[A:%.*]]) #[[ATTR0]] {
64 // UNCONSTRAINED-NEXT: [[ENTRY:.*:]]
65 // UNCONSTRAINED-NEXT: [[TMP0:%.*]] = bitcast <4 x float> [[A]] to <4 x i32>
66 // UNCONSTRAINED-NEXT: [[TMP1:%.*]] = bitcast <4 x i32> [[TMP0]] to <16 x i8>
67 // UNCONSTRAINED-NEXT: [[TMP2:%.*]] = bitcast <16 x i8> [[TMP1]] to <4 x float>
68 // UNCONSTRAINED-NEXT: [[VSQRT_I:%.*]] = call <4 x float> @llvm.sqrt.v4f32(<4 x float> [[TMP2]])
69 // UNCONSTRAINED-NEXT: ret <4 x float> [[VSQRT_I]]
70 //
71 // CONSTRAINED-LABEL: define dso_local <4 x float> @test_vsqrtq_f32(
72 // CONSTRAINED-SAME: <4 x float> noundef [[A:%.*]]) #[[ATTR0]] {
73 // CONSTRAINED-NEXT: [[ENTRY:.*:]]
74 // CONSTRAINED-NEXT: [[TMP0:%.*]] = bitcast <4 x float> [[A]] to <4 x i32>
75 // CONSTRAINED-NEXT: [[TMP1:%.*]] = bitcast <4 x i32> [[TMP0]] to <16 x i8>
76 // CONSTRAINED-NEXT: [[TMP2:%.*]] = bitcast <16 x i8> [[TMP1]] to <4 x float>
77 // CONSTRAINED-NEXT: [[VSQRT_I:%.*]] = call <4 x float> @llvm.experimental.constrained.sqrt.v4f32(<4 x float> [[TMP2]], metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR2]]
78 // CONSTRAINED-NEXT: ret <4 x float> [[VSQRT_I]]
79 //
80 float32x4_t test_vsqrtq_f32(float32x4_t a) {
81 return vsqrtq_f32(a);
82 }
83
84
85 // UNCONSTRAINED-LABEL: define dso_local <2 x double> @test_vsqrtq_f64(
86 // UNCONSTRAINED-SAME: <2 x double> noundef [[A:%.*]]) #[[ATTR0]] {
87 // UNCONSTRAINED-NEXT: [[ENTRY:.*:]]
88 // UNCONSTRAINED-NEXT: [[TMP0:%.*]] = bitcast <2 x double> [[A]] to <2 x i64>
89 // UNCONSTRAINED-NEXT: [[TMP1:%.*]] = bitcast <2 x i64> [[TMP0]] to <16 x i8>
90 // UNCONSTRAINED-NEXT: [[TMP2:%.*]] = bitcast <16 x i8> [[TMP1]] to <2 x double>
91 // UNCONSTRAINED-NEXT: [[VSQRT_I:%.*]] = call <2 x double> @llvm.sqrt.v2f64(<2 x double> [[TMP2]])
92 // UNCONSTRAINED-NEXT: ret <2 x double> [[VSQRT_I]]
93 //
94 // CONSTRAINED-LABEL: define dso_local <2 x double> @test_vsqrtq_f64(
95 // CONSTRAINED-SAME: <2 x double> noundef [[A:%.*]]) #[[ATTR0]] {
96 // CONSTRAINED-NEXT: [[ENTRY:.*:]]
97 // CONSTRAINED-NEXT: [[TMP0:%.*]] = bitcast <2 x double> [[A]] to <2 x i64>
98 // CONSTRAINED-NEXT: [[TMP1:%.*]] = bitcast <2 x i64> [[TMP0]] to <16 x i8>
99 // CONSTRAINED-NEXT: [[TMP2:%.*]] = bitcast <16 x i8> [[TMP1]] to <2 x double>
100 // CONSTRAINED-NEXT: [[VSQRT_I:%.*]] = call <2 x double> @llvm.experimental.constrained.sqrt.v2f64(<2 x double> [[TMP2]], metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR2]]
101 // CONSTRAINED-NEXT: ret <2 x double> [[VSQRT_I]]
102 //
103 float64x2_t test_vsqrtq_f64(float64x2_t a) {
104 return vsqrtq_f64(a);
105 }