This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch] Fix instruction length of jcc_fused
- From: "Ye, Joey" <joey dot ye at intel dot com>
- To: "GCC Patches" <gcc-patches at gcc dot gnu dot org>, "Uros Bizjak" <ubizjak at gmail dot com>
- Date: Fri, 19 Sep 2008 00:03:53 +0800
- Subject: [Patch] Fix instruction length of jcc_fused
Incorrect instruction length of fused jcc slows cpu2000.mcf by 8% and
the reduced case by 50%. This patch fixes the instruction length.
A curious question, IMHO macro-op fusion can be implemented by
scheduling. By this way, instruction length can be naturely calculated,
and no special handling is need in condjump_p etc. Any comments?
Thanks - Joey
Index: i386.md
===================================================================
--- i386.md (revision 3923)
+++ i386.md (working copy)
@@ -421,6 +421,9 @@
]
(const_int 1)))
+(define_attr "length_jcc_fuse" ""
+ (const_int 0))
+
;; The (bounding maximum) length of an instruction in bytes.
;; ??? fistp and frndint are in fact fldcw/{fistp,frndint}/fldcw
sequences.
;; Later we may want to split them and compute proper length as for
@@ -442,7 +445,8 @@
(plus (attr "prefix_rep")
(plus (attr "prefix_data16")
(plus (attr "length_immediate")
- (attr "length_address")))))))
+ (plus (attr "length_address")
+ (attr "length_jcc_fuse"))))))))
;; The `memory' attribute is `none' if no memory is referenced, `load'
or
;; `store' if there is a simple memory reference therein, or `unknown'
@@ -645,7 +649,7 @@
(include "k6.md")
(include "athlon.md")
(include "geode.md")
-;;(include "core2.md")
+(include "core2.md")
;; Operand and operator predicates and constraints
@@ -14033,7 +14037,8 @@
return "test{<imodesuffix>}\t%2, %2\n\t"
"%+j%E1\t%l0\t" ASM_COMMENT_START " fused";
}
- [(set_attr "type" "multi")
+ [(set_attr "type" "icmp")
+ (set_attr "length_jcc_fuse" "2")
(set_attr "mode" "<MODE>")])
(define_insn "*jcc_fused_2"
@@ -14048,7 +14053,8 @@
return "test{<imodesuffix>}\t%2, %2\n\t"
"%+j%e1\t%l0\t" ASM_COMMENT_START " fused";
}
- [(set_attr "type" "multi")
+ [(set_attr "type" "icmp")
+ (set_attr "length_jcc_fuse" "2")
(set_attr "mode" "<MODE>")])
(define_insn "*jcc_fused_3"
@@ -14066,7 +14072,8 @@
return "cmp{<imodesuffix>}\t{%3, %2|%2, %3}\n\t"
"%+j%E1\t%l0\t" ASM_COMMENT_START " fused";
}
- [(set_attr "type" "multi")
+ [(set_attr "type" "icmp")
+ (set_attr "length_jcc_fuse" "2")
(set_attr "mode" "<MODE>")])
(define_insn "*jcc_fused_4"
@@ -14084,7 +14091,8 @@
return "cmp{<imodesuffix>}\t{%3, %2|%2, %3}\n\t"
"%+j%e1\t%l0\t" ASM_COMMENT_START " fused";
}
- [(set_attr "type" "multi")
+ [(set_attr "type" "icmp")
+ (set_attr "length_jcc_fuse" "2")
(set_attr "mode" "<MODE>")])
;; In general it is not safe to assume too much about CCmode registers,