diff options
author | Uros Bizjak <ubizjak@gmail.com> | 2016-06-22 20:40:21 +0200 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2016-06-22 20:40:21 +0200 |
commit | 37c467c0a543e4df3c09da8e327cccbda9e45477 (patch) | |
tree | da8c0f39389f65b764a42962150bc6a5ea4609c3 /gcc | |
parent | ac81cf0b2bf5efdd716d10d1c218eb5a17e1035b (diff) | |
download | gcc-37c467c0a543e4df3c09da8e327cccbda9e45477.zip gcc-37c467c0a543e4df3c09da8e327cccbda9e45477.tar.gz gcc-37c467c0a543e4df3c09da8e327cccbda9e45477.tar.bz2 |
i386.c (ix86_expand_move): Simplify SYMBOL_REF handling.
* config/i386/i386.c (ix86_expand_move): Simplify SYMBOL_REF handling.
From-SVN: r237716
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 70 |
2 files changed, 45 insertions, 29 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0ae2b03..ab5891b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2016-06-22 Uros Bizjak <ubizjak@gmail.com> + + * config/i386/i386.c (ix86_expand_move): Simplify SYMBOL_REF handling. + 2016-06-22 David Malcolm <dmalcolm@redhat.com> PR c/70339 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 1e87286..02e678a 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -19393,50 +19393,62 @@ void ix86_expand_move (machine_mode mode, rtx operands[]) { rtx op0, op1; + rtx tmp, addend = NULL_RTX; enum tls_model model; op0 = operands[0]; op1 = operands[1]; - if (GET_CODE (op1) == SYMBOL_REF) + switch (GET_CODE (op1)) { - rtx tmp; + case CONST: + tmp = XEXP (op1, 0); + if (GET_CODE (tmp) != PLUS + || GET_CODE (XEXP (tmp, 0)) != SYMBOL_REF) + break; + + op1 = XEXP (tmp, 0); + addend = XEXP (tmp, 1); + /* FALLTHRU */ + + case SYMBOL_REF: model = SYMBOL_REF_TLS_MODEL (op1); - if (model) - { - op1 = legitimize_tls_address (op1, model, true); - op1 = force_operand (op1, op0); - if (op1 == op0) - return; - op1 = convert_to_mode (mode, op1, 1); - } - else if ((tmp = legitimize_pe_coff_symbol (op1, false)) != NULL_RTX) - op1 = tmp; - } - else if (GET_CODE (op1) == CONST - && GET_CODE (XEXP (op1, 0)) == PLUS - && GET_CODE (XEXP (XEXP (op1, 0), 0)) == SYMBOL_REF) - { - rtx addend = XEXP (XEXP (op1, 0), 1); - rtx symbol = XEXP (XEXP (op1, 0), 0); - rtx tmp; - model = SYMBOL_REF_TLS_MODEL (symbol); if (model) - tmp = legitimize_tls_address (symbol, model, true); + op1 = legitimize_tls_address (op1, model, true); else - tmp = legitimize_pe_coff_symbol (symbol, true); + { + tmp = legitimize_pe_coff_symbol (op1, addend != NULL_RTX); + if (tmp) + { + op1 = tmp; + if (!addend) + break; + } + else + { + op1 = operands[1]; + break; + } + } - if (tmp) + if (addend) { - tmp = force_operand (tmp, NULL); - tmp = expand_simple_binop (Pmode, PLUS, tmp, addend, + op1 = force_operand (op1, NULL_RTX); + op1 = expand_simple_binop (Pmode, PLUS, op1, addend, op0, 1, OPTAB_DIRECT); - if (tmp == op0) - return; - op1 = convert_to_mode (mode, tmp, 1); } + else + op1 = force_operand (op1, op0); + + if (op1 == op0) + return; + + op1 = convert_to_mode (mode, op1, 1); + + default: + break; } if ((flag_pic || MACHOPIC_INDIRECT) |