[llvm-commits] CVS: llvm-gcc/gcc/llvm-expand.c

Chris Lattner lattner at cs.uiuc.edu
Wed Jul 20 17:57:11 PDT 2005



Changes in directory llvm-gcc/gcc:

llvm-expand.c updated: 1.105 -> 1.106
---
Log message:

Expand sqrt* calls to llvm.sqrt if errno doesn't matter


---
Diffs of the changes:  (+11 -3)

 llvm-expand.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)


Index: llvm-gcc/gcc/llvm-expand.c
diff -u llvm-gcc/gcc/llvm-expand.c:1.105 llvm-gcc/gcc/llvm-expand.c:1.106
--- llvm-gcc/gcc/llvm-expand.c:1.105	Wed Jul 20 14:06:48 2005
+++ llvm-gcc/gcc/llvm-expand.c	Wed Jul 20 19:56:59 2005
@@ -4683,9 +4683,6 @@
 
   /* Generate library calls for functions that we can do so for. */
   switch (fcode) {
-  case BUILT_IN_SQRT:
-  case BUILT_IN_SQRTF:
-  case BUILT_IN_SQRTL:
   case BUILT_IN_SIN:
   case BUILT_IN_SINF:
   case BUILT_IN_SINL:
@@ -4751,6 +4748,17 @@
   case BUILT_IN_NEARBYINTL:
     return llvm_expand_call (Fn, exp, DestLoc);
 
+  case BUILT_IN_SQRT:
+  case BUILT_IN_SQRTF:
+  case BUILT_IN_SQRTL:
+    // If errno math has been disabled, expand these to llvm.sqrt calls.
+    if (!flag_errno_math) {
+      return llvm_expand_builtin_unaryop(Fn, DestTy, arglist, "llvm.sqrt");
+    } else {
+      // Otherwise, expand as a call to sqrt*.
+      return llvm_expand_call (Fn, exp, DestLoc);
+    }
+    
   case BUILT_IN_MEMCPY:
     assert(DestLoc == 0 && "memcpy doesn't return aggregate!");
     return llvm_expand_builtin_memcpy(Fn, arglist);






More information about the llvm-commits mailing list