119 lines · c
1// RUN: %clang_cc1 -triple aarch64-none-linux-android24 -Wno-unused-value -fclangir -emit-cir %s -o %t.cir2// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR3// RUN: %clang_cc1 -triple aarch64-none-linux-android24 -Wno-unused-value -fclangir -emit-llvm %s -o %t-cir.ll4// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM5// RUN: %clang_cc1 -triple aarch64-none-linux-android24 -Wno-unused-value -emit-llvm %s -o %t.ll6// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG7 8typedef int vint4 __attribute__((ext_vector_type(4)));9typedef float vfloat4 __attribute__((ext_vector_type(4)));10typedef double vdouble4 __attribute__((ext_vector_type(4)));11 12void test_builtin_elementwise_acos(float f, double d, vfloat4 vf4,13 vdouble4 vd4) {14 // CIR-LABEL: test_builtin_elementwise_acos15 // LLVM-LABEL: test_builtin_elementwise_acos16 // OGCG-LABEL: test_builtin_elementwise_acos17 18 // CIR: %{{.*}} = cir.acos %{{.*}} : !cir.float19 // LLVM: %{{.*}} = call float @llvm.acos.f32(float %{{.*}})20 // OGCG: %{{.*}} = call float @llvm.acos.f32(float %{{.*}})21 f = __builtin_elementwise_acos(f);22 23 // CIR: %{{.*}} = cir.acos %{{.*}} : !cir.double24 // LLVM: %{{.*}} = call double @llvm.acos.f64(double %{{.*}})25 // OGCG: %{{.*}} = call double @llvm.acos.f64(double %{{.*}})26 d = __builtin_elementwise_acos(d);27 28 // CIR: %{{.*}} = cir.acos %{{.*}} : !cir.vector<4 x !cir.float>29 // LLVM: %{{.*}} = call <4 x float> @llvm.acos.v4f32(<4 x float> %{{.*}})30 // OGCG: %{{.*}} = call <4 x float> @llvm.acos.v4f32(<4 x float> %{{.*}})31 vf4 = __builtin_elementwise_acos(vf4);32 33 // CIR: %{{.*}} = cir.acos %{{.*}} : !cir.vector<4 x !cir.double>34 // LLVM: %{{.*}} = call <4 x double> @llvm.acos.v4f64(<4 x double> %{{.*}})35 // OGCG: %{{.*}} = call <4 x double> @llvm.acos.v4f64(<4 x double> %{{.*}})36 vd4 = __builtin_elementwise_acos(vd4);37}38 39void test_builtin_elementwise_asin(float f, double d, vfloat4 vf4,40 vdouble4 vd4) {41 // CIR-LABEL: test_builtin_elementwise_asin42 // LLVM-LABEL: test_builtin_elementwise_asin43 // OGCG-LABEL: test_builtin_elementwise_asin44 45 // CIR: %{{.*}} = cir.asin %{{.*}} : !cir.float46 // LLVM: %{{.*}} = call float @llvm.asin.f32(float %{{.*}})47 // OGCG: %{{.*}} = call float @llvm.asin.f32(float %{{.*}})48 f = __builtin_elementwise_asin(f);49 50 // CIR: %{{.*}} = cir.asin %{{.*}} : !cir.double51 // LLVM: %{{.*}} = call double @llvm.asin.f64(double %{{.*}})52 // OGCG: %{{.*}} = call double @llvm.asin.f64(double %{{.*}})53 d = __builtin_elementwise_asin(d);54 55 // CIR: %{{.*}} = cir.asin %{{.*}} : !cir.vector<4 x !cir.float>56 // LLVM: %{{.*}} = call <4 x float> @llvm.asin.v4f32(<4 x float> %{{.*}})57 // OGCG: %{{.*}} = call <4 x float> @llvm.asin.v4f32(<4 x float> %{{.*}})58 vf4 = __builtin_elementwise_asin(vf4);59 60 // CIR: %{{.*}} = cir.asin %{{.*}} : !cir.vector<4 x !cir.double>61 // LLVM: %{{.*}} = call <4 x double> @llvm.asin.v4f64(<4 x double> %{{.*}})62 // OGCG: %{{.*}} = call <4 x double> @llvm.asin.v4f64(<4 x double> %{{.*}})63 vd4 = __builtin_elementwise_asin(vd4);64}65 66void test_builtin_elementwise_atan(float f, double d, vfloat4 vf4,67 vdouble4 vd4) {68 // CIR-LABEL: test_builtin_elementwise_atan69 // LLVM-LABEL: test_builtin_elementwise_atan70 // OGCG-LABEL: test_builtin_elementwise_atan71 72 // CIR: %{{.*}} = cir.atan %{{.*}} : !cir.float73 // LLVM: %{{.*}} = call float @llvm.atan.f32(float %{{.*}})74 // OGCG: %{{.*}} = call float @llvm.atan.f32(float %{{.*}})75 f = __builtin_elementwise_atan(f);76 77 // CIR: %{{.*}} = cir.atan %{{.*}} : !cir.double78 // LLVM: %{{.*}} = call double @llvm.atan.f64(double %{{.*}})79 // OGCG: %{{.*}} = call double @llvm.atan.f64(double %{{.*}})80 d = __builtin_elementwise_atan(d);81 82 // CIR: %{{.*}} = cir.atan %{{.*}} : !cir.vector<4 x !cir.float>83 // LLVM: %{{.*}} = call <4 x float> @llvm.atan.v4f32(<4 x float> %{{.*}})84 // OGCG: %{{.*}} = call <4 x float> @llvm.atan.v4f32(<4 x float> %{{.*}})85 vf4 = __builtin_elementwise_atan(vf4);86 87 // CIR: %{{.*}} = cir.atan %{{.*}} : !cir.vector<4 x !cir.double>88 // LLVM: %{{.*}} = call <4 x double> @llvm.atan.v4f64(<4 x double> %{{.*}})89 // OGCG: %{{.*}} = call <4 x double> @llvm.atan.v4f64(<4 x double> %{{.*}})90 vd4 = __builtin_elementwise_atan(vd4);91}92 93void test_builtin_elementwise_cos(float f, double d, vfloat4 vf4,94 vdouble4 vd4) {95 // CIR-LABEL: test_builtin_elementwise_cos96 // LLVM-LABEL: test_builtin_elementwise_cos97 // OGCG-LABEL: test_builtin_elementwise_cos98 99 // CIR: {{%.*}} = cir.cos {{%.*}} : !cir.float100 // LLVM: {{%.*}} = call float @llvm.cos.f32(float {{%.*}})101 // OGCG: {{%.*}} = call float @llvm.cos.f32(float {{%.*}})102 f = __builtin_elementwise_cos(f);103 104 // CIR: {{%.*}} = cir.cos {{%.*}} : !cir.double105 // LLVM: {{%.*}} = call double @llvm.cos.f64(double {{%.*}})106 // OGCG: {{%.*}} = call double @llvm.cos.f64(double {{%.*}})107 d = __builtin_elementwise_cos(d);108 109 // CIR: {{%.*}} = cir.cos {{%.*}} : !cir.vector<4 x !cir.float>110 // LLVM: {{%.*}} = call <4 x float> @llvm.cos.v4f32(<4 x float> {{%.*}})111 // OGCG: {{%.*}} = call <4 x float> @llvm.cos.v4f32(<4 x float> {{%.*}})112 vf4 = __builtin_elementwise_cos(vf4);113 114 // CIR: {{%.*}} = cir.cos {{%.*}} : !cir.vector<4 x !cir.double>115 // LLVM: {{%.*}} = call <4 x double> @llvm.cos.v4f64(<4 x double> {{%.*}})116 // OGCG: {{%.*}} = call <4 x double> @llvm.cos.v4f64(<4 x double> {{%.*}})117 vd4 = __builtin_elementwise_cos(vd4);118}119