aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2014-08-29 19:19:42 -0400
committerDJ Delorie <dj@gcc.gnu.org>2014-08-29 19:19:42 -0400
commitaea3d681ec784b1a44ee3b37b0df2b71bdfadfc3 (patch)
tree7f070b263210ec5bbead0e3597a0bb150827c542 /gcc
parent4c90724737ae14a9d11e6713ea50ad7409cdc8fe (diff)
downloadgcc-aea3d681ec784b1a44ee3b37b0df2b71bdfadfc3.zip
gcc-aea3d681ec784b1a44ee3b37b0df2b71bdfadfc3.tar.gz
gcc-aea3d681ec784b1a44ee3b37b0df2b71bdfadfc3.tar.bz2
expr.c (convert_move): If the target has an explicit converter, use it.
* expr.c (convert_move): If the target has an explicit converter, use it. From-SVN: r214747
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/expr.c20
2 files changed, 25 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f5500c9..04dda80 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2014-08-29 DJ Delorie <dj@redhat.com>
+
+ * expr.c (convert_move): If the target has an explicit converter,
+ use it.
+
2014-08-29 David Malcolm <dmalcolm@redhat.com>
* gdbinit.in: Skip various inline functions in rtl.h when
diff --git a/gcc/expr.c b/gcc/expr.c
index 49c22c5..e7a7c16 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -410,6 +410,26 @@ convert_move (rtx to, rtx from, int unsignedp)
}
/* Handle pointer conversion. */ /* SPEE 900220. */
+ /* If the target has a converter from FROM_MODE to TO_MODE, use it. */
+ {
+ convert_optab ctab;
+
+ if (GET_MODE_PRECISION (from_mode) > GET_MODE_PRECISION (to_mode))
+ ctab = trunc_optab;
+ else if (unsignedp)
+ ctab = zext_optab;
+ else
+ ctab = sext_optab;
+
+ if (convert_optab_handler (ctab, to_mode, from_mode)
+ != CODE_FOR_nothing)
+ {
+ emit_unop_insn (convert_optab_handler (ctab, to_mode, from_mode),
+ to, from, UNKNOWN);
+ return;
+ }
+ }
+
/* Targets are expected to provide conversion insns between PxImode and
xImode for all MODE_PARTIAL_INT modes they use, but no others. */
if (GET_MODE_CLASS (to_mode) == MODE_PARTIAL_INT)