This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Wed, Jun 23, 2010 at 2:22 PM, H.J. Lu <hjl.tools@gmail.com> wrote: > On Wed, Jun 23, 2010 at 12:50 PM, H.J. Lu <hjl.tools@gmail.com> wrote: >> On Wed, Jun 23, 2010 at 12:36 PM, Paolo Bonzini <bonzini@gnu.org> wrote: >>> On 06/23/2010 09:35 PM, H.J. Lu wrote: >>>> >>>> On Wed, Jun 23, 2010 at 12:16 PM, Paolo Bonzini<bonzini@gnu.org> ?wrote: >>>>> >>>>> On 06/23/2010 08:24 PM, H.J. Lu wrote: >>>>>> >>>>>> ?[(set (match_operand:HI 0 "register_operand" "=a") >>>>>> ? ? ? ? (div:HI >>>>>> ? ? ? ? ? (match_operand:HI 1 "register_operand" "0") >>>>>> ? ? ? ? ? (match_operand:QI 2 "nonimmediate_operand" "qm"))) >>>>>> ? ?(clobber (reg:CC FLAGS_REG))] >>>>> >>>>> Maybe this: >>>>> >>>>> [(set (match_operand:QI 0 "register_operand" "=a") >>>>> ? (subreg:QI >>>>> ? ?(div:HI >>>>> ? ? (match_operand:HI 1 "register_operand" "0") >>>>> ? ? (match_operand:QI 2 "nonimmediate_operand" "qm")) 0)) >>>>> ?(clobber (reg:CC FLAGS_REG))] >>>>> >>>> >>>> It doesn't make a big difference since only lower 8bit >>>> is set by it. >>> >>> For full divmod you have to shift mod and ior of course. ?I understood that >>> you were talking of *<u>divqi3. >>> >> >> I can't do shift/ior on QI output from *<u>divqi3. I have >> >> ;; Divide AX by r/m8, with result stored in >> ;; AL <- Quotient >> ;; AH <- Remainder >> (define_insn "*<u>divqi3" >> ?[(set (match_operand:QI 0 "register_operand" "=a") >> ? ? ? ?(any_div:QI >> ? ? ? ? ?(match_operand:HI 1 "register_operand" "0") >> ? ? ? ? ?(match_operand:QI 2 "nonimmediate_operand" "qm"))) >> ? (clobber (reg:CC FLAGS_REG))] >> ?"TARGET_QIMODE_MATH" >> ?"<sgnprefix>div{b}\t%2" >> ?[(set_attr "type" "idiv") >> ? (set_attr "mode" "QI")]) >> >> and use >> >> ;; Used to extract remainder from AH by 8bit divmod. ?Use unspec so >> ;; that we can extract it from AL. >> (define_insn "*movqi_extzh" >> ?[(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?R") >> ? ? ? ?(unspec:QI [(match_operand 1 "register_operand" "Q,Q")] >> ? ? ? ? ? ? ? ? ? UNSPEC_MOVQI_EXTZH))] >> >> to extract it from AL >> > > Here is a different approach. ?It uses UNSPEC for 8bit divmod. > The generated code is the same. > > An updated patch. No need for *movqi_extzv_3 and *movqi_extzv_3_rex64. -- H.J. --- gcc/ 2010-06-22 H.J. Lu <hongjiu.lu@intel.com> PR target/44588 * config/i386/i386.md (UNSPEC_DIVQI): New. (UNSPEC_UDIVQI): Likewise. (extend_code): Likewise. (extract_code): Likewise. (<u>divmodqi4): Likewise. (*divqi3): Likewise. (*udivqi3): Likewise. (<u>divqi3): Remvoved. gcc/testsuite/ 2010-06-22 H.J. Lu <hongjiu.lu@intel.com> PR target/44588 * gcc.target/i386/umod-1.c: New. * gcc.target/i386/umod-2.c: Likewise. * gcc.target/i386/umod-3.c: Likewise.
Attachment:
gcc-pr44588-9.patch
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |