From dd507867efdc04a9d117cfe10bd291aa4b44ebbb Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sat, 7 Sep 2019 01:39:21 +0000 Subject: [PATCH] [X86] Add tests for fp128 frem, sqrt, sin, and cos. llvm-svn: 371283 --- llvm/test/CodeGen/X86/fp128-libcalls.ll | 87 +++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/llvm/test/CodeGen/X86/fp128-libcalls.ll b/llvm/test/CodeGen/X86/fp128-libcalls.ll index acb0870..046f9ee 100644 --- a/llvm/test/CodeGen/X86/fp128-libcalls.ll +++ b/llvm/test/CodeGen/X86/fp128-libcalls.ll @@ -148,3 +148,90 @@ entry: store fp128 %div, fp128* @vf128, align 16 ret void } + +define void @Test128Rem(fp128 %d1, fp128 %d2){ +; CHECK-LABEL: Test128Rem: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: pushq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: callq fmodl +; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip) +; CHECK-NEXT: popq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 8 +; CHECK-NEXT: retq +entry: + %div = frem fp128 %d1, %d2 + store fp128 %div, fp128* @vf128, align 16 + ret void +} + +define void @Test128_1Rem(fp128 %d1){ +; CHECK-LABEL: Test128_1Rem: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: pushq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: movaps %xmm0, %xmm1 +; CHECK-NEXT: movaps {{.*}}(%rip), %xmm0 +; CHECK-NEXT: callq fmodl +; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip) +; CHECK-NEXT: popq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 8 +; CHECK-NEXT: retq +entry: + %0 = load fp128, fp128* @vf128, align 16 + %div = frem fp128 %0, %d1 + store fp128 %div, fp128* @vf128, align 16 + ret void +} + +define void @Test128Sqrt(fp128 %d1){ +; CHECK-LABEL: Test128Sqrt: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: pushq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: callq sqrtl +; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip) +; CHECK-NEXT: popq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 8 +; CHECK-NEXT: retq +entry: + %sqrt = call fp128 @llvm.sqrt.f128(fp128 %d1) + store fp128 %sqrt, fp128* @vf128, align 16 + ret void +} +declare fp128 @llvm.sqrt.f128(fp128) + +define void @Test128Sin(fp128 %d1){ +; CHECK-LABEL: Test128Sin: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: pushq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: callq sinl +; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip) +; CHECK-NEXT: popq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 8 +; CHECK-NEXT: retq +entry: + %sqrt = call fp128 @llvm.sin.f128(fp128 %d1) + store fp128 %sqrt, fp128* @vf128, align 16 + ret void +} +declare fp128 @llvm.sin.f128(fp128) + +define void @Test128Cos(fp128 %d1){ +; CHECK-LABEL: Test128Cos: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: pushq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: callq cosl +; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip) +; CHECK-NEXT: popq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 8 +; CHECK-NEXT: retq +entry: + %sqrt = call fp128 @llvm.cos.f128(fp128 %d1) + store fp128 %sqrt, fp128* @vf128, align 16 + ret void +} +declare fp128 @llvm.cos.f128(fp128) + -- 2.7.4