builtins.c (expand_builtin): Fall back to library function call for conj...
authorRoger Sayle <roger@eyesopen.com>
Thu, 10 Jun 2004 19:46:03 +0000 (19:46 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Thu, 10 Jun 2004 19:46:03 +0000 (19:46 +0000)
* builtins.c (expand_builtin): Fall back to library function call for
conj, conjf, conjl, creal, crealf, creall, cimag, cimagf and cimagl.
(fold_builtin_1): Lower built-ins BUILT_IN_CONJ{,F,L} to CONJ_EXPR,
BUILT_IN_CREAL{,F,L} to REALPART_EXPR, and BUILT_IN_CIMAG{,F,L} to
IMAGPART_EXPR respectively.

From-SVN: r82938

gcc/ChangeLog
gcc/builtins.c

index ef9d7a37620b467f2b2951aed2ede3e7a8dfd8c7..9bf98563d42ebd49aaa27eb8e185419e56f854f8 100644 (file)
@@ -1,3 +1,11 @@
+2004-06-10  Roger Sayle  <roger@eyesopen.com>
+
+       * builtins.c (expand_builtin): Fall back to library function call for
+       conj, conjf, conjl, creal, crealf, creall, cimag, cimagf and cimagl.
+       (fold_builtin_1): Lower built-ins BUILT_IN_CONJ{,F,L} to CONJ_EXPR,
+       BUILT_IN_CREAL{,F,L} to REALPART_EXPR, and BUILT_IN_CIMAG{,F,L} to
+       IMAGPART_EXPR respectively.
+
 2004-06-10  J"orn Rennecke <joern.rennecke@superh.com>
 
        * sh.c (dump_table): New argument start.  Changed caller.
index 384173f2bd20914254d519746055ab442f4cbd71..199900e2228f908b8623ed1bcd59a17e652038ed 100644 (file)
@@ -5656,19 +5656,6 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
        }
       break;
 
-    case BUILT_IN_CONJ:
-    case BUILT_IN_CONJF:
-    case BUILT_IN_CONJL:
-    case BUILT_IN_CREAL:
-    case BUILT_IN_CREALF:
-    case BUILT_IN_CREALL:
-    case BUILT_IN_CIMAG:
-    case BUILT_IN_CIMAGF:
-    case BUILT_IN_CIMAGL:
-      /* expand_tree_builtin changes these into CONJ_EXPR, REALPART_EXPR
-        and IMAGPART_EXPR.  */
-      abort ();
-
     case BUILT_IN_EXP:
     case BUILT_IN_EXPF:
     case BUILT_IN_EXPL:
@@ -7670,6 +7657,29 @@ fold_builtin_1 (tree exp)
     case BUILT_IN_IMAXABS:
       return fold_builtin_abs (arglist, type);
 
+    case BUILT_IN_CONJ:
+    case BUILT_IN_CONJF:
+    case BUILT_IN_CONJL:
+      if (validate_arglist (arglist, COMPLEX_TYPE, VOID_TYPE))
+       return fold (build1 (CONJ_EXPR, type, TREE_VALUE (arglist)));
+      break;
+
+    case BUILT_IN_CREAL:
+    case BUILT_IN_CREALF:
+    case BUILT_IN_CREALL:
+      if (validate_arglist (arglist, COMPLEX_TYPE, VOID_TYPE))
+        return non_lvalue (fold (build1 (REALPART_EXPR, type,
+                                        TREE_VALUE (arglist))));
+      break;
+
+    case BUILT_IN_CIMAG:
+    case BUILT_IN_CIMAGF:
+    case BUILT_IN_CIMAGL:
+      if (validate_arglist (arglist, COMPLEX_TYPE, VOID_TYPE))
+        return non_lvalue (fold (build1 (IMAGPART_EXPR, type,
+                                        TREE_VALUE (arglist))));
+      break;
+
     case BUILT_IN_CABS:
     case BUILT_IN_CABSF:
     case BUILT_IN_CABSL: