becopyopt: Inline the thin wrapper nodes_interfere(), so we do not need to fetch...
[libfirm] / ir / be / sparc / sparc_lower64.c
index 0e9e5b0..da627f7 100644 (file)
@@ -1,20 +1,6 @@
 /*
- * Copyright (C) 1995-2010 University of Karlsruhe.  All right reserved.
- *
  * This file is part of libFirm.
- *
- * This file may be distributed and/or modified under the terms of the
- * GNU General Public License version 2 as published by the Free Software
- * Foundation and appearing in the file LICENSE.GPL included in the
- * packaging of this file.
- *
- * Licensees holding valid libFirm Professional Edition licenses may use
- * this file in accordance with the libFirm Commercial License.
- * Agreement provided with the Software.
- *
- * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
- * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE.
+ * Copyright (C) 2012 University of Karlsruhe.
  */
 
 /**
@@ -25,6 +11,7 @@
 #include "config.h"
 
 #include "bearch_sparc_t.h"
+#include "error.h"
 #include "gen_sparc_new_nodes.h"
 #include "lower_dw.h"
 #include "ircons_t.h"
@@ -105,6 +92,30 @@ static ir_entity *create_64_intrinsic_fkt(ir_type *method, const ir_op *op,
                name = mode_is_signed(imode) ? "__divdi3" : "__udivdi3";
        } else if (op == op_Mod) {
                name = mode_is_signed(imode) ? "__moddi3" : "__umoddi3";
+       } else if (op == op_Conv) {
+               if (mode_is_float(imode)) {
+                       assert(get_mode_size_bits(omode) == 64);
+                       if (get_mode_size_bits(imode) == 64) {
+                               name = mode_is_signed(omode) ? "__fixdfdi" : "__fixunsdfdi";
+                       } else if (get_mode_size_bits(imode) == 32) {
+                               name = mode_is_signed(omode) ? "__fixsfdi" : "__fixunssfdi";
+                       } else {
+                               assert(get_mode_size_bits(imode) == 128);
+                               panic("can't conver long double to long long yet");
+                       }
+               } else if (mode_is_float(omode)) {
+                       assert(get_mode_size_bits(imode) == 64);
+                       if (get_mode_size_bits(omode) == 64) {
+                               name = mode_is_signed(imode) ? "__floatdidf" : "__floatundidf";
+                       } else if (get_mode_size_bits(omode) == 32) {
+                               name = mode_is_signed(imode) ? "__floatdisf" : "__floatundisf";
+                       } else {
+                               assert(get_mode_size_bits(omode) == 128);
+                               panic("can't convert long long to long double yet");
+                       }
+               } else {
+                       panic("can't lower 64bit Conv");
+               }
        } else {
                panic("Can't lower unexpected 64bit operation %s", get_op_name(op));
        }