cris: Enable additions and subtractions to set condition codes.
authorHans-Peter Nilsson <hp@axis.com>
Fri, 31 Jan 2020 15:03:15 +0000 (16:03 +0100)
committerHans-Peter Nilsson <hp@axis.com>
Sat, 9 May 2020 02:12:03 +0000 (04:12 +0200)
Enabling dropping of compares with zero of the result, through
the non-VC-setting CCmode substitution.  Beware that the
substitutions for 8- and 16-bit patterns will in some cases be
size-neutral; e.g. replacing an "addq 1..63,$rN" + "test.w $rN"
or "subq 1..63,$rN" + "test.w $rN" with an "add.w -63..63,$rN".

gcc:
* config/cris/cris.md ("*adddi3<setnz>"): Rename from "*adddi3".
cris: Enable 32-bit addition to set condition codes.
("*subdi3<setnz>"): Similarly from "*subdi3".
("*addsi3<setnz>"): Similarly from "*addsi3".
("*subsi3<setnz>"): Similarly from "*subsi3".
("*addhi3<setnz>"): Similarly from "*addhi3" and decorate the
"cc" attribute to "cc<ccnz>".
("*addqi3<setnz>"): Similarly from "*addqi3".
("*sub<mode>3<setnz>"): Similarly from "*sub<mode>3".

gcc/ChangeLog
gcc/config/cris/cris.md

index f0800fe..9ec0852 100644 (file)
        Rename from "extend<mode>si2".
        ("<acc><anz><anzvc>zero_extend<mode>si2<setcc><setnz><setnzvc>"):
        Similar, from "zero_extend<mode>si2".
+       ("*adddi3<setnz>"): Rename from "*adddi3".
+       ("*subdi3<setnz>"): Similarly from "*subdi3".
+       ("*addsi3<setnz>"): Similarly from "*addsi3".
+       ("*subsi3<setnz>"): Similarly from "*subsi3".
+       ("*addhi3<setnz>"): Similarly from "*addhi3" and decorate the
+       "cc" attribute to "cc<ccnz>".
+       ("*addqi3<setnz>"): Similarly from "*addqi3".
+       ("*sub<mode>3<setnz>"): Similarly from "*sub<mode>3".
 
 2020-05-08  Vladimir Makarov  <vmakarov@redhat.com>
 
index 2f3f328..8652f35 100644 (file)
   ""
   "")
 
-(define_insn "*adddi3"
+(define_insn "*adddi3<setnz>"
   [(set (match_operand:DI 0 "register_operand" "=r,r,r,&r,&r")
        (plus:DI (match_operand:DI 1 "register_operand" "%0,0,0,0,r")
                 (match_operand:DI 2 "general_operand" "J,N,P,g,!To")))
   ""
   "")
 
-(define_insn "*addsi3"
+(define_insn "*addsi3<setnz>"
   [(set (match_operand:SI 0 "register_operand"  "=r,r, r,r,r,r,r,  r")
        (plus:SI
         (match_operand:SI 1 "register_operand" "%0,0, 0,0,0,0,r,  r")
 }
  [(set_attr "slottable" "yes,yes,yes,yes,no,no,no,yes")])
 \f
-(define_insn "*addhi3"
+(define_insn "*addhi3<setnz>"
   [(set (match_operand:HI 0 "register_operand"         "=r,r, r,r,r,r")
        (plus:HI (match_operand:HI 1 "register_operand" "%0,0, 0,0,0,r")
                 (match_operand:HI 2 "general_operand"   "r,Q>,J,N,g,!To")))
    add.w %2,%0
    add.w %2,%1,%0"
   [(set_attr "slottable" "yes,yes,yes,yes,no,no")
-   (set_attr "cc" "normal,normal,clobber,clobber,normal,normal")])
+   (set_attr "cc<ccnz>" "normal,normal,clobber,clobber,normal,normal")])
 
-(define_insn "*addqi3"
+(define_insn "*addqi3<setnz>"
   [(set (match_operand:QI 0 "register_operand"         "=r,r, r,r,r,r,r")
        (plus:QI (match_operand:QI 1 "register_operand" "%0,0, 0,0,0,0,r")
                 (match_operand:QI 2 "general_operand"   "r,Q>,J,N,O,g,!To")))
    add.b %2,%0
    add.b %2,%1,%0"
   [(set_attr "slottable" "yes,yes,yes,yes,yes,no,no")
-   (set_attr "cc" "normal,normal,clobber,clobber,clobber,normal,normal")])
+   (set_attr "cc<ccnz>" "normal,normal,clobber,clobber,clobber,normal,normal")])
 \f
 ;; Subtract.
 ;;
   ""
   "")
 
-(define_insn "*subdi3"
+(define_insn "*subdi3<setnz>"
   [(set (match_operand:DI 0 "register_operand" "=r,r,r,&r,&r")
        (minus:DI (match_operand:DI 1 "register_operand" "0,0,0,0,r")
                  (match_operand:DI 2 "general_operand" "J,N,P,g,!To")))
   ""
   "")
 
-(define_insn "*subsi3"
+(define_insn "*subsi3<setnz>"
   [(set (match_operand:SI 0 "register_operand" "=r,r, r,r,r,r,r,r")
        (minus:SI
         (match_operand:SI 1 "register_operand" "0,0, 0,0,0,0,0,r")
    sub.d %2,%1,%0"
   [(set_attr "slottable" "yes,yes,yes,yes,no,no,no,no")])
 \f
-(define_insn "*sub<mode>3"
+(define_insn "*sub<mode>3<setnz>"
   [(set (match_operand:BW 0 "register_operand"         "=r,r, r,r,r,r")
        (minus:BW (match_operand:BW 1 "register_operand" "0,0, 0,0,0,r")
                  (match_operand:BW 2 "general_operand"  "r,Q>,J,N,g,!To")))
    sub<m> %2,%0
    sub<m> %2,%1,%0"
   [(set_attr "slottable" "yes,yes,yes,yes,no,no")
-   (set_attr "cc" "normal,normal,clobber,clobber,normal,normal")])
+   (set_attr "cc<ccnz>" "normal,normal,clobber,clobber,normal,normal")])
 \f
 ;; This is the special case when we use what corresponds to the
 ;; instruction above in "casesi".  Do *not* change it to use the generic