From e561b9fe0b4b3702e18b7bf12f03b1fbe0d111b4 Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Fri, 31 Jan 2020 16:03:15 +0100 Subject: [PATCH] cris: Enable additions and subtractions to set condition codes. 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"): Rename from "*adddi3". cris: Enable 32-bit addition to set condition codes. ("*subdi3"): Similarly from "*subdi3". ("*addsi3"): Similarly from "*addsi3". ("*subsi3"): Similarly from "*subsi3". ("*addhi3"): Similarly from "*addhi3" and decorate the "cc" attribute to "cc". ("*addqi3"): Similarly from "*addqi3". ("*sub3"): Similarly from "*sub3". --- gcc/ChangeLog | 8 ++++++++ gcc/config/cris/cris.md | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f0800fe1b19..9ec085218af 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -124,6 +124,14 @@ Rename from "extendsi2". ("zero_extendsi2"): Similar, from "zero_extendsi2". + ("*adddi3"): Rename from "*adddi3". + ("*subdi3"): Similarly from "*subdi3". + ("*addsi3"): Similarly from "*addsi3". + ("*subsi3"): Similarly from "*subsi3". + ("*addhi3"): Similarly from "*addhi3" and decorate the + "cc" attribute to "cc". + ("*addqi3"): Similarly from "*addqi3". + ("*sub3"): Similarly from "*sub3". 2020-05-08 Vladimir Makarov diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md index 2f3f328f5c5..8652f358630 100644 --- a/gcc/config/cris/cris.md +++ b/gcc/config/cris/cris.md @@ -913,7 +913,7 @@ "" "") -(define_insn "*adddi3" +(define_insn "*adddi3" [(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"))) @@ -936,7 +936,7 @@ "" "") -(define_insn "*addsi3" +(define_insn "*addsi3" [(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") @@ -989,7 +989,7 @@ } [(set_attr "slottable" "yes,yes,yes,yes,no,no,no,yes")]) -(define_insn "*addhi3" +(define_insn "*addhi3" [(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"))) @@ -1003,9 +1003,9 @@ 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" "normal,normal,clobber,clobber,normal,normal")]) -(define_insn "*addqi3" +(define_insn "*addqi3" [(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"))) @@ -1020,7 +1020,7 @@ 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" "normal,normal,clobber,clobber,clobber,normal,normal")]) ;; Subtract. ;; @@ -1039,7 +1039,7 @@ "" "") -(define_insn "*subdi3" +(define_insn "*subdi3" [(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"))) @@ -1062,7 +1062,7 @@ "" "") -(define_insn "*subsi3" +(define_insn "*subsi3" [(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") @@ -1084,7 +1084,7 @@ sub.d %2,%1,%0" [(set_attr "slottable" "yes,yes,yes,yes,no,no,no,no")]) -(define_insn "*sub3" +(define_insn "*sub3" [(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"))) @@ -1098,7 +1098,7 @@ sub %2,%0 sub %2,%1,%0" [(set_attr "slottable" "yes,yes,yes,yes,no,no") - (set_attr "cc" "normal,normal,clobber,clobber,normal,normal")]) + (set_attr "cc" "normal,normal,clobber,clobber,normal,normal")]) ;; This is the special case when we use what corresponds to the ;; instruction above in "casesi". Do *not* change it to use the generic -- 2.30.2