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


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"))))
 
 ;; 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")
+   ])
 
 (define_insn "*fop_sf_1_avx"
   [(set (match_operand:SF 0 "register_operand" "=x")

Thanks - Joey 


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