From c830b83e12be13ded0523efad36ee502715c18c5 Mon Sep 17 00:00:00 2001 From: Chauhan Jaydeep Ashwinbhai Date: Wed, 12 Feb 2025 23:50:48 +0800 Subject: [PATCH 1/3] [X86][GlobalISel] Enable Trigonometric functions with libcall mapping --- .../lib/Target/X86/GISel/X86LegalizerInfo.cpp | 7 +- llvm/test/CodeGen/X86/llvm.acos.ll | 226 +++++++++++-- llvm/test/CodeGen/X86/llvm.asin.ll | 226 +++++++++++-- llvm/test/CodeGen/X86/llvm.atan.ll | 226 +++++++++++-- llvm/test/CodeGen/X86/llvm.atan2.ll | 308 +++++++++++++++--- llvm/test/CodeGen/X86/llvm.cos.ll | 110 +++++++ llvm/test/CodeGen/X86/llvm.cosh.ll | 226 +++++++++++-- llvm/test/CodeGen/X86/llvm.sin.ll | 110 +++++++ llvm/test/CodeGen/X86/llvm.sinh.ll | 226 +++++++++++-- llvm/test/CodeGen/X86/llvm.tan.ll | 226 +++++++++++-- llvm/test/CodeGen/X86/llvm.tanh.ll | 226 +++++++++++-- 11 files changed, 1848 insertions(+), 269 deletions(-) create mode 100644 llvm/test/CodeGen/X86/llvm.cos.ll create mode 100644 llvm/test/CodeGen/X86/llvm.sin.ll diff --git a/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp b/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp index c73179c4c9466..684580d6fca06 100644 --- a/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp +++ b/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp @@ -99,9 +99,10 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI, .widenScalarToNextPow2(0, /*Min=*/8) .clampScalar(0, s8, sMaxScalar); - getActionDefinitionsBuilder(G_LROUND).libcall(); - - getActionDefinitionsBuilder(G_LLROUND).libcall(); + getActionDefinitionsBuilder({G_LROUND, G_LLROUND, G_FCOS, G_FCOSH, G_FACOS, + G_FSIN, G_FSINH, G_FASIN, G_FTAN, G_FTANH, + G_FATAN, G_FATAN2}) + .libcall(); // merge/unmerge for (unsigned Op : {G_MERGE_VALUES, G_UNMERGE_VALUES}) { diff --git a/llvm/test/CodeGen/X86/llvm.acos.ll b/llvm/test/CodeGen/X86/llvm.acos.ll index 202fde8291930..bf1395d6239c9 100644 --- a/llvm/test/CodeGen/X86/llvm.acos.ll +++ b/llvm/test/CodeGen/X86/llvm.acos.ll @@ -1,63 +1,225 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s +; We don't handle fp16 and fp128 types for "-global-isel" so we allow fallbacks in these cases to SDAG. +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,GISEL-X64 define half @use_acosf16(half %a) nounwind { -; CHECK-LABEL: use_acosf16: -; CHECK: # %bb.0: -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq __extendhfsf2@PLT -; CHECK-NEXT: callq acosf@PLT -; CHECK-NEXT: callq __truncsfhf2@PLT -; CHECK-NEXT: popq %rax -; CHECK-NEXT: retq +; X86-LABEL: use_acosf16: +; X86: # %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl %eax, (%esp) +; X86-NEXT: calll __gnu_h2f_ieee +; X86-NEXT: fstps (%esp) +; X86-NEXT: calll acosf +; X86-NEXT: fstps (%esp) +; X86-NEXT: calll __gnu_f2h_ieee +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; X64-LABEL: use_acosf16: +; X64: # %bb.0: +; X64-NEXT: pushq %rax +; X64-NEXT: callq __extendhfsf2@PLT +; X64-NEXT: callq acosf@PLT +; X64-NEXT: callq __truncsfhf2@PLT +; X64-NEXT: popq %rax +; X64-NEXT: retq %x = call half @llvm.acos.f16(half %a) ret half %x } define float @use_acosf32(float %a) nounwind { -; CHECK-LABEL: use_acosf32: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp acosf@PLT # TAILCALL +; SDAG-X86-LABEL: use_acosf32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll acosf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_acosf32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp acosf@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_acosf32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll acosf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_acosf32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq acosf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call float @llvm.acos.f32(float %a) ret float %x } define double @use_acosf64(double %a) nounwind { -; CHECK-LABEL: use_acosf64: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp acos@PLT # TAILCALL +; SDAG-X86-LABEL: use_acosf64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll acos +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_acosf64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp acos@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_acosf64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll acos +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_acosf64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq acos +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call double @llvm.acos.f64(double %a) ret double %x } define x86_fp80 @use_acosf80(x86_fp80 %a) nounwind { -; CHECK-LABEL: use_acosf80: -; CHECK: # %bb.0: -; CHECK-NEXT: subq $24, %rsp -; CHECK-NEXT: fldt 32(%rsp) -; CHECK-NEXT: fstpt (%rsp) -; CHECK-NEXT: callq acosl@PLT -; CHECK-NEXT: addq $24, %rsp -; CHECK-NEXT: retq +; X86-LABEL: use_acosf80: +; X86: # %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fstpt (%esp) +; X86-NEXT: calll acosl +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; SDAG-X64-LABEL: use_acosf80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $24, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq acosl@PLT +; SDAG-X64-NEXT: addq $24, %rsp +; SDAG-X64-NEXT: retq +; +; GISEL-X64-LABEL: use_acosf80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $24, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: callq acosl +; GISEL-X64-NEXT: addq $24, %rsp +; GISEL-X64-NEXT: retq %x = call x86_fp80 @llvm.acos.f80(x86_fp80 %a) ret x86_fp80 %x } define fp128 @use_acosfp128(fp128 %a) nounwind { -; CHECK-LABEL: use_acosfp128: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp acosf128@PLT # TAILCALL +; X86-LABEL: use_acosfp128: +; X86: # %bb.0: +; X86-NEXT: pushl %edi +; X86-NEXT: pushl %esi +; X86-NEXT: subl $20, %esp +; X86-NEXT: movl {{[0-9]+}}(%esp), %esi +; X86-NEXT: subl $12, %esp +; X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl %eax +; X86-NEXT: calll acosl +; X86-NEXT: addl $28, %esp +; X86-NEXT: movl (%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; X86-NEXT: movl {{[0-9]+}}(%esp), %edi +; X86-NEXT: movl %edi, 12(%esi) +; X86-NEXT: movl %edx, 8(%esi) +; X86-NEXT: movl %ecx, 4(%esi) +; X86-NEXT: movl %eax, (%esi) +; X86-NEXT: movl %esi, %eax +; X86-NEXT: addl $20, %esp +; X86-NEXT: popl %esi +; X86-NEXT: popl %edi +; X86-NEXT: retl $4 +; +; SDAG-X64-LABEL: use_acosfp128: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp acosf128@PLT # TAILCALL +; +; GISEL-X64-LABEL: use_acosfp128: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq acosf128 +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call fp128 @llvm.acos.f128(fp128 %a) ret fp128 %x } define ppc_fp128 @use_acosppc_fp128(ppc_fp128 %a) nounwind { -; CHECK-LABEL: use_acosppc_fp128: -; CHECK: # %bb.0: -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq acosl@PLT -; CHECK-NEXT: popq %rax -; CHECK-NEXT: retq +; X86-LABEL: use_acosppc_fp128: +; X86: # %bb.0: +; X86-NEXT: subl $92, %esp +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl (%esp) +; X86-NEXT: calll acosl +; X86-NEXT: fxch %st(1) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: addl $92, %esp +; X86-NEXT: retl +; +; X64-LABEL: use_acosppc_fp128: +; X64: # %bb.0: +; X64-NEXT: pushq %rax +; X64-NEXT: callq acosl@PLT +; X64-NEXT: popq %rax +; X64-NEXT: retq %x = call ppc_fp128 @llvm.acos.ppcf128(ppc_fp128 %a) ret ppc_fp128 %x } diff --git a/llvm/test/CodeGen/X86/llvm.asin.ll b/llvm/test/CodeGen/X86/llvm.asin.ll index 1e047d01c703c..ddcf58a899240 100644 --- a/llvm/test/CodeGen/X86/llvm.asin.ll +++ b/llvm/test/CodeGen/X86/llvm.asin.ll @@ -1,63 +1,225 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s +; We don't handle fp16 and fp128 types for "-global-isel" so we allow fallbacks in these cases to SDAG. +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,GISEL-X64 define half @use_asinf16(half %a) nounwind { -; CHECK-LABEL: use_asinf16: -; CHECK: # %bb.0: -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq __extendhfsf2@PLT -; CHECK-NEXT: callq asinf@PLT -; CHECK-NEXT: callq __truncsfhf2@PLT -; CHECK-NEXT: popq %rax -; CHECK-NEXT: retq +; X86-LABEL: use_asinf16: +; X86: # %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl %eax, (%esp) +; X86-NEXT: calll __gnu_h2f_ieee +; X86-NEXT: fstps (%esp) +; X86-NEXT: calll asinf +; X86-NEXT: fstps (%esp) +; X86-NEXT: calll __gnu_f2h_ieee +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; X64-LABEL: use_asinf16: +; X64: # %bb.0: +; X64-NEXT: pushq %rax +; X64-NEXT: callq __extendhfsf2@PLT +; X64-NEXT: callq asinf@PLT +; X64-NEXT: callq __truncsfhf2@PLT +; X64-NEXT: popq %rax +; X64-NEXT: retq %x = call half @llvm.asin.f16(half %a) ret half %x } define float @use_asinf32(float %a) nounwind { -; CHECK-LABEL: use_asinf32: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp asinf@PLT # TAILCALL +; SDAG-X86-LABEL: use_asinf32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll asinf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_asinf32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp asinf@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_asinf32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll asinf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_asinf32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq asinf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call float @llvm.asin.f32(float %a) ret float %x } define double @use_asinf64(double %a) nounwind { -; CHECK-LABEL: use_asinf64: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp asin@PLT # TAILCALL +; SDAG-X86-LABEL: use_asinf64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll asin +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_asinf64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp asin@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_asinf64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll asin +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_asinf64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq asin +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call double @llvm.asin.f64(double %a) ret double %x } define x86_fp80 @use_asinf80(x86_fp80 %a) nounwind { -; CHECK-LABEL: use_asinf80: -; CHECK: # %bb.0: -; CHECK-NEXT: subq $24, %rsp -; CHECK-NEXT: fldt 32(%rsp) -; CHECK-NEXT: fstpt (%rsp) -; CHECK-NEXT: callq asinl@PLT -; CHECK-NEXT: addq $24, %rsp -; CHECK-NEXT: retq +; X86-LABEL: use_asinf80: +; X86: # %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fstpt (%esp) +; X86-NEXT: calll asinl +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; SDAG-X64-LABEL: use_asinf80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $24, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq asinl@PLT +; SDAG-X64-NEXT: addq $24, %rsp +; SDAG-X64-NEXT: retq +; +; GISEL-X64-LABEL: use_asinf80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $24, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: callq asinl +; GISEL-X64-NEXT: addq $24, %rsp +; GISEL-X64-NEXT: retq %x = call x86_fp80 @llvm.asin.f80(x86_fp80 %a) ret x86_fp80 %x } define fp128 @use_asinfp128(fp128 %a) nounwind { -; CHECK-LABEL: use_asinfp128: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp asinf128@PLT # TAILCALL +; X86-LABEL: use_asinfp128: +; X86: # %bb.0: +; X86-NEXT: pushl %edi +; X86-NEXT: pushl %esi +; X86-NEXT: subl $20, %esp +; X86-NEXT: movl {{[0-9]+}}(%esp), %esi +; X86-NEXT: subl $12, %esp +; X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl %eax +; X86-NEXT: calll asinl +; X86-NEXT: addl $28, %esp +; X86-NEXT: movl (%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; X86-NEXT: movl {{[0-9]+}}(%esp), %edi +; X86-NEXT: movl %edi, 12(%esi) +; X86-NEXT: movl %edx, 8(%esi) +; X86-NEXT: movl %ecx, 4(%esi) +; X86-NEXT: movl %eax, (%esi) +; X86-NEXT: movl %esi, %eax +; X86-NEXT: addl $20, %esp +; X86-NEXT: popl %esi +; X86-NEXT: popl %edi +; X86-NEXT: retl $4 +; +; SDAG-X64-LABEL: use_asinfp128: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp asinf128@PLT # TAILCALL +; +; GISEL-X64-LABEL: use_asinfp128: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq asinf128 +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call fp128 @llvm.asin.f128(fp128 %a) ret fp128 %x } define ppc_fp128 @use_asinppc_fp128(ppc_fp128 %a) nounwind { -; CHECK-LABEL: use_asinppc_fp128: -; CHECK: # %bb.0: -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq asinl@PLT -; CHECK-NEXT: popq %rax -; CHECK-NEXT: retq +; X86-LABEL: use_asinppc_fp128: +; X86: # %bb.0: +; X86-NEXT: subl $92, %esp +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl (%esp) +; X86-NEXT: calll asinl +; X86-NEXT: fxch %st(1) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: addl $92, %esp +; X86-NEXT: retl +; +; X64-LABEL: use_asinppc_fp128: +; X64: # %bb.0: +; X64-NEXT: pushq %rax +; X64-NEXT: callq asinl@PLT +; X64-NEXT: popq %rax +; X64-NEXT: retq %x = call ppc_fp128 @llvm.asin.ppcf128(ppc_fp128 %a) ret ppc_fp128 %x } diff --git a/llvm/test/CodeGen/X86/llvm.atan.ll b/llvm/test/CodeGen/X86/llvm.atan.ll index d33ef7fd3ac5f..8e1403c2cb904 100644 --- a/llvm/test/CodeGen/X86/llvm.atan.ll +++ b/llvm/test/CodeGen/X86/llvm.atan.ll @@ -1,63 +1,225 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s +; We don't handle fp16 and fp128 types for "-global-isel" so we allow fallbacks in these cases to SDAG. +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,GISEL-X64 define half @use_atanf16(half %a) nounwind { -; CHECK-LABEL: use_atanf16: -; CHECK: # %bb.0: -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq __extendhfsf2@PLT -; CHECK-NEXT: callq atanf@PLT -; CHECK-NEXT: callq __truncsfhf2@PLT -; CHECK-NEXT: popq %rax -; CHECK-NEXT: retq +; X86-LABEL: use_atanf16: +; X86: # %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl %eax, (%esp) +; X86-NEXT: calll __gnu_h2f_ieee +; X86-NEXT: fstps (%esp) +; X86-NEXT: calll atanf +; X86-NEXT: fstps (%esp) +; X86-NEXT: calll __gnu_f2h_ieee +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; X64-LABEL: use_atanf16: +; X64: # %bb.0: +; X64-NEXT: pushq %rax +; X64-NEXT: callq __extendhfsf2@PLT +; X64-NEXT: callq atanf@PLT +; X64-NEXT: callq __truncsfhf2@PLT +; X64-NEXT: popq %rax +; X64-NEXT: retq %x = call half @llvm.atan.f16(half %a) ret half %x } define float @use_atanf32(float %a) nounwind { -; CHECK-LABEL: use_atanf32: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp atanf@PLT # TAILCALL +; SDAG-X86-LABEL: use_atanf32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll atanf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_atanf32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp atanf@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_atanf32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll atanf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_atanf32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq atanf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call float @llvm.atan.f32(float %a) ret float %x } define double @use_atanf64(double %a) nounwind { -; CHECK-LABEL: use_atanf64: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp atan@PLT # TAILCALL +; SDAG-X86-LABEL: use_atanf64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll atan +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_atanf64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp atan@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_atanf64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll atan +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_atanf64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq atan +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call double @llvm.atan.f64(double %a) ret double %x } define x86_fp80 @use_atanf80(x86_fp80 %a) nounwind { -; CHECK-LABEL: use_atanf80: -; CHECK: # %bb.0: -; CHECK-NEXT: subq $24, %rsp -; CHECK-NEXT: fldt 32(%rsp) -; CHECK-NEXT: fstpt (%rsp) -; CHECK-NEXT: callq atanl@PLT -; CHECK-NEXT: addq $24, %rsp -; CHECK-NEXT: retq +; X86-LABEL: use_atanf80: +; X86: # %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fstpt (%esp) +; X86-NEXT: calll atanl +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; SDAG-X64-LABEL: use_atanf80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $24, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq atanl@PLT +; SDAG-X64-NEXT: addq $24, %rsp +; SDAG-X64-NEXT: retq +; +; GISEL-X64-LABEL: use_atanf80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $24, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: callq atanl +; GISEL-X64-NEXT: addq $24, %rsp +; GISEL-X64-NEXT: retq %x = call x86_fp80 @llvm.atan.f80(x86_fp80 %a) ret x86_fp80 %x } define fp128 @use_atanfp128(fp128 %a) nounwind { -; CHECK-LABEL: use_atanfp128: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp atanf128@PLT # TAILCALL +; X86-LABEL: use_atanfp128: +; X86: # %bb.0: +; X86-NEXT: pushl %edi +; X86-NEXT: pushl %esi +; X86-NEXT: subl $20, %esp +; X86-NEXT: movl {{[0-9]+}}(%esp), %esi +; X86-NEXT: subl $12, %esp +; X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl %eax +; X86-NEXT: calll atanl +; X86-NEXT: addl $28, %esp +; X86-NEXT: movl (%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; X86-NEXT: movl {{[0-9]+}}(%esp), %edi +; X86-NEXT: movl %edi, 12(%esi) +; X86-NEXT: movl %edx, 8(%esi) +; X86-NEXT: movl %ecx, 4(%esi) +; X86-NEXT: movl %eax, (%esi) +; X86-NEXT: movl %esi, %eax +; X86-NEXT: addl $20, %esp +; X86-NEXT: popl %esi +; X86-NEXT: popl %edi +; X86-NEXT: retl $4 +; +; SDAG-X64-LABEL: use_atanfp128: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp atanf128@PLT # TAILCALL +; +; GISEL-X64-LABEL: use_atanfp128: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq atanf128 +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call fp128 @llvm.atan.f128(fp128 %a) ret fp128 %x } define ppc_fp128 @use_atanppc_fp128(ppc_fp128 %a) nounwind { -; CHECK-LABEL: use_atanppc_fp128: -; CHECK: # %bb.0: -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq atanl@PLT -; CHECK-NEXT: popq %rax -; CHECK-NEXT: retq +; X86-LABEL: use_atanppc_fp128: +; X86: # %bb.0: +; X86-NEXT: subl $92, %esp +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl (%esp) +; X86-NEXT: calll atanl +; X86-NEXT: fxch %st(1) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: addl $92, %esp +; X86-NEXT: retl +; +; X64-LABEL: use_atanppc_fp128: +; X64: # %bb.0: +; X64-NEXT: pushq %rax +; X64-NEXT: callq atanl@PLT +; X64-NEXT: popq %rax +; X64-NEXT: retq %x = call ppc_fp128 @llvm.atan.ppcf128(ppc_fp128 %a) ret ppc_fp128 %x } diff --git a/llvm/test/CodeGen/X86/llvm.atan2.ll b/llvm/test/CodeGen/X86/llvm.atan2.ll index ef2e4be36203b..9fccb62d4116f 100644 --- a/llvm/test/CodeGen/X86/llvm.atan2.ll +++ b/llvm/test/CodeGen/X86/llvm.atan2.ll @@ -1,73 +1,297 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s +; We don't handle fp16 and fp128 types for "-global-isel" so we allow fallbacks in these cases to SDAG. +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,GISEL-X64 define half @use_atan2f16(half %a, half %b) nounwind { -; CHECK-LABEL: use_atan2f16: -; CHECK: # %bb.0: -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: movss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill -; CHECK-NEXT: movaps %xmm1, %xmm0 -; CHECK-NEXT: callq __extendhfsf2@PLT -; CHECK-NEXT: movss %xmm0, (%rsp) # 4-byte Spill -; CHECK-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload -; CHECK-NEXT: # xmm0 = mem[0],zero,zero,zero -; CHECK-NEXT: callq __extendhfsf2@PLT -; CHECK-NEXT: movss (%rsp), %xmm1 # 4-byte Reload -; CHECK-NEXT: # xmm1 = mem[0],zero,zero,zero -; CHECK-NEXT: callq atan2f@PLT -; CHECK-NEXT: callq __truncsfhf2@PLT -; CHECK-NEXT: popq %rax -; CHECK-NEXT: retq +; X86-LABEL: use_atan2f16: +; X86: # %bb.0: +; X86-NEXT: pushl %esi +; X86-NEXT: subl $24, %esp +; X86-NEXT: movzwl {{[0-9]+}}(%esp), %esi +; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl %eax, (%esp) +; X86-NEXT: calll __gnu_h2f_ieee +; X86-NEXT: fstps {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill +; X86-NEXT: movl %esi, (%esp) +; X86-NEXT: calll __gnu_h2f_ieee +; X86-NEXT: fstps {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload +; X86-NEXT: fstps (%esp) +; X86-NEXT: calll atan2f +; X86-NEXT: fstps (%esp) +; X86-NEXT: calll __gnu_f2h_ieee +; X86-NEXT: addl $24, %esp +; X86-NEXT: popl %esi +; X86-NEXT: retl +; +; X64-LABEL: use_atan2f16: +; X64: # %bb.0: +; X64-NEXT: pushq %rax +; X64-NEXT: movss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill +; X64-NEXT: movaps %xmm1, %xmm0 +; X64-NEXT: callq __extendhfsf2@PLT +; X64-NEXT: movss %xmm0, (%rsp) # 4-byte Spill +; X64-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload +; X64-NEXT: # xmm0 = mem[0],zero,zero,zero +; X64-NEXT: callq __extendhfsf2@PLT +; X64-NEXT: movss (%rsp), %xmm1 # 4-byte Reload +; X64-NEXT: # xmm1 = mem[0],zero,zero,zero +; X64-NEXT: callq atan2f@PLT +; X64-NEXT: callq __truncsfhf2@PLT +; X64-NEXT: popq %rax +; X64-NEXT: retq %x = call half @llvm.atan2.f16(half %a, half %b) ret half %x } define float @use_atan2f32(float %a, float %b) nounwind { -; CHECK-LABEL: use_atan2f32: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp atan2f@PLT # TAILCALL +; SDAG-X86-LABEL: use_atan2f32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll atan2f +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_atan2f32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp atan2f@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_atan2f32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: calll atan2f +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_atan2f32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq atan2f +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call float @llvm.atan2.f32(float %a, float %b) ret float %x } define double @use_atan2f64(double %a, double %b) nounwind { -; CHECK-LABEL: use_atan2f64: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp atan2@PLT # TAILCALL +; SDAG-X86-LABEL: use_atan2f64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $28, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll atan2 +; SDAG-X86-NEXT: addl $28, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_atan2f64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp atan2@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_atan2f64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: pushl %edi +; GISEL-X86-NEXT: pushl %esi +; GISEL-X86-NEXT: subl $20, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %edx +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %esi +; GISEL-X86-NEXT: movl 4(%edx), %edx +; GISEL-X86-NEXT: xorl %edi, %edi +; GISEL-X86-NEXT: addl %esp, %edi +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edi) +; GISEL-X86-NEXT: movl $8, %eax +; GISEL-X86-NEXT: addl %esp, %eax +; GISEL-X86-NEXT: movl %esi, {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: movl %edx, 4(%eax) +; GISEL-X86-NEXT: calll atan2 +; GISEL-X86-NEXT: addl $20, %esp +; GISEL-X86-NEXT: popl %esi +; GISEL-X86-NEXT: popl %edi +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_atan2f64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq atan2 +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call double @llvm.atan2.f64(double %a, double %b) ret double %x } define x86_fp80 @use_atan2f80(x86_fp80 %a, x86_fp80 %b) nounwind { -; CHECK-LABEL: use_atan2f80: -; CHECK: # %bb.0: -; CHECK-NEXT: subq $40, %rsp -; CHECK-NEXT: fldt {{[0-9]+}}(%rsp) -; CHECK-NEXT: fldt {{[0-9]+}}(%rsp) -; CHECK-NEXT: fstpt {{[0-9]+}}(%rsp) -; CHECK-NEXT: fstpt (%rsp) -; CHECK-NEXT: callq atan2l@PLT -; CHECK-NEXT: addq $40, %rsp -; CHECK-NEXT: retq +; SDAG-X86-LABEL: use_atan2f80: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $28, %esp +; SDAG-X86-NEXT: fldt {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fldt {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpt {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpt (%esp) +; SDAG-X86-NEXT: calll atan2l +; SDAG-X86-NEXT: addl $28, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_atan2f80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $40, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq atan2l@PLT +; SDAG-X64-NEXT: addq $40, %rsp +; SDAG-X64-NEXT: retq +; +; GISEL-X86-LABEL: use_atan2f80: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $28, %esp +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fstpt (%esp) +; GISEL-X86-NEXT: fstpt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: calll atan2l +; GISEL-X86-NEXT: addl $28, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_atan2f80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $40, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: fstpt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: callq atan2l +; GISEL-X64-NEXT: addq $40, %rsp +; GISEL-X64-NEXT: retq %x = call x86_fp80 @llvm.atan2.f80(x86_fp80 %a, x86_fp80 %b) ret x86_fp80 %x } define fp128 @use_atan2fp128(fp128 %a, fp128 %b) nounwind { -; CHECK-LABEL: use_atan2fp128: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp atan2f128@PLT # TAILCALL +; X86-LABEL: use_atan2fp128: +; X86: # %bb.0: +; X86-NEXT: pushl %edi +; X86-NEXT: pushl %esi +; X86-NEXT: subl $20, %esp +; X86-NEXT: movl {{[0-9]+}}(%esp), %esi +; X86-NEXT: subl $12, %esp +; X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl %eax +; X86-NEXT: calll atan2l +; X86-NEXT: addl $44, %esp +; X86-NEXT: movl (%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; X86-NEXT: movl {{[0-9]+}}(%esp), %edi +; X86-NEXT: movl %edi, 12(%esi) +; X86-NEXT: movl %edx, 8(%esi) +; X86-NEXT: movl %ecx, 4(%esi) +; X86-NEXT: movl %eax, (%esi) +; X86-NEXT: movl %esi, %eax +; X86-NEXT: addl $20, %esp +; X86-NEXT: popl %esi +; X86-NEXT: popl %edi +; X86-NEXT: retl $4 +; +; SDAG-X64-LABEL: use_atan2fp128: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp atan2f128@PLT # TAILCALL +; +; GISEL-X64-LABEL: use_atan2fp128: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq atan2f128 +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call fp128 @llvm.atan2.f128(fp128 %a, fp128 %b) ret fp128 %x } define ppc_fp128 @use_atan2ppc_fp128(ppc_fp128 %a, ppc_fp128 %b) nounwind { -; CHECK-LABEL: use_atan2ppc_fp128: -; CHECK: # %bb.0: -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq atan2l@PLT -; CHECK-NEXT: popq %rax -; CHECK-NEXT: retq +; X86-LABEL: use_atan2ppc_fp128: +; X86: # %bb.0: +; X86-NEXT: subl $140, %esp +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl (%esp) +; X86-NEXT: calll atan2l +; X86-NEXT: fxch %st(1) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: addl $140, %esp +; X86-NEXT: retl +; +; X64-LABEL: use_atan2ppc_fp128: +; X64: # %bb.0: +; X64-NEXT: pushq %rax +; X64-NEXT: callq atan2l@PLT +; X64-NEXT: popq %rax +; X64-NEXT: retq %x = call ppc_fp128 @llvm.atan2.ppcf128(ppc_fp128 %a, ppc_fp128 %b) ret ppc_fp128 %x } diff --git a/llvm/test/CodeGen/X86/llvm.cos.ll b/llvm/test/CodeGen/X86/llvm.cos.ll new file mode 100644 index 0000000000000..2ab94e1d23426 --- /dev/null +++ b/llvm/test/CodeGen/X86/llvm.cos.ll @@ -0,0 +1,110 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 +; We don't handle fp16 and fp128 types for "-global-isel" so we allow fallbacks in these cases to SDAG. +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=GISEL-X64 + +define float @test_cos_f32(float %Val) nounwind { +; SDAG-X86-LABEL: test_cos_f32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll cosf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; X64-LABEL: test_cos_f32: +; X64: # %bb.0: +; X64-NEXT: jmp cosf@PLT # TAILCALL +; +; GISEL-X86-LABEL: test_cos_f32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll cosf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: test_cos_f32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq cosf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq + %res = call float @llvm.cos.f32(float %Val) + ret float %res +} + +define double @test_cos_f64(double %Val) nounwind { +; SDAG-X86-LABEL: test_cos_f64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll cos +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; X64-LABEL: test_cos_f64: +; X64: # %bb.0: +; X64-NEXT: jmp cos@PLT # TAILCALL +; +; GISEL-X86-LABEL: test_cos_f64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll cos +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: test_cos_f64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq cos +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq + %res = call double @llvm.cos.f64(double %Val) + ret double %res +} + +define x86_fp80 @test_cos_f80(x86_fp80 %Val) nounwind { +; X86-LABEL: test_cos_f80: +; X86: # %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fstpt (%esp) +; X86-NEXT: calll cosl +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; X64-LABEL: test_cos_f80: +; X64: # %bb.0: +; X64-NEXT: subq $24, %rsp +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fstpt (%rsp) +; X64-NEXT: callq cosl@PLT +; X64-NEXT: addq $24, %rsp +; X64-NEXT: retq +; +; GISEL-X64-LABEL: test_cos_f80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $24, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: callq cosl +; GISEL-X64-NEXT: addq $24, %rsp +; GISEL-X64-NEXT: retq + %res = call x86_fp80 @llvm.cos.f80(x86_fp80 %Val) + ret x86_fp80 %res +} +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; SDAG-X64: {{.*}} diff --git a/llvm/test/CodeGen/X86/llvm.cosh.ll b/llvm/test/CodeGen/X86/llvm.cosh.ll index 5e7582c8f86a4..8f881f658e448 100644 --- a/llvm/test/CodeGen/X86/llvm.cosh.ll +++ b/llvm/test/CodeGen/X86/llvm.cosh.ll @@ -1,63 +1,225 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s +; We don't handle fp16 and fp128 types for "-global-isel" so we allow fallbacks in these cases to SDAG. +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,GISEL-X64 define half @use_coshf16(half %a) nounwind { -; CHECK-LABEL: use_coshf16: -; CHECK: # %bb.0: -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq __extendhfsf2@PLT -; CHECK-NEXT: callq coshf@PLT -; CHECK-NEXT: callq __truncsfhf2@PLT -; CHECK-NEXT: popq %rax -; CHECK-NEXT: retq +; X86-LABEL: use_coshf16: +; X86: # %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl %eax, (%esp) +; X86-NEXT: calll __gnu_h2f_ieee +; X86-NEXT: fstps (%esp) +; X86-NEXT: calll coshf +; X86-NEXT: fstps (%esp) +; X86-NEXT: calll __gnu_f2h_ieee +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; X64-LABEL: use_coshf16: +; X64: # %bb.0: +; X64-NEXT: pushq %rax +; X64-NEXT: callq __extendhfsf2@PLT +; X64-NEXT: callq coshf@PLT +; X64-NEXT: callq __truncsfhf2@PLT +; X64-NEXT: popq %rax +; X64-NEXT: retq %x = call half @llvm.cosh.f16(half %a) ret half %x } define float @use_coshf32(float %a) nounwind { -; CHECK-LABEL: use_coshf32: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp coshf@PLT # TAILCALL +; SDAG-X86-LABEL: use_coshf32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll coshf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_coshf32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp coshf@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_coshf32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll coshf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_coshf32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq coshf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call float @llvm.cosh.f32(float %a) ret float %x } define double @use_coshf64(double %a) nounwind { -; CHECK-LABEL: use_coshf64: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp cosh@PLT # TAILCALL +; SDAG-X86-LABEL: use_coshf64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll cosh +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_coshf64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp cosh@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_coshf64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll cosh +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_coshf64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq cosh +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call double @llvm.cosh.f64(double %a) ret double %x } define x86_fp80 @use_coshf80(x86_fp80 %a) nounwind { -; CHECK-LABEL: use_coshf80: -; CHECK: # %bb.0: -; CHECK-NEXT: subq $24, %rsp -; CHECK-NEXT: fldt 32(%rsp) -; CHECK-NEXT: fstpt (%rsp) -; CHECK-NEXT: callq coshl@PLT -; CHECK-NEXT: addq $24, %rsp -; CHECK-NEXT: retq +; X86-LABEL: use_coshf80: +; X86: # %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fstpt (%esp) +; X86-NEXT: calll coshl +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; SDAG-X64-LABEL: use_coshf80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $24, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq coshl@PLT +; SDAG-X64-NEXT: addq $24, %rsp +; SDAG-X64-NEXT: retq +; +; GISEL-X64-LABEL: use_coshf80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $24, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: callq coshl +; GISEL-X64-NEXT: addq $24, %rsp +; GISEL-X64-NEXT: retq %x = call x86_fp80 @llvm.cosh.f80(x86_fp80 %a) ret x86_fp80 %x } define fp128 @use_coshfp128(fp128 %a) nounwind { -; CHECK-LABEL: use_coshfp128: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp coshf128@PLT # TAILCALL +; X86-LABEL: use_coshfp128: +; X86: # %bb.0: +; X86-NEXT: pushl %edi +; X86-NEXT: pushl %esi +; X86-NEXT: subl $20, %esp +; X86-NEXT: movl {{[0-9]+}}(%esp), %esi +; X86-NEXT: subl $12, %esp +; X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl %eax +; X86-NEXT: calll coshl +; X86-NEXT: addl $28, %esp +; X86-NEXT: movl (%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; X86-NEXT: movl {{[0-9]+}}(%esp), %edi +; X86-NEXT: movl %edi, 12(%esi) +; X86-NEXT: movl %edx, 8(%esi) +; X86-NEXT: movl %ecx, 4(%esi) +; X86-NEXT: movl %eax, (%esi) +; X86-NEXT: movl %esi, %eax +; X86-NEXT: addl $20, %esp +; X86-NEXT: popl %esi +; X86-NEXT: popl %edi +; X86-NEXT: retl $4 +; +; SDAG-X64-LABEL: use_coshfp128: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp coshf128@PLT # TAILCALL +; +; GISEL-X64-LABEL: use_coshfp128: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq coshf128 +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call fp128 @llvm.cosh.f128(fp128 %a) ret fp128 %x } define ppc_fp128 @use_coshppc_fp128(ppc_fp128 %a) nounwind { -; CHECK-LABEL: use_coshppc_fp128: -; CHECK: # %bb.0: -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq coshl@PLT -; CHECK-NEXT: popq %rax -; CHECK-NEXT: retq +; X86-LABEL: use_coshppc_fp128: +; X86: # %bb.0: +; X86-NEXT: subl $92, %esp +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl (%esp) +; X86-NEXT: calll coshl +; X86-NEXT: fxch %st(1) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: addl $92, %esp +; X86-NEXT: retl +; +; X64-LABEL: use_coshppc_fp128: +; X64: # %bb.0: +; X64-NEXT: pushq %rax +; X64-NEXT: callq coshl@PLT +; X64-NEXT: popq %rax +; X64-NEXT: retq %x = call ppc_fp128 @llvm.cosh.ppcf128(ppc_fp128 %a) ret ppc_fp128 %x } diff --git a/llvm/test/CodeGen/X86/llvm.sin.ll b/llvm/test/CodeGen/X86/llvm.sin.ll new file mode 100644 index 0000000000000..e211020dc28c8 --- /dev/null +++ b/llvm/test/CodeGen/X86/llvm.sin.ll @@ -0,0 +1,110 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 +; We don't handle fp16 and fp128 types for "-global-isel" so we allow fallbacks in these cases to SDAG. +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=GISEL-X64 + +define float @test_sin_f32(float %Val) nounwind { +; SDAG-X86-LABEL: test_sin_f32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll sinf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; X64-LABEL: test_sin_f32: +; X64: # %bb.0: +; X64-NEXT: jmp sinf@PLT # TAILCALL +; +; GISEL-X86-LABEL: test_sin_f32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll sinf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: test_sin_f32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq sinf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq + %res = call float @llvm.sin.f32(float %Val) + ret float %res +} + +define double @test_sin_f64(double %Val) nounwind { +; SDAG-X86-LABEL: test_sin_f64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll sin +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; X64-LABEL: test_sin_f64: +; X64: # %bb.0: +; X64-NEXT: jmp sin@PLT # TAILCALL +; +; GISEL-X86-LABEL: test_sin_f64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll sin +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: test_sin_f64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq sin +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq + %res = call double @llvm.sin.f64(double %Val) + ret double %res +} + +define x86_fp80 @test_sin_f80(x86_fp80 %Val) nounwind { +; X86-LABEL: test_sin_f80: +; X86: # %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fstpt (%esp) +; X86-NEXT: calll sinl +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; X64-LABEL: test_sin_f80: +; X64: # %bb.0: +; X64-NEXT: subq $24, %rsp +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fstpt (%rsp) +; X64-NEXT: callq sinl@PLT +; X64-NEXT: addq $24, %rsp +; X64-NEXT: retq +; +; GISEL-X64-LABEL: test_sin_f80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $24, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: callq sinl +; GISEL-X64-NEXT: addq $24, %rsp +; GISEL-X64-NEXT: retq + %res = call x86_fp80 @llvm.sin.f80(x86_fp80 %Val) + ret x86_fp80 %res +} +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; SDAG-X64: {{.*}} diff --git a/llvm/test/CodeGen/X86/llvm.sinh.ll b/llvm/test/CodeGen/X86/llvm.sinh.ll index ba228421117f0..0e954ffd4064f 100644 --- a/llvm/test/CodeGen/X86/llvm.sinh.ll +++ b/llvm/test/CodeGen/X86/llvm.sinh.ll @@ -1,63 +1,225 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s +; We don't handle fp16 and fp128 types for "-global-isel" so we allow fallbacks in these cases to SDAG. +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,GISEL-X64 define half @use_sinhf16(half %a) nounwind { -; CHECK-LABEL: use_sinhf16: -; CHECK: # %bb.0: -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq __extendhfsf2@PLT -; CHECK-NEXT: callq sinhf@PLT -; CHECK-NEXT: callq __truncsfhf2@PLT -; CHECK-NEXT: popq %rax -; CHECK-NEXT: retq +; X86-LABEL: use_sinhf16: +; X86: # %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl %eax, (%esp) +; X86-NEXT: calll __gnu_h2f_ieee +; X86-NEXT: fstps (%esp) +; X86-NEXT: calll sinhf +; X86-NEXT: fstps (%esp) +; X86-NEXT: calll __gnu_f2h_ieee +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; X64-LABEL: use_sinhf16: +; X64: # %bb.0: +; X64-NEXT: pushq %rax +; X64-NEXT: callq __extendhfsf2@PLT +; X64-NEXT: callq sinhf@PLT +; X64-NEXT: callq __truncsfhf2@PLT +; X64-NEXT: popq %rax +; X64-NEXT: retq %x = call half @llvm.sinh.f16(half %a) ret half %x } define float @use_sinhf32(float %a) nounwind { -; CHECK-LABEL: use_sinhf32: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp sinhf@PLT # TAILCALL +; SDAG-X86-LABEL: use_sinhf32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll sinhf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_sinhf32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp sinhf@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_sinhf32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll sinhf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_sinhf32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq sinhf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call float @llvm.sinh.f32(float %a) ret float %x } define double @use_sinhf64(double %a) nounwind { -; CHECK-LABEL: use_sinhf64: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp sinh@PLT # TAILCALL +; SDAG-X86-LABEL: use_sinhf64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll sinh +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_sinhf64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp sinh@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_sinhf64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll sinh +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_sinhf64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq sinh +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call double @llvm.sinh.f64(double %a) ret double %x } define x86_fp80 @use_sinhf80(x86_fp80 %a) nounwind { -; CHECK-LABEL: use_sinhf80: -; CHECK: # %bb.0: -; CHECK-NEXT: subq $24, %rsp -; CHECK-NEXT: fldt 32(%rsp) -; CHECK-NEXT: fstpt (%rsp) -; CHECK-NEXT: callq sinhl@PLT -; CHECK-NEXT: addq $24, %rsp -; CHECK-NEXT: retq +; X86-LABEL: use_sinhf80: +; X86: # %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fstpt (%esp) +; X86-NEXT: calll sinhl +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; SDAG-X64-LABEL: use_sinhf80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $24, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq sinhl@PLT +; SDAG-X64-NEXT: addq $24, %rsp +; SDAG-X64-NEXT: retq +; +; GISEL-X64-LABEL: use_sinhf80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $24, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: callq sinhl +; GISEL-X64-NEXT: addq $24, %rsp +; GISEL-X64-NEXT: retq %x = call x86_fp80 @llvm.sinh.f80(x86_fp80 %a) ret x86_fp80 %x } define fp128 @use_sinhfp128(fp128 %a) nounwind { -; CHECK-LABEL: use_sinhfp128: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp sinhf128@PLT # TAILCALL +; X86-LABEL: use_sinhfp128: +; X86: # %bb.0: +; X86-NEXT: pushl %edi +; X86-NEXT: pushl %esi +; X86-NEXT: subl $20, %esp +; X86-NEXT: movl {{[0-9]+}}(%esp), %esi +; X86-NEXT: subl $12, %esp +; X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl %eax +; X86-NEXT: calll sinhl +; X86-NEXT: addl $28, %esp +; X86-NEXT: movl (%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; X86-NEXT: movl {{[0-9]+}}(%esp), %edi +; X86-NEXT: movl %edi, 12(%esi) +; X86-NEXT: movl %edx, 8(%esi) +; X86-NEXT: movl %ecx, 4(%esi) +; X86-NEXT: movl %eax, (%esi) +; X86-NEXT: movl %esi, %eax +; X86-NEXT: addl $20, %esp +; X86-NEXT: popl %esi +; X86-NEXT: popl %edi +; X86-NEXT: retl $4 +; +; SDAG-X64-LABEL: use_sinhfp128: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp sinhf128@PLT # TAILCALL +; +; GISEL-X64-LABEL: use_sinhfp128: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq sinhf128 +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call fp128 @llvm.sinh.f128(fp128 %a) ret fp128 %x } define ppc_fp128 @use_sinhppc_fp128(ppc_fp128 %a) nounwind { -; CHECK-LABEL: use_sinhppc_fp128: -; CHECK: # %bb.0: -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq sinhl@PLT -; CHECK-NEXT: popq %rax -; CHECK-NEXT: retq +; X86-LABEL: use_sinhppc_fp128: +; X86: # %bb.0: +; X86-NEXT: subl $92, %esp +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl (%esp) +; X86-NEXT: calll sinhl +; X86-NEXT: fxch %st(1) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: addl $92, %esp +; X86-NEXT: retl +; +; X64-LABEL: use_sinhppc_fp128: +; X64: # %bb.0: +; X64-NEXT: pushq %rax +; X64-NEXT: callq sinhl@PLT +; X64-NEXT: popq %rax +; X64-NEXT: retq %x = call ppc_fp128 @llvm.sinh.ppcf128(ppc_fp128 %a) ret ppc_fp128 %x } diff --git a/llvm/test/CodeGen/X86/llvm.tan.ll b/llvm/test/CodeGen/X86/llvm.tan.ll index 24b30038687f2..85670f714cb9b 100644 --- a/llvm/test/CodeGen/X86/llvm.tan.ll +++ b/llvm/test/CodeGen/X86/llvm.tan.ll @@ -1,63 +1,225 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s +; We don't handle fp16 and fp128 types for "-global-isel" so we allow fallbacks in these cases to SDAG. +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,GISEL-X64 define half @use_tanf16(half %a) nounwind { -; CHECK-LABEL: use_tanf16: -; CHECK: # %bb.0: -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq __extendhfsf2@PLT -; CHECK-NEXT: callq tanf@PLT -; CHECK-NEXT: callq __truncsfhf2@PLT -; CHECK-NEXT: popq %rax -; CHECK-NEXT: retq +; X86-LABEL: use_tanf16: +; X86: # %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl %eax, (%esp) +; X86-NEXT: calll __gnu_h2f_ieee +; X86-NEXT: fstps (%esp) +; X86-NEXT: calll tanf +; X86-NEXT: fstps (%esp) +; X86-NEXT: calll __gnu_f2h_ieee +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; X64-LABEL: use_tanf16: +; X64: # %bb.0: +; X64-NEXT: pushq %rax +; X64-NEXT: callq __extendhfsf2@PLT +; X64-NEXT: callq tanf@PLT +; X64-NEXT: callq __truncsfhf2@PLT +; X64-NEXT: popq %rax +; X64-NEXT: retq %x = call half @llvm.tan.f16(half %a) ret half %x } define float @use_tanf32(float %a) nounwind { -; CHECK-LABEL: use_tanf32: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp tanf@PLT # TAILCALL +; SDAG-X86-LABEL: use_tanf32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll tanf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_tanf32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp tanf@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_tanf32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll tanf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_tanf32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq tanf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call float @llvm.tan.f32(float %a) ret float %x } define double @use_tanf64(double %a) nounwind { -; CHECK-LABEL: use_tanf64: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp tan@PLT # TAILCALL +; SDAG-X86-LABEL: use_tanf64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll tan +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_tanf64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp tan@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_tanf64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll tan +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_tanf64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq tan +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call double @llvm.tan.f64(double %a) ret double %x } define x86_fp80 @use_tanf80(x86_fp80 %a) nounwind { -; CHECK-LABEL: use_tanf80: -; CHECK: # %bb.0: -; CHECK-NEXT: subq $24, %rsp -; CHECK-NEXT: fldt 32(%rsp) -; CHECK-NEXT: fstpt (%rsp) -; CHECK-NEXT: callq tanl@PLT -; CHECK-NEXT: addq $24, %rsp -; CHECK-NEXT: retq +; X86-LABEL: use_tanf80: +; X86: # %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fstpt (%esp) +; X86-NEXT: calll tanl +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; SDAG-X64-LABEL: use_tanf80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $24, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq tanl@PLT +; SDAG-X64-NEXT: addq $24, %rsp +; SDAG-X64-NEXT: retq +; +; GISEL-X64-LABEL: use_tanf80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $24, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: callq tanl +; GISEL-X64-NEXT: addq $24, %rsp +; GISEL-X64-NEXT: retq %x = call x86_fp80 @llvm.tan.f80(x86_fp80 %a) ret x86_fp80 %x } define fp128 @use_tanfp128(fp128 %a) nounwind { -; CHECK-LABEL: use_tanfp128: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp tanf128@PLT # TAILCALL +; X86-LABEL: use_tanfp128: +; X86: # %bb.0: +; X86-NEXT: pushl %edi +; X86-NEXT: pushl %esi +; X86-NEXT: subl $20, %esp +; X86-NEXT: movl {{[0-9]+}}(%esp), %esi +; X86-NEXT: subl $12, %esp +; X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl %eax +; X86-NEXT: calll tanl +; X86-NEXT: addl $28, %esp +; X86-NEXT: movl (%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; X86-NEXT: movl {{[0-9]+}}(%esp), %edi +; X86-NEXT: movl %edi, 12(%esi) +; X86-NEXT: movl %edx, 8(%esi) +; X86-NEXT: movl %ecx, 4(%esi) +; X86-NEXT: movl %eax, (%esi) +; X86-NEXT: movl %esi, %eax +; X86-NEXT: addl $20, %esp +; X86-NEXT: popl %esi +; X86-NEXT: popl %edi +; X86-NEXT: retl $4 +; +; SDAG-X64-LABEL: use_tanfp128: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp tanf128@PLT # TAILCALL +; +; GISEL-X64-LABEL: use_tanfp128: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq tanf128 +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call fp128 @llvm.tan.f128(fp128 %a) ret fp128 %x } define ppc_fp128 @use_tanppc_fp128(ppc_fp128 %a) nounwind { -; CHECK-LABEL: use_tanppc_fp128: -; CHECK: # %bb.0: -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq tanl@PLT -; CHECK-NEXT: popq %rax -; CHECK-NEXT: retq +; X86-LABEL: use_tanppc_fp128: +; X86: # %bb.0: +; X86-NEXT: subl $92, %esp +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl (%esp) +; X86-NEXT: calll tanl +; X86-NEXT: fxch %st(1) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: addl $92, %esp +; X86-NEXT: retl +; +; X64-LABEL: use_tanppc_fp128: +; X64: # %bb.0: +; X64-NEXT: pushq %rax +; X64-NEXT: callq tanl@PLT +; X64-NEXT: popq %rax +; X64-NEXT: retq %x = call ppc_fp128 @llvm.tan.ppcf128(ppc_fp128 %a) ret ppc_fp128 %x } diff --git a/llvm/test/CodeGen/X86/llvm.tanh.ll b/llvm/test/CodeGen/X86/llvm.tanh.ll index 7119c401c8040..4a5b84cf14fc3 100644 --- a/llvm/test/CodeGen/X86/llvm.tanh.ll +++ b/llvm/test/CodeGen/X86/llvm.tanh.ll @@ -1,63 +1,225 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s +; We don't handle fp16 and fp128 types for "-global-isel" so we allow fallbacks in these cases to SDAG. +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,GISEL-X64 define half @use_tanhf16(half %a) nounwind { -; CHECK-LABEL: use_tanhf16: -; CHECK: # %bb.0: -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq __extendhfsf2@PLT -; CHECK-NEXT: callq tanhf@PLT -; CHECK-NEXT: callq __truncsfhf2@PLT -; CHECK-NEXT: popq %rax -; CHECK-NEXT: retq +; X86-LABEL: use_tanhf16: +; X86: # %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl %eax, (%esp) +; X86-NEXT: calll __gnu_h2f_ieee +; X86-NEXT: fstps (%esp) +; X86-NEXT: calll tanhf +; X86-NEXT: fstps (%esp) +; X86-NEXT: calll __gnu_f2h_ieee +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; X64-LABEL: use_tanhf16: +; X64: # %bb.0: +; X64-NEXT: pushq %rax +; X64-NEXT: callq __extendhfsf2@PLT +; X64-NEXT: callq tanhf@PLT +; X64-NEXT: callq __truncsfhf2@PLT +; X64-NEXT: popq %rax +; X64-NEXT: retq %x = call half @llvm.tanh.f16(half %a) ret half %x } define float @use_tanhf32(float %a) nounwind { -; CHECK-LABEL: use_tanhf32: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp tanhf@PLT # TAILCALL +; SDAG-X86-LABEL: use_tanhf32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll tanhf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_tanhf32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp tanhf@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_tanhf32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll tanhf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_tanhf32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq tanhf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call float @llvm.tanh.f32(float %a) ret float %x } define double @use_tanhf64(double %a) nounwind { -; CHECK-LABEL: use_tanhf64: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp tanh@PLT # TAILCALL +; SDAG-X86-LABEL: use_tanhf64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll tanh +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_tanhf64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp tanh@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_tanhf64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll tanh +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_tanhf64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq tanh +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call double @llvm.tanh.f64(double %a) ret double %x } define x86_fp80 @use_tanhf80(x86_fp80 %a) nounwind { -; CHECK-LABEL: use_tanhf80: -; CHECK: # %bb.0: -; CHECK-NEXT: subq $24, %rsp -; CHECK-NEXT: fldt 32(%rsp) -; CHECK-NEXT: fstpt (%rsp) -; CHECK-NEXT: callq tanhl@PLT -; CHECK-NEXT: addq $24, %rsp -; CHECK-NEXT: retq +; X86-LABEL: use_tanhf80: +; X86: # %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fstpt (%esp) +; X86-NEXT: calll tanhl +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; SDAG-X64-LABEL: use_tanhf80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $24, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq tanhl@PLT +; SDAG-X64-NEXT: addq $24, %rsp +; SDAG-X64-NEXT: retq +; +; GISEL-X64-LABEL: use_tanhf80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $24, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: callq tanhl +; GISEL-X64-NEXT: addq $24, %rsp +; GISEL-X64-NEXT: retq %x = call x86_fp80 @llvm.tanh.f80(x86_fp80 %a) ret x86_fp80 %x } define fp128 @use_tanhfp128(fp128 %a) nounwind { -; CHECK-LABEL: use_tanhfp128: -; CHECK: # %bb.0: -; CHECK-NEXT: jmp tanhf128@PLT # TAILCALL +; X86-LABEL: use_tanhfp128: +; X86: # %bb.0: +; X86-NEXT: pushl %edi +; X86-NEXT: pushl %esi +; X86-NEXT: subl $20, %esp +; X86-NEXT: movl {{[0-9]+}}(%esp), %esi +; X86-NEXT: subl $12, %esp +; X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl {{[0-9]+}}(%esp) +; X86-NEXT: pushl %eax +; X86-NEXT: calll tanhl +; X86-NEXT: addl $28, %esp +; X86-NEXT: movl (%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; X86-NEXT: movl {{[0-9]+}}(%esp), %edi +; X86-NEXT: movl %edi, 12(%esi) +; X86-NEXT: movl %edx, 8(%esi) +; X86-NEXT: movl %ecx, 4(%esi) +; X86-NEXT: movl %eax, (%esi) +; X86-NEXT: movl %esi, %eax +; X86-NEXT: addl $20, %esp +; X86-NEXT: popl %esi +; X86-NEXT: popl %edi +; X86-NEXT: retl $4 +; +; SDAG-X64-LABEL: use_tanhfp128: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp tanhf128@PLT # TAILCALL +; +; GISEL-X64-LABEL: use_tanhfp128: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq tanhf128 +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call fp128 @llvm.tanh.f128(fp128 %a) ret fp128 %x } define ppc_fp128 @use_tanhppc_fp128(ppc_fp128 %a) nounwind { -; CHECK-LABEL: use_tanhppc_fp128: -; CHECK: # %bb.0: -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: callq tanhl@PLT -; CHECK-NEXT: popq %rax -; CHECK-NEXT: retq +; X86-LABEL: use_tanhppc_fp128: +; X86: # %bb.0: +; X86-NEXT: subl $92, %esp +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl (%esp) +; X86-NEXT: calll tanhl +; X86-NEXT: fxch %st(1) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: fstpl {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: addl $92, %esp +; X86-NEXT: retl +; +; X64-LABEL: use_tanhppc_fp128: +; X64: # %bb.0: +; X64-NEXT: pushq %rax +; X64-NEXT: callq tanhl@PLT +; X64-NEXT: popq %rax +; X64-NEXT: retq %x = call ppc_fp128 @llvm.tanh.ppcf128(ppc_fp128 %a) ret ppc_fp128 %x } From b0f840dc30996b348ee303a20a986b552426c4f6 Mon Sep 17 00:00:00 2001 From: Chauhan Jaydeep Ashwinbhai Date: Wed, 26 Feb 2025 03:41:28 -0800 Subject: [PATCH 2/3] Addressed the review comments1 --- llvm/test/CodeGen/X86/llvm.acos.ll | 117 ++++++++++++------ llvm/test/CodeGen/X86/llvm.asin.ll | 117 ++++++++++++------ llvm/test/CodeGen/X86/llvm.atan.ll | 117 ++++++++++++------ llvm/test/CodeGen/X86/llvm.atan2.ll | 179 +++++++++++++++++++--------- llvm/test/CodeGen/X86/llvm.cos.ll | 73 ++++++++---- llvm/test/CodeGen/X86/llvm.cosh.ll | 117 ++++++++++++------ llvm/test/CodeGen/X86/llvm.sin.ll | 73 ++++++++---- llvm/test/CodeGen/X86/llvm.sinh.ll | 117 ++++++++++++------ llvm/test/CodeGen/X86/llvm.tan.ll | 117 ++++++++++++------ llvm/test/CodeGen/X86/llvm.tanh.ll | 117 ++++++++++++------ 10 files changed, 777 insertions(+), 367 deletions(-) diff --git a/llvm/test/CodeGen/X86/llvm.acos.ll b/llvm/test/CodeGen/X86/llvm.acos.ll index f9ab786e3c428..9176cf47bda78 100644 --- a/llvm/test/CodeGen/X86/llvm.acos.ll +++ b/llvm/test/CodeGen/X86/llvm.acos.ll @@ -1,39 +1,76 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 ; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 -; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 -; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,GISEL-X64 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X64 define float @use_acosf32(float %a) nounwind { -; X86-LABEL: use_acosf32: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: flds {{[0-9]+}}(%esp) -; X86-NEXT: fstps (%esp) -; X86-NEXT: calll acosf -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: use_acosf32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll acosf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; -; X64-LABEL: use_acosf32: -; X64: # %bb.0: -; X64-NEXT: jmp acosf@PLT # TAILCALL +; SDAG-X64-LABEL: use_acosf32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp acosf@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_acosf32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll acosf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_acosf32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq acosf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call float @llvm.acos.f32(float %a) ret float %x } define double @use_acosf64(double %a) nounwind { -; X86-LABEL: use_acosf64: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: fldl {{[0-9]+}}(%esp) -; X86-NEXT: fstpl (%esp) -; X86-NEXT: calll acos -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: use_acosf64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll acos +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; -; X64-LABEL: use_acosf64: -; X64: # %bb.0: -; X64-NEXT: jmp acos@PLT # TAILCALL +; SDAG-X64-LABEL: use_acosf64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp acos@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_acosf64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll acos +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_acosf64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq acos +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call double @llvm.acos.f64(double %a) ret double %x } @@ -48,14 +85,23 @@ define x86_fp80 @use_acosf80(x86_fp80 %a) nounwind { ; X86-NEXT: addl $12, %esp ; X86-NEXT: retl ; -; X64-LABEL: use_acosf80: -; X64: # %bb.0: -; X64-NEXT: subq $24, %rsp -; X64-NEXT: fldt {{[0-9]+}}(%rsp) -; X64-NEXT: fstpt (%rsp) -; X64-NEXT: callq acosl@PLT -; X64-NEXT: addq $24, %rsp -; X64-NEXT: retq +; SDAG-X64-LABEL: use_acosf80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $24, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq acosl@PLT +; SDAG-X64-NEXT: addq $24, %rsp +; SDAG-X64-NEXT: retq +; +; GISEL-X64-LABEL: use_acosf80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $24, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: callq acosl +; GISEL-X64-NEXT: addq $24, %rsp +; GISEL-X64-NEXT: retq %x = call x86_fp80 @llvm.acos.f80(x86_fp80 %a) ret x86_fp80 %x } @@ -63,8 +109,3 @@ define x86_fp80 @use_acosf80(x86_fp80 %a) nounwind { declare float @llvm.acos.f32(float) declare double @llvm.acos.f64(double) declare x86_fp80 @llvm.acos.f80(x86_fp80) -;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: -; GISEL-X64: {{.*}} -; GISEL-X86: {{.*}} -; SDAG-X64: {{.*}} -; SDAG-X86: {{.*}} \ No newline at end of file diff --git a/llvm/test/CodeGen/X86/llvm.asin.ll b/llvm/test/CodeGen/X86/llvm.asin.ll index 24a2d9c492270..87ffcc9c963c2 100644 --- a/llvm/test/CodeGen/X86/llvm.asin.ll +++ b/llvm/test/CodeGen/X86/llvm.asin.ll @@ -1,39 +1,76 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 ; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 -; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 -; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,GISEL-X64 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X64 define float @use_asinf32(float %a) nounwind { -; X86-LABEL: use_asinf32: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: flds {{[0-9]+}}(%esp) -; X86-NEXT: fstps (%esp) -; X86-NEXT: calll asinf -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: use_asinf32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll asinf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; -; X64-LABEL: use_asinf32: -; X64: # %bb.0: -; X64-NEXT: jmp asinf@PLT # TAILCALL +; SDAG-X64-LABEL: use_asinf32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp asinf@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_asinf32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll asinf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_asinf32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq asinf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call float @llvm.asin.f32(float %a) ret float %x } define double @use_asinf64(double %a) nounwind { -; X86-LABEL: use_asinf64: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: fldl {{[0-9]+}}(%esp) -; X86-NEXT: fstpl (%esp) -; X86-NEXT: calll asin -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: use_asinf64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll asin +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; -; X64-LABEL: use_asinf64: -; X64: # %bb.0: -; X64-NEXT: jmp asin@PLT # TAILCALL +; SDAG-X64-LABEL: use_asinf64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp asin@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_asinf64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll asin +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_asinf64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq asin +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call double @llvm.asin.f64(double %a) ret double %x } @@ -48,14 +85,23 @@ define x86_fp80 @use_asinf80(x86_fp80 %a) nounwind { ; X86-NEXT: addl $12, %esp ; X86-NEXT: retl ; -; X64-LABEL: use_asinf80: -; X64: # %bb.0: -; X64-NEXT: subq $24, %rsp -; X64-NEXT: fldt {{[0-9]+}}(%rsp) -; X64-NEXT: fstpt (%rsp) -; X64-NEXT: callq asinl@PLT -; X64-NEXT: addq $24, %rsp -; X64-NEXT: retq +; SDAG-X64-LABEL: use_asinf80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $24, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq asinl@PLT +; SDAG-X64-NEXT: addq $24, %rsp +; SDAG-X64-NEXT: retq +; +; GISEL-X64-LABEL: use_asinf80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $24, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: callq asinl +; GISEL-X64-NEXT: addq $24, %rsp +; GISEL-X64-NEXT: retq %x = call x86_fp80 @llvm.asin.f80(x86_fp80 %a) ret x86_fp80 %x } @@ -63,8 +109,3 @@ define x86_fp80 @use_asinf80(x86_fp80 %a) nounwind { declare float @llvm.asin.f32(float) declare double @llvm.asin.f64(double) declare x86_fp80 @llvm.asin.f80(x86_fp80) -;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: -; GISEL-X64: {{.*}} -; GISEL-X86: {{.*}} -; SDAG-X64: {{.*}} -; SDAG-X86: {{.*}} \ No newline at end of file diff --git a/llvm/test/CodeGen/X86/llvm.atan.ll b/llvm/test/CodeGen/X86/llvm.atan.ll index f6f9f8f80ee85..c03361d18c1d2 100644 --- a/llvm/test/CodeGen/X86/llvm.atan.ll +++ b/llvm/test/CodeGen/X86/llvm.atan.ll @@ -1,39 +1,76 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 ; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 -; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 -; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,GISEL-X64 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X64 define float @use_atanf32(float %a) nounwind { -; X86-LABEL: use_atanf32: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: flds {{[0-9]+}}(%esp) -; X86-NEXT: fstps (%esp) -; X86-NEXT: calll atanf -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: use_atanf32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll atanf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; -; X64-LABEL: use_atanf32: -; X64: # %bb.0: -; X64-NEXT: jmp atanf@PLT # TAILCALL +; SDAG-X64-LABEL: use_atanf32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp atanf@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_atanf32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll atanf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_atanf32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq atanf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call float @llvm.atan.f32(float %a) ret float %x } define double @use_atanf64(double %a) nounwind { -; X86-LABEL: use_atanf64: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: fldl {{[0-9]+}}(%esp) -; X86-NEXT: fstpl (%esp) -; X86-NEXT: calll atan -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: use_atanf64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll atan +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; -; X64-LABEL: use_atanf64: -; X64: # %bb.0: -; X64-NEXT: jmp atan@PLT # TAILCALL +; SDAG-X64-LABEL: use_atanf64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp atan@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_atanf64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll atan +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_atanf64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq atan +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call double @llvm.atan.f64(double %a) ret double %x } @@ -48,14 +85,23 @@ define x86_fp80 @use_atanf80(x86_fp80 %a) nounwind { ; X86-NEXT: addl $12, %esp ; X86-NEXT: retl ; -; X64-LABEL: use_atanf80: -; X64: # %bb.0: -; X64-NEXT: subq $24, %rsp -; X64-NEXT: fldt {{[0-9]+}}(%rsp) -; X64-NEXT: fstpt (%rsp) -; X64-NEXT: callq atanl@PLT -; X64-NEXT: addq $24, %rsp -; X64-NEXT: retq +; SDAG-X64-LABEL: use_atanf80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $24, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq atanl@PLT +; SDAG-X64-NEXT: addq $24, %rsp +; SDAG-X64-NEXT: retq +; +; GISEL-X64-LABEL: use_atanf80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $24, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: callq atanl +; GISEL-X64-NEXT: addq $24, %rsp +; GISEL-X64-NEXT: retq %x = call x86_fp80 @llvm.atan.f80(x86_fp80 %a) ret x86_fp80 %x } @@ -63,8 +109,3 @@ define x86_fp80 @use_atanf80(x86_fp80 %a) nounwind { declare float @llvm.atan.f32(float) declare double @llvm.atan.f64(double) declare x86_fp80 @llvm.atan.f80(x86_fp80) -;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: -; GISEL-X64: {{.*}} -; GISEL-X86: {{.*}} -; SDAG-X64: {{.*}} -; SDAG-X86: {{.*}} \ No newline at end of file diff --git a/llvm/test/CodeGen/X86/llvm.atan2.ll b/llvm/test/CodeGen/X86/llvm.atan2.ll index 0b61b5cbeef3e..aa56068e17780 100644 --- a/llvm/test/CodeGen/X86/llvm.atan2.ll +++ b/llvm/test/CodeGen/X86/llvm.atan2.ll @@ -1,69 +1,143 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 -; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 -; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 -; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,GISEL-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=SDAG-X86 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X64 define float @use_atan2f32(float %a, float %b) nounwind { -; X86-LABEL: use_atan2f32: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: flds {{[0-9]+}}(%esp) -; X86-NEXT: flds {{[0-9]+}}(%esp) -; X86-NEXT: fstps {{[0-9]+}}(%esp) -; X86-NEXT: fstps (%esp) -; X86-NEXT: calll atan2f -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: use_atan2f32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll atan2f +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; -; X64-LABEL: use_atan2f32: -; X64: # %bb.0: -; X64-NEXT: jmp atan2f@PLT # TAILCALL +; SDAG-X64-LABEL: use_atan2f32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp atan2f@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_atan2f32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: calll atan2f +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_atan2f32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq atan2f +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call float @llvm.atan2.f32(float %a, float %b) ret float %x } define double @use_atan2f64(double %a, double %b) nounwind { -; X86-LABEL: use_atan2f64: -; X86: # %bb.0: -; X86-NEXT: subl $28, %esp -; X86-NEXT: fldl {{[0-9]+}}(%esp) -; X86-NEXT: fldl {{[0-9]+}}(%esp) -; X86-NEXT: fstpl {{[0-9]+}}(%esp) -; X86-NEXT: fstpl (%esp) -; X86-NEXT: calll atan2 -; X86-NEXT: addl $28, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: use_atan2f64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $28, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll atan2 +; SDAG-X86-NEXT: addl $28, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_atan2f64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp atan2@PLT # TAILCALL ; -; X64-LABEL: use_atan2f64: -; X64: # %bb.0: -; X64-NEXT: jmp atan2@PLT # TAILCALL +; GISEL-X86-LABEL: use_atan2f64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: pushl %edi +; GISEL-X86-NEXT: pushl %esi +; GISEL-X86-NEXT: subl $20, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %edx +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %esi +; GISEL-X86-NEXT: movl 4(%edx), %edx +; GISEL-X86-NEXT: xorl %edi, %edi +; GISEL-X86-NEXT: addl %esp, %edi +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edi) +; GISEL-X86-NEXT: movl $8, %eax +; GISEL-X86-NEXT: addl %esp, %eax +; GISEL-X86-NEXT: movl %esi, {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: movl %edx, 4(%eax) +; GISEL-X86-NEXT: calll atan2 +; GISEL-X86-NEXT: addl $20, %esp +; GISEL-X86-NEXT: popl %esi +; GISEL-X86-NEXT: popl %edi +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_atan2f64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq atan2 +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call double @llvm.atan2.f64(double %a, double %b) ret double %x } define x86_fp80 @use_atan2f80(x86_fp80 %a, x86_fp80 %b) nounwind { -; X86-LABEL: use_atan2f80: -; X86: # %bb.0: -; X86-NEXT: subl $28, %esp -; X86-NEXT: fldt {{[0-9]+}}(%esp) -; X86-NEXT: fldt {{[0-9]+}}(%esp) -; X86-NEXT: fstpt {{[0-9]+}}(%esp) -; X86-NEXT: fstpt (%esp) -; X86-NEXT: calll atan2l -; X86-NEXT: addl $28, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: use_atan2f80: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $28, %esp +; SDAG-X86-NEXT: fldt {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fldt {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpt {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpt (%esp) +; SDAG-X86-NEXT: calll atan2l +; SDAG-X86-NEXT: addl $28, %esp +; SDAG-X86-NEXT: retl +; +; SDAG-X64-LABEL: use_atan2f80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $40, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq atan2l@PLT +; SDAG-X64-NEXT: addq $40, %rsp +; SDAG-X64-NEXT: retq +; +; GISEL-X86-LABEL: use_atan2f80: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $28, %esp +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fstpt (%esp) +; GISEL-X86-NEXT: fstpt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: calll atan2l +; GISEL-X86-NEXT: addl $28, %esp +; GISEL-X86-NEXT: retl ; -; X64-LABEL: use_atan2f80: -; X64: # %bb.0: -; X64-NEXT: subq $40, %rsp -; X64-NEXT: fldt {{[0-9]+}}(%rsp) -; X64-NEXT: fldt {{[0-9]+}}(%rsp) -; X64-NEXT: fstpt {{[0-9]+}}(%rsp) -; X64-NEXT: fstpt (%rsp) -; X64-NEXT: callq atan2l@PLT -; X64-NEXT: addq $40, %rsp -; X64-NEXT: retq +; GISEL-X64-LABEL: use_atan2f80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $40, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: fstpt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: callq atan2l +; GISEL-X64-NEXT: addq $40, %rsp +; GISEL-X64-NEXT: retq %x = call x86_fp80 @llvm.atan2.f80(x86_fp80 %a, x86_fp80 %b) ret x86_fp80 %x } @@ -71,8 +145,3 @@ define x86_fp80 @use_atan2f80(x86_fp80 %a, x86_fp80 %b) nounwind { declare float @llvm.atan2.f32(float, float) declare double @llvm.atan2.f64(double, double) declare x86_fp80 @llvm.atan2.f80(x86_fp80, x86_fp80) -;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: -; GISEL-X64: {{.*}} -; GISEL-X86: {{.*}} -; SDAG-X64: {{.*}} -; SDAG-X86: {{.*}} \ No newline at end of file diff --git a/llvm/test/CodeGen/X86/llvm.cos.ll b/llvm/test/CodeGen/X86/llvm.cos.ll index 2687d439008f3..fc4f22fa97db3 100644 --- a/llvm/test/CodeGen/X86/llvm.cos.ll +++ b/llvm/test/CodeGen/X86/llvm.cos.ll @@ -1,47 +1,76 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 ; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 -; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 -; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=GISEL-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X64 define float @test_cos_f32(float %Val) nounwind { -; X86-LABEL: test_cos_f32: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: flds {{[0-9]+}}(%esp) -; X86-NEXT: fstps (%esp) -; X86-NEXT: calll cosf -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: test_cos_f32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll cosf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; ; X64-LABEL: test_cos_f32: ; X64: # %bb.0: ; X64-NEXT: jmp cosf@PLT # TAILCALL ; +; GISEL-X86-LABEL: test_cos_f32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll cosf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; ; GISEL-X64-LABEL: test_cos_f32: ; GISEL-X64: # %bb.0: -; GISEL-X64-NEXT: jmp cosf@PLT # TAILCALL +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq cosf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %res = call float @llvm.cos.f32(float %Val) ret float %res } define double @test_cos_f64(double %Val) nounwind { -; X86-LABEL: test_cos_f64: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: fldl {{[0-9]+}}(%esp) -; X86-NEXT: fstpl (%esp) -; X86-NEXT: calll cos -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: test_cos_f64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll cos +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; ; X64-LABEL: test_cos_f64: ; X64: # %bb.0: ; X64-NEXT: jmp cos@PLT # TAILCALL ; +; GISEL-X86-LABEL: test_cos_f64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll cos +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; ; GISEL-X64-LABEL: test_cos_f64: ; GISEL-X64: # %bb.0: -; GISEL-X64-NEXT: jmp cos@PLT # TAILCALL +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq cos +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %res = call double @llvm.cos.f64(double %Val) ret double %res } @@ -70,13 +99,11 @@ define x86_fp80 @test_cos_f80(x86_fp80 %Val) nounwind { ; GISEL-X64-NEXT: subq $24, %rsp ; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) ; GISEL-X64-NEXT: fstpt (%rsp) -; GISEL-X64-NEXT: callq cosl@PLT +; GISEL-X64-NEXT: callq cosl ; GISEL-X64-NEXT: addq $24, %rsp ; GISEL-X64-NEXT: retq %res = call x86_fp80 @llvm.cos.f80(x86_fp80 %Val) ret x86_fp80 %res } ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: -; GISEL-X86: {{.*}} ; SDAG-X64: {{.*}} -; SDAG-X86: {{.*}} \ No newline at end of file diff --git a/llvm/test/CodeGen/X86/llvm.cosh.ll b/llvm/test/CodeGen/X86/llvm.cosh.ll index 090b9c817ab21..a61867c11fd41 100644 --- a/llvm/test/CodeGen/X86/llvm.cosh.ll +++ b/llvm/test/CodeGen/X86/llvm.cosh.ll @@ -1,39 +1,76 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 ; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 -; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 -; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,GISEL-X64 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X64 define float @use_coshf32(float %a) nounwind { -; X86-LABEL: use_coshf32: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: flds {{[0-9]+}}(%esp) -; X86-NEXT: fstps (%esp) -; X86-NEXT: calll coshf -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: use_coshf32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll coshf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; -; X64-LABEL: use_coshf32: -; X64: # %bb.0: -; X64-NEXT: jmp coshf@PLT # TAILCALL +; SDAG-X64-LABEL: use_coshf32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp coshf@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_coshf32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll coshf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_coshf32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq coshf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call float @llvm.cosh.f32(float %a) ret float %x } define double @use_coshf64(double %a) nounwind { -; X86-LABEL: use_coshf64: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: fldl {{[0-9]+}}(%esp) -; X86-NEXT: fstpl (%esp) -; X86-NEXT: calll cosh -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: use_coshf64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll cosh +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; -; X64-LABEL: use_coshf64: -; X64: # %bb.0: -; X64-NEXT: jmp cosh@PLT # TAILCALL +; SDAG-X64-LABEL: use_coshf64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp cosh@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_coshf64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll cosh +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_coshf64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq cosh +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call double @llvm.cosh.f64(double %a) ret double %x } @@ -48,14 +85,23 @@ define x86_fp80 @use_coshf80(x86_fp80 %a) nounwind { ; X86-NEXT: addl $12, %esp ; X86-NEXT: retl ; -; X64-LABEL: use_coshf80: -; X64: # %bb.0: -; X64-NEXT: subq $24, %rsp -; X64-NEXT: fldt {{[0-9]+}}(%rsp) -; X64-NEXT: fstpt (%rsp) -; X64-NEXT: callq coshl@PLT -; X64-NEXT: addq $24, %rsp -; X64-NEXT: retq +; SDAG-X64-LABEL: use_coshf80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $24, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq coshl@PLT +; SDAG-X64-NEXT: addq $24, %rsp +; SDAG-X64-NEXT: retq +; +; GISEL-X64-LABEL: use_coshf80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $24, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: callq coshl +; GISEL-X64-NEXT: addq $24, %rsp +; GISEL-X64-NEXT: retq %x = call x86_fp80 @llvm.cosh.f80(x86_fp80 %a) ret x86_fp80 %x } @@ -63,8 +109,3 @@ define x86_fp80 @use_coshf80(x86_fp80 %a) nounwind { declare float @llvm.cosh.f32(float) declare double @llvm.cosh.f64(double) declare x86_fp80 @llvm.cosh.f80(x86_fp80) -;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: -; GISEL-X64: {{.*}} -; GISEL-X86: {{.*}} -; SDAG-X64: {{.*}} -; SDAG-X86: {{.*}} \ No newline at end of file diff --git a/llvm/test/CodeGen/X86/llvm.sin.ll b/llvm/test/CodeGen/X86/llvm.sin.ll index 25495d3daa3dd..e2fce6c2401aa 100644 --- a/llvm/test/CodeGen/X86/llvm.sin.ll +++ b/llvm/test/CodeGen/X86/llvm.sin.ll @@ -1,47 +1,76 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 ; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 -; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 -; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=GISEL-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X64 define float @test_sin_f32(float %Val) nounwind { -; X86-LABEL: test_sin_f32: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: flds {{[0-9]+}}(%esp) -; X86-NEXT: fstps (%esp) -; X86-NEXT: calll sinf -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: test_sin_f32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll sinf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; ; X64-LABEL: test_sin_f32: ; X64: # %bb.0: ; X64-NEXT: jmp sinf@PLT # TAILCALL ; +; GISEL-X86-LABEL: test_sin_f32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll sinf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; ; GISEL-X64-LABEL: test_sin_f32: ; GISEL-X64: # %bb.0: -; GISEL-X64-NEXT: jmp sinf@PLT # TAILCALL +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq sinf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %res = call float @llvm.sin.f32(float %Val) ret float %res } define double @test_sin_f64(double %Val) nounwind { -; X86-LABEL: test_sin_f64: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: fldl {{[0-9]+}}(%esp) -; X86-NEXT: fstpl (%esp) -; X86-NEXT: calll sin -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: test_sin_f64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll sin +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; ; X64-LABEL: test_sin_f64: ; X64: # %bb.0: ; X64-NEXT: jmp sin@PLT # TAILCALL ; +; GISEL-X86-LABEL: test_sin_f64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll sin +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; ; GISEL-X64-LABEL: test_sin_f64: ; GISEL-X64: # %bb.0: -; GISEL-X64-NEXT: jmp sin@PLT # TAILCALL +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq sin +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %res = call double @llvm.sin.f64(double %Val) ret double %res } @@ -70,13 +99,11 @@ define x86_fp80 @test_sin_f80(x86_fp80 %Val) nounwind { ; GISEL-X64-NEXT: subq $24, %rsp ; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) ; GISEL-X64-NEXT: fstpt (%rsp) -; GISEL-X64-NEXT: callq sinl@PLT +; GISEL-X64-NEXT: callq sinl ; GISEL-X64-NEXT: addq $24, %rsp ; GISEL-X64-NEXT: retq %res = call x86_fp80 @llvm.sin.f80(x86_fp80 %Val) ret x86_fp80 %res } ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: -; GISEL-X86: {{.*}} ; SDAG-X64: {{.*}} -; SDAG-X86: {{.*}} \ No newline at end of file diff --git a/llvm/test/CodeGen/X86/llvm.sinh.ll b/llvm/test/CodeGen/X86/llvm.sinh.ll index 4da0d684fd55e..ef30f8de06953 100644 --- a/llvm/test/CodeGen/X86/llvm.sinh.ll +++ b/llvm/test/CodeGen/X86/llvm.sinh.ll @@ -1,39 +1,76 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 ; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 -; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 -; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,GISEL-X64 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X64 define float @use_sinhf32(float %a) nounwind { -; X86-LABEL: use_sinhf32: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: flds {{[0-9]+}}(%esp) -; X86-NEXT: fstps (%esp) -; X86-NEXT: calll sinhf -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: use_sinhf32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll sinhf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; -; X64-LABEL: use_sinhf32: -; X64: # %bb.0: -; X64-NEXT: jmp sinhf@PLT # TAILCALL +; SDAG-X64-LABEL: use_sinhf32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp sinhf@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_sinhf32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll sinhf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_sinhf32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq sinhf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call float @llvm.sinh.f32(float %a) ret float %x } define double @use_sinhf64(double %a) nounwind { -; X86-LABEL: use_sinhf64: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: fldl {{[0-9]+}}(%esp) -; X86-NEXT: fstpl (%esp) -; X86-NEXT: calll sinh -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: use_sinhf64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll sinh +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; -; X64-LABEL: use_sinhf64: -; X64: # %bb.0: -; X64-NEXT: jmp sinh@PLT # TAILCALL +; SDAG-X64-LABEL: use_sinhf64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp sinh@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_sinhf64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll sinh +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_sinhf64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq sinh +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call double @llvm.sinh.f64(double %a) ret double %x } @@ -48,14 +85,23 @@ define x86_fp80 @use_sinhf80(x86_fp80 %a) nounwind { ; X86-NEXT: addl $12, %esp ; X86-NEXT: retl ; -; X64-LABEL: use_sinhf80: -; X64: # %bb.0: -; X64-NEXT: subq $24, %rsp -; X64-NEXT: fldt {{[0-9]+}}(%rsp) -; X64-NEXT: fstpt (%rsp) -; X64-NEXT: callq sinhl@PLT -; X64-NEXT: addq $24, %rsp -; X64-NEXT: retq +; SDAG-X64-LABEL: use_sinhf80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $24, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq sinhl@PLT +; SDAG-X64-NEXT: addq $24, %rsp +; SDAG-X64-NEXT: retq +; +; GISEL-X64-LABEL: use_sinhf80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $24, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: callq sinhl +; GISEL-X64-NEXT: addq $24, %rsp +; GISEL-X64-NEXT: retq %x = call x86_fp80 @llvm.sinh.f80(x86_fp80 %a) ret x86_fp80 %x } @@ -63,8 +109,3 @@ define x86_fp80 @use_sinhf80(x86_fp80 %a) nounwind { declare float @llvm.sinh.f32(float) declare double @llvm.sinh.f64(double) declare x86_fp80 @llvm.sinh.f80(x86_fp80) -;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: -; GISEL-X64: {{.*}} -; GISEL-X86: {{.*}} -; SDAG-X64: {{.*}} -; SDAG-X86: {{.*}} \ No newline at end of file diff --git a/llvm/test/CodeGen/X86/llvm.tan.ll b/llvm/test/CodeGen/X86/llvm.tan.ll index 519d081de0c4d..4e76653cd1299 100644 --- a/llvm/test/CodeGen/X86/llvm.tan.ll +++ b/llvm/test/CodeGen/X86/llvm.tan.ll @@ -1,39 +1,76 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 ; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 -; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 -; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,GISEL-X64 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X64 define float @use_tanf32(float %a) nounwind { -; X86-LABEL: use_tanf32: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: flds {{[0-9]+}}(%esp) -; X86-NEXT: fstps (%esp) -; X86-NEXT: calll tanf -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: use_tanf32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll tanf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; -; X64-LABEL: use_tanf32: -; X64: # %bb.0: -; X64-NEXT: jmp tanf@PLT # TAILCALL +; SDAG-X64-LABEL: use_tanf32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp tanf@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_tanf32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll tanf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_tanf32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq tanf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call float @llvm.tan.f32(float %a) ret float %x } define double @use_tanf64(double %a) nounwind { -; X86-LABEL: use_tanf64: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: fldl {{[0-9]+}}(%esp) -; X86-NEXT: fstpl (%esp) -; X86-NEXT: calll tan -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: use_tanf64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll tan +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; -; X64-LABEL: use_tanf64: -; X64: # %bb.0: -; X64-NEXT: jmp tan@PLT # TAILCALL +; SDAG-X64-LABEL: use_tanf64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp tan@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_tanf64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll tan +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_tanf64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq tan +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call double @llvm.tan.f64(double %a) ret double %x } @@ -48,14 +85,23 @@ define x86_fp80 @use_tanf80(x86_fp80 %a) nounwind { ; X86-NEXT: addl $12, %esp ; X86-NEXT: retl ; -; X64-LABEL: use_tanf80: -; X64: # %bb.0: -; X64-NEXT: subq $24, %rsp -; X64-NEXT: fldt {{[0-9]+}}(%rsp) -; X64-NEXT: fstpt (%rsp) -; X64-NEXT: callq tanl@PLT -; X64-NEXT: addq $24, %rsp -; X64-NEXT: retq +; SDAG-X64-LABEL: use_tanf80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $24, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq tanl@PLT +; SDAG-X64-NEXT: addq $24, %rsp +; SDAG-X64-NEXT: retq +; +; GISEL-X64-LABEL: use_tanf80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $24, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: callq tanl +; GISEL-X64-NEXT: addq $24, %rsp +; GISEL-X64-NEXT: retq %x = call x86_fp80 @llvm.tan.f80(x86_fp80 %a) ret x86_fp80 %x } @@ -63,8 +109,3 @@ define x86_fp80 @use_tanf80(x86_fp80 %a) nounwind { declare float @llvm.tan.f32(float) declare double @llvm.tan.f64(double) declare x86_fp80 @llvm.tan.f80(x86_fp80) -;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: -; GISEL-X64: {{.*}} -; GISEL-X86: {{.*}} -; SDAG-X64: {{.*}} -; SDAG-X86: {{.*}} \ No newline at end of file diff --git a/llvm/test/CodeGen/X86/llvm.tanh.ll b/llvm/test/CodeGen/X86/llvm.tanh.ll index de9f2138f22f2..c4f6e2f179cf9 100644 --- a/llvm/test/CodeGen/X86/llvm.tanh.ll +++ b/llvm/test/CodeGen/X86/llvm.tanh.ll @@ -1,39 +1,76 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 ; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 -; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86 -; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64,GISEL-X64 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=SDAG-X64 +; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X64 define float @use_tanhf32(float %a) nounwind { -; X86-LABEL: use_tanhf32: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: flds {{[0-9]+}}(%esp) -; X86-NEXT: fstps (%esp) -; X86-NEXT: calll tanhf -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: use_tanhf32: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstps (%esp) +; SDAG-X86-NEXT: calll tanhf +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; -; X64-LABEL: use_tanhf32: -; X64: # %bb.0: -; X64-NEXT: jmp tanhf@PLT # TAILCALL +; SDAG-X64-LABEL: use_tanhf32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp tanhf@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_tanhf32: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl %eax, (%esp) +; GISEL-X86-NEXT: calll tanhf +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_tanhf32: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq tanhf +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call float @llvm.tanh.f32(float %a) ret float %x } define double @use_tanhf64(double %a) nounwind { -; X86-LABEL: use_tanhf64: -; X86: # %bb.0: -; X86-NEXT: subl $12, %esp -; X86-NEXT: fldl {{[0-9]+}}(%esp) -; X86-NEXT: fstpl (%esp) -; X86-NEXT: calll tanh -; X86-NEXT: addl $12, %esp -; X86-NEXT: retl +; SDAG-X86-LABEL: use_tanhf64: +; SDAG-X86: # %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fstpl (%esp) +; SDAG-X86-NEXT: calll tanh +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl ; -; X64-LABEL: use_tanhf64: -; X64: # %bb.0: -; X64-NEXT: jmp tanh@PLT # TAILCALL +; SDAG-X64-LABEL: use_tanhf64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp tanh@PLT # TAILCALL +; +; GISEL-X86-LABEL: use_tanhf64: +; GISEL-X86: # %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; GISEL-X86-NEXT: movl 4(%eax), %eax +; GISEL-X86-NEXT: xorl %edx, %edx +; GISEL-X86-NEXT: addl %esp, %edx +; GISEL-X86-NEXT: movl %ecx, (%esp) +; GISEL-X86-NEXT: movl %eax, 4(%edx) +; GISEL-X86-NEXT: calll tanh +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl +; +; GISEL-X64-LABEL: use_tanhf64: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: pushq %rax +; GISEL-X64-NEXT: callq tanh +; GISEL-X64-NEXT: popq %rax +; GISEL-X64-NEXT: retq %x = call double @llvm.tanh.f64(double %a) ret double %x } @@ -48,14 +85,23 @@ define x86_fp80 @use_tanhf80(x86_fp80 %a) nounwind { ; X86-NEXT: addl $12, %esp ; X86-NEXT: retl ; -; X64-LABEL: use_tanhf80: -; X64: # %bb.0: -; X64-NEXT: subq $24, %rsp -; X64-NEXT: fldt {{[0-9]+}}(%rsp) -; X64-NEXT: fstpt (%rsp) -; X64-NEXT: callq tanhl@PLT -; X64-NEXT: addq $24, %rsp -; X64-NEXT: retq +; SDAG-X64-LABEL: use_tanhf80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $24, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq tanhl@PLT +; SDAG-X64-NEXT: addq $24, %rsp +; SDAG-X64-NEXT: retq +; +; GISEL-X64-LABEL: use_tanhf80: +; GISEL-X64: # %bb.0: +; GISEL-X64-NEXT: subq $24, %rsp +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fstpt (%rsp) +; GISEL-X64-NEXT: callq tanhl +; GISEL-X64-NEXT: addq $24, %rsp +; GISEL-X64-NEXT: retq %x = call x86_fp80 @llvm.tanh.f80(x86_fp80 %a) ret x86_fp80 %x } @@ -63,8 +109,3 @@ define x86_fp80 @use_tanhf80(x86_fp80 %a) nounwind { declare float @llvm.tanh.f32(float) declare double @llvm.tanh.f64(double) declare x86_fp80 @llvm.tanh.f80(x86_fp80) -;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: -; GISEL-X64: {{.*}} -; GISEL-X86: {{.*}} -; SDAG-X64: {{.*}} -; SDAG-X86: {{.*}} \ No newline at end of file From 526116f6635a64e67cdcf3105505e251d3e0e0da Mon Sep 17 00:00:00 2001 From: Chauhan Jaydeep Ashwinbhai Date: Wed, 26 Feb 2025 07:51:39 -0800 Subject: [PATCH 3/3] Addressed the review comments2 --- llvm/test/CodeGen/X86/llvm.cos.ll | 32 +++++++++++++++---------------- llvm/test/CodeGen/X86/llvm.sin.ll | 32 +++++++++++++++---------------- 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/llvm/test/CodeGen/X86/llvm.cos.ll b/llvm/test/CodeGen/X86/llvm.cos.ll index fc4f22fa97db3..af039854d3491 100644 --- a/llvm/test/CodeGen/X86/llvm.cos.ll +++ b/llvm/test/CodeGen/X86/llvm.cos.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 ; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=SDAG-X64 ; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86 ; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X64 @@ -14,9 +14,9 @@ define float @test_cos_f32(float %Val) nounwind { ; SDAG-X86-NEXT: addl $12, %esp ; SDAG-X86-NEXT: retl ; -; X64-LABEL: test_cos_f32: -; X64: # %bb.0: -; X64-NEXT: jmp cosf@PLT # TAILCALL +; SDAG-X64-LABEL: test_cos_f32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp cosf@PLT # TAILCALL ; ; GISEL-X86-LABEL: test_cos_f32: ; GISEL-X86: # %bb.0: @@ -47,9 +47,9 @@ define double @test_cos_f64(double %Val) nounwind { ; SDAG-X86-NEXT: addl $12, %esp ; SDAG-X86-NEXT: retl ; -; X64-LABEL: test_cos_f64: -; X64: # %bb.0: -; X64-NEXT: jmp cos@PLT # TAILCALL +; SDAG-X64-LABEL: test_cos_f64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp cos@PLT # TAILCALL ; ; GISEL-X86-LABEL: test_cos_f64: ; GISEL-X86: # %bb.0: @@ -85,14 +85,14 @@ define x86_fp80 @test_cos_f80(x86_fp80 %Val) nounwind { ; X86-NEXT: addl $12, %esp ; X86-NEXT: retl ; -; X64-LABEL: test_cos_f80: -; X64: # %bb.0: -; X64-NEXT: subq $24, %rsp -; X64-NEXT: fldt {{[0-9]+}}(%rsp) -; X64-NEXT: fstpt (%rsp) -; X64-NEXT: callq cosl@PLT -; X64-NEXT: addq $24, %rsp -; X64-NEXT: retq +; SDAG-X64-LABEL: test_cos_f80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $24, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq cosl@PLT +; SDAG-X64-NEXT: addq $24, %rsp +; SDAG-X64-NEXT: retq ; ; GISEL-X64-LABEL: test_cos_f80: ; GISEL-X64: # %bb.0: @@ -105,5 +105,3 @@ define x86_fp80 @test_cos_f80(x86_fp80 %Val) nounwind { %res = call x86_fp80 @llvm.cos.f80(x86_fp80 %Val) ret x86_fp80 %res } -;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: -; SDAG-X64: {{.*}} diff --git a/llvm/test/CodeGen/X86/llvm.sin.ll b/llvm/test/CodeGen/X86/llvm.sin.ll index e2fce6c2401aa..0f17f83d01023 100644 --- a/llvm/test/CodeGen/X86/llvm.sin.ll +++ b/llvm/test/CodeGen/X86/llvm.sin.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 ; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=X64,SDAG-X64 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 | FileCheck %s --check-prefixes=SDAG-X64 ; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86 ; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X64 @@ -14,9 +14,9 @@ define float @test_sin_f32(float %Val) nounwind { ; SDAG-X86-NEXT: addl $12, %esp ; SDAG-X86-NEXT: retl ; -; X64-LABEL: test_sin_f32: -; X64: # %bb.0: -; X64-NEXT: jmp sinf@PLT # TAILCALL +; SDAG-X64-LABEL: test_sin_f32: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp sinf@PLT # TAILCALL ; ; GISEL-X86-LABEL: test_sin_f32: ; GISEL-X86: # %bb.0: @@ -47,9 +47,9 @@ define double @test_sin_f64(double %Val) nounwind { ; SDAG-X86-NEXT: addl $12, %esp ; SDAG-X86-NEXT: retl ; -; X64-LABEL: test_sin_f64: -; X64: # %bb.0: -; X64-NEXT: jmp sin@PLT # TAILCALL +; SDAG-X64-LABEL: test_sin_f64: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: jmp sin@PLT # TAILCALL ; ; GISEL-X86-LABEL: test_sin_f64: ; GISEL-X86: # %bb.0: @@ -85,14 +85,14 @@ define x86_fp80 @test_sin_f80(x86_fp80 %Val) nounwind { ; X86-NEXT: addl $12, %esp ; X86-NEXT: retl ; -; X64-LABEL: test_sin_f80: -; X64: # %bb.0: -; X64-NEXT: subq $24, %rsp -; X64-NEXT: fldt {{[0-9]+}}(%rsp) -; X64-NEXT: fstpt (%rsp) -; X64-NEXT: callq sinl@PLT -; X64-NEXT: addq $24, %rsp -; X64-NEXT: retq +; SDAG-X64-LABEL: test_sin_f80: +; SDAG-X64: # %bb.0: +; SDAG-X64-NEXT: subq $24, %rsp +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fstpt (%rsp) +; SDAG-X64-NEXT: callq sinl@PLT +; SDAG-X64-NEXT: addq $24, %rsp +; SDAG-X64-NEXT: retq ; ; GISEL-X64-LABEL: test_sin_f80: ; GISEL-X64: # %bb.0: @@ -105,5 +105,3 @@ define x86_fp80 @test_sin_f80(x86_fp80 %Val) nounwind { %res = call x86_fp80 @llvm.sin.f80(x86_fp80 %Val) ret x86_fp80 %res } -;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: -; SDAG-X64: {{.*}}