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]

Re: [AVX]: Reformat i386.md/sse.md


Hi Joey,

It is a good idea. I have 2 comments below.

On Mon, May 12, 2008 at 3:15 AM, Ye, Joey <joey.ye@intel.com> wrote:
> HJ,
>
> How about this example patch to simplify attribute "prefix" setting in
> each patterns:
>
> Index: gcc/config/i386/i386.md
> ===================================================================
> --- gcc/config/i386/i386.md     (revision 135201)
> +++ gcc/config/i386/i386.md     (working copy)
> @@ -401,11 +401,18 @@
>  ;; There are also additional prefixes in SSSE3.
>  (define_attr "prefix_extra" "" (const_int 0))
>
> +;; Attribute to be set in insn pattern, which will force
> +;; attr "prefix" to "vex" if TARGET_AVX is true
> +(define_attr "maybe_vex" "" (const_int 0))
> +
>  ;; Prefix used: original or VEX.
>  (define_attr "prefix" "orig,vex"
>   (if_then_else (eq_attr "mode" "OI,V8SF,V4DF")
>     (const_string "vex")
> -    (const_string "orig")))
> +    (if_then_else (and (not (eq_attr "maybe_vex" "0"))
> +                       (ne (symbol_ref "TARGET_AVX")  (const_int 0)))
> +      (const_string "vex")
> +      (const_string "orig"))))

Please use "cond" instead of "if_then_else".

>  ;; There is a 8bit immediate for VEX.
>  (define_attr "prefix_vex_imm8" "" (const_int 0))
> @@ -16135,11 +16142,9 @@
>   "* return TARGET_AVX ? \"vrcpss\t{%1, %0, %0|%0, %0, %1}\"
>                        : \"rcpss\t{%1, %0|%0, %1}\";"
>   [(set_attr "type" "sse")
> -   (set (attr "prefix")
> -     (if_then_else (ne (symbol_ref "TARGET_AVX") (const_int 0))
> -       (const_string "vex")
> -       (const_string "orig")))
> -   (set_attr "mode" "SF")])
> +   (set_attr "mode" "SF")
> +   (set_attr "maybe_vex" "1")
> +   ])

Please put

(set_attr "maybe_vex" "1")

before

(set_attr "mode" "SF")])

so that we only add one line.

Thanks.


H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]