diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-01-10 10:25:12 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-01-10 10:25:12 +0100 |
commit | a57fc74385ddb5fb8f77122f6d4d8846900579b1 (patch) | |
tree | 5fb721c2a5ba20d25a6c8cdc53b3a983151a4708 /gcc | |
parent | 0ff4390dd359f76dd76b835a0ccf9d473d9ebe28 (diff) | |
download | gcc-a57fc74385ddb5fb8f77122f6d4d8846900579b1.zip gcc-a57fc74385ddb5fb8f77122f6d4d8846900579b1.tar.gz gcc-a57fc74385ddb5fb8f77122f6d4d8846900579b1.tar.bz2 |
re PR middle-end/55921 (Crash in verify_ssa for asm to side-steps complex pessimization)
PR tree-optimization/55921
* tree-complex.c (expand_complex_asm): New function.
(expand_complex_operations_1): Call it for GIMPLE_ASM.
* gcc.c-torture/compile/pr55921.c: New test.
From-SVN: r195080
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr55921.c | 21 | ||||
-rw-r--r-- | gcc/tree-complex.c | 38 |
4 files changed, 69 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9657caf..e73df4b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-01-10 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/55921 + * tree-complex.c (expand_complex_asm): New function. + (expand_complex_operations_1): Call it for GIMPLE_ASM. + 2013-01-10 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> PR target/55718 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 56a6a48..0df71a5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-01-10 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/55921 + * gcc.c-torture/compile/pr55921.c: New test. + 2013-01-09 Jan Hubicka <jh@suse.cz> PR tree-optimization/55569 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr55921.c b/gcc/testsuite/gcc.c-torture/compile/pr55921.c new file mode 100644 index 0000000..8ac9e9b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr55921.c @@ -0,0 +1,21 @@ +/* PR tree-optimization/55921 */ + +typedef union +{ + _Complex float cf; + long long ll; +} ucf; + +void +foo (ucf *in, ucf *out, _Complex float r) +{ + int i; + ucf ucf1; + _Complex float cf; + + ucf1.ll = in[i].ll; + __asm ("" : "=r" (cf) : "0" (ucf1.ll)); + cf *= r; + __asm ("" : "=r" (ucf1.ll) : "0" (cf)); + out[i].ll = ucf1.ll; +} diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c index 16f47ba..477a773 100644 --- a/gcc/tree-complex.c +++ b/gcc/tree-complex.c @@ -1,5 +1,5 @@ /* 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. @@ -1391,6 +1391,36 @@ expand_complex_comparison (gimple_stmt_iterator *gsi, tree ar, tree ai, 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. */ @@ -1403,6 +1433,12 @@ expand_complex_operations_1 (gimple_stmt_iterator *gsi) 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; |