/* Lower complex number operations to scalar operations.
- Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
Free Software Foundation, Inc.
This file is part of GCC.
update_stmt (stmt);
}
+/* Expand inline asm that sets some complex SSA_NAMEs. */
+
+static void
+expand_complex_asm (gimple_stmt_iterator *gsi)
+{
+ gimple stmt = gsi_stmt (*gsi);
+ unsigned int i;
+
+ for (i = 0; i < gimple_asm_noutputs (stmt); ++i)
+ {
+ tree link = gimple_asm_output_op (stmt, i);
+ tree op = TREE_VALUE (link);
+ if (TREE_CODE (op) == SSA_NAME
+ && TREE_CODE (TREE_TYPE (op)) == COMPLEX_TYPE)
+ {
+ tree type = TREE_TYPE (op);
+ tree inner_type = TREE_TYPE (type);
+ tree r = build1 (REALPART_EXPR, inner_type, op);
+ tree i = build1 (IMAGPART_EXPR, inner_type, op);
+ gimple_seq list = set_component_ssa_name (op, false, r);
+
+ if (list)
+ gsi_insert_seq_after (gsi, list, GSI_CONTINUE_LINKING);
+
+ list = set_component_ssa_name (op, true, i);
+ if (list)
+ gsi_insert_seq_after (gsi, list, GSI_CONTINUE_LINKING);
+ }
+ }
+}
/* Process one statement. If we identify a complex operation, expand it. */
complex_lattice_t al, bl;
enum tree_code code;
+ if (gimple_code (stmt) == GIMPLE_ASM)
+ {
+ expand_complex_asm (gsi);
+ return;
+ }
+
lhs = gimple_get_lhs (stmt);
if (!lhs && gimple_code (stmt) != GIMPLE_COND)
return;