fixed improper use of mode in extension.
authorzadeck <zadeck@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Aug 2013 19:16:24 +0000 (19:16 +0000)
committerzadeck <zadeck@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Aug 2013 19:16:24 +0000 (19:16 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@201799 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/postreload.c

index 82a0aa3..2d0f320 100644 (file)
@@ -303,12 +303,14 @@ reload_cse_simplify_set (rtx set, rtx insn)
              switch (extend_op)
                {
                case ZERO_EXTEND:
-                 result = wide_int (std::make_pair (this_rtx, GET_MODE (src)))
-                           .zext (word_mode);
+                 result = wide_int (std::make_pair (this_rtx, GET_MODE (src)));
+                 if (GET_MODE_PRECISION (GET_MODE (src)) > GET_MODE_PRECISION (word_mode))
+                   result = result.zext (GET_MODE_PRECISION (word_mode));
                  break;
                case SIGN_EXTEND:
-                 result = wide_int (std::make_pair (this_rtx, GET_MODE (src)))
-                           .sext (word_mode);
+                 result = wide_int (std::make_pair (this_rtx, GET_MODE (src)));
+                 if (GET_MODE_PRECISION (GET_MODE (src)) > GET_MODE_PRECISION (word_mode))
+                   result = result.sext (GET_MODE_PRECISION (word_mode));
                  break;
                default:
                  gcc_unreachable ();