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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
// RUN: %clang_cc1 -triple aarch64-none-linux-android24 -Wno-unused-value -fclangir -emit-cir %s -o %t.cir
// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
// RUN: %clang_cc1 -triple aarch64-none-linux-android24 -Wno-unused-value -fclangir -emit-llvm %s -o %t-cir.ll
// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM
// RUN: %clang_cc1 -triple aarch64-none-linux-android24 -Wno-unused-value -emit-llvm %s -o %t.ll
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG
typedef int vint4 __attribute__((ext_vector_type(4)));
typedef float vfloat4 __attribute__((ext_vector_type(4)));
typedef double vdouble4 __attribute__((ext_vector_type(4)));
void test_builtin_elementwise_acos(float f, double d, vfloat4 vf4,
vdouble4 vd4) {
// CIR-LABEL: test_builtin_elementwise_acos
// LLVM-LABEL: test_builtin_elementwise_acos
// OGCG-LABEL: test_builtin_elementwise_acos
// CIR: %{{.*}} = cir.acos %{{.*}} : !cir.float
// LLVM: %{{.*}} = call float @llvm.acos.f32(float %{{.*}})
// OGCG: %{{.*}} = call float @llvm.acos.f32(float %{{.*}})
f = __builtin_elementwise_acos(f);
// CIR: %{{.*}} = cir.acos %{{.*}} : !cir.double
// LLVM: %{{.*}} = call double @llvm.acos.f64(double %{{.*}})
// OGCG: %{{.*}} = call double @llvm.acos.f64(double %{{.*}})
d = __builtin_elementwise_acos(d);
// CIR: %{{.*}} = cir.acos %{{.*}} : !cir.vector<4 x !cir.float>
// LLVM: %{{.*}} = call <4 x float> @llvm.acos.v4f32(<4 x float> %{{.*}})
// OGCG: %{{.*}} = call <4 x float> @llvm.acos.v4f32(<4 x float> %{{.*}})
vf4 = __builtin_elementwise_acos(vf4);
// CIR: %{{.*}} = cir.acos %{{.*}} : !cir.vector<4 x !cir.double>
// LLVM: %{{.*}} = call <4 x double> @llvm.acos.v4f64(<4 x double> %{{.*}})
// OGCG: %{{.*}} = call <4 x double> @llvm.acos.v4f64(<4 x double> %{{.*}})
vd4 = __builtin_elementwise_acos(vd4);
}
void test_builtin_elementwise_asin(float f, double d, vfloat4 vf4,
vdouble4 vd4) {
// CIR-LABEL: test_builtin_elementwise_asin
// LLVM-LABEL: test_builtin_elementwise_asin
// OGCG-LABEL: test_builtin_elementwise_asin
// CIR: %{{.*}} = cir.asin %{{.*}} : !cir.float
// LLVM: %{{.*}} = call float @llvm.asin.f32(float %{{.*}})
// OGCG: %{{.*}} = call float @llvm.asin.f32(float %{{.*}})
f = __builtin_elementwise_asin(f);
// CIR: %{{.*}} = cir.asin %{{.*}} : !cir.double
// LLVM: %{{.*}} = call double @llvm.asin.f64(double %{{.*}})
// OGCG: %{{.*}} = call double @llvm.asin.f64(double %{{.*}})
d = __builtin_elementwise_asin(d);
// CIR: %{{.*}} = cir.asin %{{.*}} : !cir.vector<4 x !cir.float>
// LLVM: %{{.*}} = call <4 x float> @llvm.asin.v4f32(<4 x float> %{{.*}})
// OGCG: %{{.*}} = call <4 x float> @llvm.asin.v4f32(<4 x float> %{{.*}})
vf4 = __builtin_elementwise_asin(vf4);
// CIR: %{{.*}} = cir.asin %{{.*}} : !cir.vector<4 x !cir.double>
// LLVM: %{{.*}} = call <4 x double> @llvm.asin.v4f64(<4 x double> %{{.*}})
// OGCG: %{{.*}} = call <4 x double> @llvm.asin.v4f64(<4 x double> %{{.*}})
vd4 = __builtin_elementwise_asin(vd4);
}
void test_builtin_elementwise_atan(float f, double d, vfloat4 vf4,
vdouble4 vd4) {
// CIR-LABEL: test_builtin_elementwise_atan
// LLVM-LABEL: test_builtin_elementwise_atan
// OGCG-LABEL: test_builtin_elementwise_atan
// CIR: %{{.*}} = cir.atan %{{.*}} : !cir.float
// LLVM: %{{.*}} = call float @llvm.atan.f32(float %{{.*}})
// OGCG: %{{.*}} = call float @llvm.atan.f32(float %{{.*}})
f = __builtin_elementwise_atan(f);
// CIR: %{{.*}} = cir.atan %{{.*}} : !cir.double
// LLVM: %{{.*}} = call double @llvm.atan.f64(double %{{.*}})
// OGCG: %{{.*}} = call double @llvm.atan.f64(double %{{.*}})
d = __builtin_elementwise_atan(d);
// CIR: %{{.*}} = cir.atan %{{.*}} : !cir.vector<4 x !cir.float>
// LLVM: %{{.*}} = call <4 x float> @llvm.atan.v4f32(<4 x float> %{{.*}})
// OGCG: %{{.*}} = call <4 x float> @llvm.atan.v4f32(<4 x float> %{{.*}})
vf4 = __builtin_elementwise_atan(vf4);
// CIR: %{{.*}} = cir.atan %{{.*}} : !cir.vector<4 x !cir.double>
// LLVM: %{{.*}} = call <4 x double> @llvm.atan.v4f64(<4 x double> %{{.*}})
// OGCG: %{{.*}} = call <4 x double> @llvm.atan.v4f64(<4 x double> %{{.*}})
vd4 = __builtin_elementwise_atan(vd4);
}
void test_builtin_elementwise_cos(float f, double d, vfloat4 vf4,
vdouble4 vd4) {
// CIR-LABEL: test_builtin_elementwise_cos
// LLVM-LABEL: test_builtin_elementwise_cos
// OGCG-LABEL: test_builtin_elementwise_cos
// CIR: {{%.*}} = cir.cos {{%.*}} : !cir.float
// LLVM: {{%.*}} = call float @llvm.cos.f32(float {{%.*}})
// OGCG: {{%.*}} = call float @llvm.cos.f32(float {{%.*}})
f = __builtin_elementwise_cos(f);
// CIR: {{%.*}} = cir.cos {{%.*}} : !cir.double
// LLVM: {{%.*}} = call double @llvm.cos.f64(double {{%.*}})
// OGCG: {{%.*}} = call double @llvm.cos.f64(double {{%.*}})
d = __builtin_elementwise_cos(d);
// CIR: {{%.*}} = cir.cos {{%.*}} : !cir.vector<4 x !cir.float>
// LLVM: {{%.*}} = call <4 x float> @llvm.cos.v4f32(<4 x float> {{%.*}})
// OGCG: {{%.*}} = call <4 x float> @llvm.cos.v4f32(<4 x float> {{%.*}})
vf4 = __builtin_elementwise_cos(vf4);
// CIR: {{%.*}} = cir.cos {{%.*}} : !cir.vector<4 x !cir.double>
// LLVM: {{%.*}} = call <4 x double> @llvm.cos.v4f64(<4 x double> {{%.*}})
// OGCG: {{%.*}} = call <4 x double> @llvm.cos.v4f64(<4 x double> {{%.*}})
vd4 = __builtin_elementwise_cos(vd4);
}
|