http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57195



             Bug #: 57195

           Summary: Mode attributes with specific mode iterator can not be

                    used as mode iterators in *.md files

    Classification: Unclassified

           Product: gcc

           Version: 4.9.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: other

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: ubiz...@gmail.com





There is a strange undocumented limitation when using mode attributes with

specific mode iterator as mode iterators in *.md files. As an example from

i386.md, following RTX is accepted:



(define_insn_and_split "copysign<mode>3_const"

  [(set (match_operand:CSGNMODE 0 "register_operand" "=x")

    (unspec:CSGNMODE

      [(match_operand:<CSGNVMODE> 1 "vector_move_operand" "xmC")

       (match_operand:CSGNMODE 2 "register_operand" "0")

       (match_operand:<CSGNVMODE> 3 "nonimmediate_operand" "xm")]

      UNSPEC_COPYSIGN))]

  ...)



However, when equivalent named mode attribute (i.e. <CSGNMODE:CSGNVMODE> below)

is used in place of a mode iterator:



(define_insn_and_split "copysign<mode>3_const"

  [(set (match_operand:CSGNMODE 0 "register_operand" "=x")

    (unspec:CSGNMODE

      [(match_operand:<CSGNMODE:CSGNVMODE> 1 "vector_move_operand" "xmC")

       (match_operand:CSGNMODE 2 "register_operand" "0")

       (match_operand:<CSGNVMODE> 3 "nonimmediate_operand" "xm")]

      UNSPEC_COPYSIGN))]

  ...)



compilation breaks with:



build/genconditions

../../gcc-svn/branches/gcc-4_8-branch/gcc/config/i386/i386.md > tmp-condmd.c

../../gcc-svn/branches/gcc-4_8-branch/gcc/config/i386/i386.md:8866: unknown

mode `<CSGNMODE'

../../gcc-svn/branches/gcc-4_8-branch/gcc/config/i386/i386.md:8866: following

context is `:CSGNVMODE> 1 "vector_move_operand" "xmC")'



The iterators are defined as:



(define_mode_iterator CSGNMODE [SF DF TF])

(define_mode_attr CSGNVMODE [(SF "V4SF") (DF "V2DF") (TF "TF")])



I would like to use mode attribute with named mode in the following pattern:



(define_insn "*vec_extract<PEXTR_MODE:mode>_zext"

  [(set (match_operand:SWI48 0 "register_operand" "=r")

    (zero_extend:SWI48

      (vec_select:<PEXTR_MODE:ssescalarmode>

        (match_operand:PEXTR_MODE 1 "register_operand" "x")

        (parallel

          [(match_operand:SI 2

         "const_0_to_<PEXTR_MODE:ssescalarnummask>_operand")]))))]



where ssescalarmode mode attribute applies to PEXTR_MODE mode iterator, and not

to SWI48.

Reply via email to