aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/builtins-elementwise-math.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CodeGen/builtins-elementwise-math.c')
-rw-r--r--clang/test/CodeGen/builtins-elementwise-math.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/clang/test/CodeGen/builtins-elementwise-math.c b/clang/test/CodeGen/builtins-elementwise-math.c
index e9344d8..2df485f 100644
--- a/clang/test/CodeGen/builtins-elementwise-math.c
+++ b/clang/test/CodeGen/builtins-elementwise-math.c
@@ -6,6 +6,7 @@ typedef half half2 __attribute__((ext_vector_type(2)));
typedef float float2 __attribute__((ext_vector_type(2)));
typedef float float4 __attribute__((ext_vector_type(4)));
typedef short int si8 __attribute__((ext_vector_type(8)));
+typedef int int4 __attribute__((ext_vector_type(4)));
typedef unsigned int u4 __attribute__((ext_vector_type(4)));
typedef double double2 __attribute__((ext_vector_type(2)));
typedef double double3 __attribute__((ext_vector_type(3)));
@@ -729,6 +730,36 @@ void test_builtin_elementwise_exp10(float f1, float f2, double d1, double d2,
vf2 = __builtin_elementwise_exp10(vf1);
}
+void test_builtin_elementwise_ldexp(float f1, float f2, double d1, double d2,
+ float4 vf1, float4 vf2, int i1, int4 vi1, short s1, long l1) {
+ // CHECK-LABEL: define void @test_builtin_elementwise_ldexp(
+ // CHECK: [[F1:%.+]] = load float, ptr %f1.addr, align 4
+ // CHECK: [[I1:%.+]] = load i32, ptr %i1.addr, align 4
+ // CHECK-NEXT: call float @llvm.ldexp.f32.i32(float [[F1]], i32 [[I1]])
+ f2 = __builtin_elementwise_ldexp(f1, i1);
+
+ // CHECK: [[F2:%.+]] = load float, ptr %f1.addr, align 4
+ // CHECK: [[S1:%.+]] = load i16, ptr %s1.addr, align 2
+ // CHECK: [[Ext1:%.+]] = sext i16 [[S1]] to i32
+ // CHECK-NEXT: call float @llvm.ldexp.f32.i32(float [[F2]], i32 [[Ext1]])
+ f2 = __builtin_elementwise_ldexp(f1, s1);
+
+ // CHECK: [[F3:%.+]] = load float, ptr %f1.addr, align 4
+ // CHECK: [[L1:%.+]] = load i64, ptr %l1.addr, align 8
+ // CHECK-NEXT: call float @llvm.ldexp.f32.i64(float [[F3]], i64 [[L1]])
+ f2 = __builtin_elementwise_ldexp(f1, l1);
+
+ // CHECK: [[D1:%.+]] = load double, ptr %d1.addr, align 8
+ // CHECK: [[I2:%.+]] = load i32, ptr %i1.addr, align 4
+ // CHECK-NEXT: call double @llvm.ldexp.f64.i32(double [[D1]], i32 [[I2]])
+ d2 = __builtin_elementwise_ldexp(d1, i1);
+
+ // CHECK: [[VF1:%.+]] = load <4 x float>, ptr %vf1.addr, align 16
+ // CHECK: [[VI1:%.+]] = load <4 x i32>, ptr %vi1.addr, align 16
+ // CHECK-NEXT: call <4 x float> @llvm.ldexp.v4f32.v4i32(<4 x float> [[VF1]], <4 x i32> [[VI1]])
+ vf2 = __builtin_elementwise_ldexp(vf1, vi1);
+}
+
void test_builtin_elementwise_floor(float f1, float f2, double d1, double d2,
float4 vf1, float4 vf2) {
// CHECK-LABEL: define void @test_builtin_elementwise_floor(