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: PATCH: Macroize SSE add/sub patterns


H.J. Lu wrote:
Hi,

This patch macroizes SSE add/sub patterns. I am testing it
on Linux/ia32 and Linux/Intel64. Ok for trunk if there are
no regressions?

Please see comments through the code. I think that we should extend existing code attributes to cover introduced sse_plusminus code iterator. Also, since this iterator can be used in mmx.md we should (IMO) add this iterator to i386.md, perhaps named sat_plusminus for "saturating" (sp?) operation.


Thanks.


H.J. --- 2008-05-05 H.J. Lu <hongjiu.lu@intel.com>

* gcc/config/i386/sse.md (sse_plusminus): New.
(sse_plusminus_insn): Likewise.
(sse_plusminus_mnemonic): Likewise.
(sse_comm): Likewise.
(<addsub><mode>3): Likewise.
(*<addsub><mode>3): Likewise.
(sse2_<sse_plusminus_insn><mode>3): Likewise.
(add<mode>): Removed.
(*add<mode>3): Likewise.
(sse2_ssadd<mode>3): Likewise.
(sse2_usadd<mode>3): Likewise.
(sub<mode>3): Likewise.
(*sub<mode>3): Likewise.
(sse2_sssub<mode>3): Likewise.
(sse2_ussub<mode>3): Likewise.
------------------------------------------------------------------------


Index: gcc/config/i386/sse.md
===================================================================
--- gcc/config/i386/sse.md (revision 2431)
+++ gcc/config/i386/sse.md (working copy)
@@ -18,6 +18,21 @@
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
+(define_code_iterator sse_plusminus [ss_plus us_plus ss_minus us_minus])
+
+;; Base name for define_insn.
+(define_code_attr sse_plusminus_insn
+ [(ss_plus "ssadd") (us_plus "usadd")
+ (ss_minus "sssub") (us_minus "ussub")])

We can perhaps rename expander names to fit extended addsub code attribute (see below).


+
+;; Base name for insn mnemonic.
+(define_code_attr sse_plusminus_mnemonic
+ [(ss_plus "adds") (us_plus "addus")
+ (ss_minus "subs") (us_minus "subus")])

The attribute above can be merged with existing addsub code attribute in i386.md.
+
+;; Mark SSE commutative operators as such in constraints.
+(define_code_attr sse_comm [(ss_plus "%") (us_plus "%")
+ (ss_minus "") (us_minus "")])

This one can be merged with existing comm code attribute in i386.md (please note, that there is no need for code attribute to cover exactly the range of relevant code iterator. In the case above, one code iterator "comm" can cover plusminunus as well as sse_plusminus code iterators. The same goes for extended addsub.


Thanks,
Uros.


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