[PATCH] D35748: [CodeGen][X86] Fuchsia supports sincos* libcalls and sin+cos->sincos optimization

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 23 15:30:49 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL308854: [CodeGen][X86] Fuchsia supports sincos* libcalls and sin+cos->sincos… (authored by phosek).

Changed prior to commit:
  https://reviews.llvm.org/D35748?vs=107753&id=107844#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35748

Files:
  llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp
  llvm/trunk/lib/Target/X86/X86Subtarget.cpp
  llvm/trunk/test/CodeGen/X86/sincos-opt.ll


Index: llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp
+++ llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp
@@ -97,7 +97,7 @@
     Names[RTLIB::FPROUND_F32_F16] = "__gnu_f2h_ieee";
   }
 
-  if (TT.isGNUEnvironment()) {
+  if (TT.isGNUEnvironment() || TT.isOSFuchsia()) {
     Names[RTLIB::SINCOS_F32] = "sincosf";
     Names[RTLIB::SINCOS_F64] = "sincos";
     Names[RTLIB::SINCOS_F80] = "sincosl";
Index: llvm/trunk/lib/Target/X86/X86Subtarget.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.cpp
+++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp
@@ -189,9 +189,12 @@
 }
 
 bool X86Subtarget::hasSinCos() const {
-  return getTargetTriple().isMacOSX() &&
-    !getTargetTriple().isMacOSXVersionLT(10, 9) &&
-    is64Bit();
+  if (getTargetTriple().isMacOSX()) {
+    return !getTargetTriple().isMacOSXVersionLT(10, 9) && is64Bit();
+  } else if (getTargetTriple().isOSFuchsia()) {
+    return true;
+  }
+  return false;
 }
 
 /// Return true if the subtarget allows calls to immediate address.
Index: llvm/trunk/test/CodeGen/X86/sincos-opt.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/sincos-opt.ll
+++ llvm/trunk/test/CodeGen/X86/sincos-opt.ll
@@ -3,6 +3,8 @@
 ; RUN: llc < %s -mtriple=x86_64-pc-linux-gnu -mcpu=core2 | FileCheck %s --check-prefix=GNU_SINCOS
 ; RUN: llc < %s -mtriple=x86_64-pc-linux-gnu -mcpu=core2 -enable-unsafe-fp-math | FileCheck %s --check-prefix=GNU_SINCOS_FASTMATH
 ; RUN: llc < %s -mtriple=x86_64-pc-linux-gnux32 -mcpu=core2 -enable-unsafe-fp-math | FileCheck %s --check-prefix=GNU_SINCOS_FASTMATH
+; RUN: llc < %s -mtriple=x86_64-fuchsia -mcpu=core2 | FileCheck %s --check-prefix=GNU_SINCOS
+; RUN: llc < %s -mtriple=x86_64-fuchsia -mcpu=core2 -enable-unsafe-fp-math | FileCheck %s --check-prefix=GNU_SINCOS_FASTMATH
 
 ; Combine sin / cos into a single call unless they may write errno (as
 ; captured by readnone attrbiute, controlled by clang -fmath-errno


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35748.107844.patch
Type: text/x-patch
Size: 2124 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170723/8382672b/attachment.bin>


More information about the llvm-commits mailing list