This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [AVX]: Reformat i386.md/sse.md
- From: "Ye, Joey" <joey dot ye at intel dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>, <gcc-patches at gcc dot gnu dot org>
- Cc: "Guo, Xuepeng" <xuepeng dot guo at intel dot com>
- Date: Mon, 12 May 2008 18:15:07 +0800
- Subject: RE: [AVX]: Reformat i386.md/sse.md
- References: <20080511142236.GA21688@lucon.org>
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