From 91ae0791cbebaac673e42e53c8b7f000241a0ca1 Mon Sep 17 00:00:00 2001 From: dj Date: Fri, 29 Aug 2014 23:19:42 +0000 Subject: [PATCH] * expr.c (convert_move): If the target has an explicit converter, use it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214747 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/expr.c | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f5500c9299fe..04dda801ede7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-08-29 DJ Delorie + + * expr.c (convert_move): If the target has an explicit converter, + use it. + 2014-08-29 David Malcolm * gdbinit.in: Skip various inline functions in rtl.h when diff --git a/gcc/expr.c b/gcc/expr.c index 49c22c5ec4e0..e7a7c16a0cb0 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) -- 2.47.2