This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
implement negdi2 on frv
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: 25 Nov 2003 22:04:50 -0200
- Subject: implement negdi2 on frv
- Organization: GCC Team, Red Hat
This relatively obvious patch gives us a non-negligible performance
and space improvement, since using a library call to negate a 64-bit
value is pretty silly. I've circulated this within Red Hat and got
general agreement that it was pretty obvious, but since we're in
no-new-features mode, I thought I'd ask first. This got a significant
amount of testing over the past few weeks, but I'd failed to bring it
up here. Ok to install?
Index: gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* config/frv/frv.md (negdi2, negdi2_internal): New.
Index: gcc/config/frv/frv.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/frv/frv.md,v
retrieving revision 1.5
diff -u -p -r1.5 frv.md
--- gcc/config/frv/frv.md 5 Oct 2003 13:34:44 -0000 1.5
+++ gcc/config/frv/frv.md 26 Nov 2003 00:00:49 -0000
@@ -2842,6 +2842,41 @@
[(set_attr "length" "4")
(set_attr "type" "int")])
+(define_expand "negdi2"
+ [(parallel [(set (match_operand:DI 0 "integer_register_operand" "")
+ (neg:DI (match_operand:DI 1 "integer_register_operand" "")))
+ (clobber (match_dup 2))])]
+ ""
+ "
+{
+ operands[2] = gen_reg_rtx (CCmode);
+}")
+
+(define_insn_and_split "*negdi2_internal"
+ [(set (match_operand:DI 0 "integer_register_operand" "=&e,e")
+ (neg:DI (match_operand:DI 1 "integer_register_operand" "e,0")))
+ (clobber (match_operand:CC 2 "icc_operand" "=t,t"))]
+ ""
+ "#"
+ "reload_completed"
+ [(match_dup 4)
+ (match_dup 5)]
+ "
+{
+ rtx op0_high = gen_highpart (SImode, operands[0]);
+ rtx op1_high = gen_rtx_REG (SImode, GPR_FIRST);
+ rtx op2_high = gen_highpart (SImode, operands[1]);
+ rtx op0_low = gen_lowpart (SImode, operands[0]);
+ rtx op1_low = op1_high;
+ rtx op2_low = gen_lowpart (SImode, operands[1]);
+ rtx op3 = operands[2];
+
+ operands[4] = gen_subdi3_lower (op0_low, op1_low, op2_low, op3);
+ operands[5] = gen_subdi3_upper (op0_high, op1_high, op2_high, op3);
+}"
+ [(set_attr "length" "8")
+ (set_attr "type" "multi")])
+
;; Multiplication (same size)
;; (define_insn "muldi3"
;; [(set (match_operand:DI 0 "register_operand" "=r")
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer