Commit 5035bbfe by Torbjorn Granlund

(smul_highpart_optab, umul_highpart_optab): New variables.

(expand_binop): Handle [us]mul_highpart_optab as commutative.
(init_optabs): Initialize [us]mul_highpart_optab.
(expand_binop): Convert OP0 to mode for library calls.

From-SVN: r7595
parent dbb5b3ce
...@@ -42,6 +42,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -42,6 +42,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
optab add_optab; optab add_optab;
optab sub_optab; optab sub_optab;
optab smul_optab; optab smul_optab;
optab smul_highpart_optab;
optab umul_highpart_optab;
optab smul_widen_optab; optab smul_widen_optab;
optab umul_widen_optab; optab umul_widen_optab;
optab sdiv_optab; optab sdiv_optab;
...@@ -383,7 +385,9 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods) ...@@ -383,7 +385,9 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
Also try to make the last operand a constant. */ Also try to make the last operand a constant. */
if (GET_RTX_CLASS (binoptab->code) == 'c' if (GET_RTX_CLASS (binoptab->code) == 'c'
|| binoptab == smul_widen_optab || binoptab == smul_widen_optab
|| binoptab == umul_widen_optab) || binoptab == umul_widen_optab
|| binoptab == smul_highpart_optab
|| binoptab == umul_highpart_optab)
{ {
commutative_op = 1; commutative_op = 1;
...@@ -1484,6 +1488,9 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods) ...@@ -1484,6 +1488,9 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
op1x = convert_to_mode (word_mode, op1, 1); op1x = convert_to_mode (word_mode, op1, 1);
} }
if (GET_MODE (op0) != mode)
op0 = convert_to_mode (mode, op0, unsignedp);
/* Pass 1 for NO_QUEUE so we don't lose any increments /* Pass 1 for NO_QUEUE so we don't lose any increments
if the libcall is cse'd or moved. */ if the libcall is cse'd or moved. */
value = emit_library_call_value (binoptab->handlers[(int) mode].libfunc, value = emit_library_call_value (binoptab->handlers[(int) mode].libfunc,
...@@ -3727,6 +3734,8 @@ init_optabs () ...@@ -3727,6 +3734,8 @@ init_optabs ()
add_optab = init_optab (PLUS); add_optab = init_optab (PLUS);
sub_optab = init_optab (MINUS); sub_optab = init_optab (MINUS);
smul_optab = init_optab (MULT); smul_optab = init_optab (MULT);
smul_highpart_optab = init_optab (UNKNOWN);
umul_highpart_optab = init_optab (UNKNOWN);
smul_widen_optab = init_optab (UNKNOWN); smul_widen_optab = init_optab (UNKNOWN);
umul_widen_optab = init_optab (UNKNOWN); umul_widen_optab = init_optab (UNKNOWN);
sdiv_optab = init_optab (DIV); sdiv_optab = init_optab (DIV);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment