From ad111b8eb9a011d1c9c7abd92a4282d00fa1ea4f Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 25 Jun 2018 10:02:16 -0600 Subject: [PATCH] v850.md (divmodhi4): Make sure to sign extend the dividend to 32 bits. * config/v850/v850.md (divmodhi4): Make sure to sign extend the dividend to 32 bits. Adjust length. (udivmodhi4): Cleanup output template. Fix length. From-SVN: r262022 --- gcc/ChangeLog | 6 ++++++ gcc/config/v850/v850.md | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 754b5f10063..ceec833bb70 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-06-25 Jeff Law + + * config/v850/v850.md (divmodhi4): Make sure to sign extend the + dividend to 32 bits. Adjust length. + (udivmodhi4): Cleanup output template. Fix length. + 2018-06-25 Carl Love * config/rs6000/vsx.md: Change word selector to prefered location. diff --git a/gcc/config/v850/v850.md b/gcc/config/v850/v850.md index 2656e90c90b..e01a3102c31 100644 --- a/gcc/config/v850/v850.md +++ b/gcc/config/v850/v850.md @@ -738,13 +738,13 @@ (match_dup 2))) (clobber (reg:CC CC_REGNUM))] "TARGET_V850E_UP" - "divh %2,%0,%3" - [(set_attr "length" "4") + "sxh %0\n\tdivh %2,%0,%3" + [(set_attr "length" "6") (set_attr "cc" "clobber") (set_attr "type" "div")]) -;; Half-words are sign-extended by default, so we must zero extend to a word -;; here before doing the divide. +;; The half word needs to be zero/sign extended to 32 bits before doing +;; the division/modulo operation. (define_insn "udivmodhi4" [(set (match_operand:HI 0 "register_operand" "=r") @@ -755,8 +755,8 @@ (match_dup 2))) (clobber (reg:CC CC_REGNUM))] "TARGET_V850E_UP" - "zxh %0 ; divhu %2,%0,%3" - [(set_attr "length" "4") + "zxh %0\n\tdivhu %2,%0,%3" + [(set_attr "length" "6") (set_attr "cc" "clobber") (set_attr "type" "div")]) -- 2.30.2