Skip to content

Commit 263f9e4

Browse files
author
rearnsha
committed
[arm] Add alternative canonicalizations for subtract-with-carry + shift
This patch adds a couple of alternative canonicalizations to allow combine to match a subtract-with-carry operation when one of the operands is shifted first. The most common case of this is when combining a sign-extend of one operand with a long-long value during subtraction. The RSC variant is only enabled for Arm, the SBC variant for any 32-bit compilation. * config/arm/arm.md (subsi3_carryin_shift_alt): New pattern. (rsbsi3_carryin_shift_alt): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@277176 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent 01089cc commit 263f9e4

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

gcc/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2019-10-18 Richard Earnshaw <[email protected]>
2+
3+
* config/arm/arm.md (subsi3_carryin_shift_alt): New pattern.
4+
(rsbsi3_carryin_shift_alt): Likewise.
5+
16
2019-10-18 Richard Earnshaw <[email protected]>
27

38
* config/arm/arm.md (negscc_borrow): New pattern.

gcc/config/arm/arm.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,23 @@
10481048
(const_string "alu_shift_reg")))]
10491049
)
10501050

1051+
(define_insn "*subsi3_carryin_shift_alt"
1052+
[(set (match_operand:SI 0 "s_register_operand" "=r")
1053+
(minus:SI (minus:SI
1054+
(match_operand:SI 1 "s_register_operand" "r")
1055+
(match_operand:SI 5 "arm_borrow_operation" ""))
1056+
(match_operator:SI 2 "shift_operator"
1057+
[(match_operand:SI 3 "s_register_operand" "r")
1058+
(match_operand:SI 4 "reg_or_int_operand" "rM")])))]
1059+
"TARGET_32BIT"
1060+
"sbc%?\\t%0, %1, %3%S2"
1061+
[(set_attr "conds" "use")
1062+
(set_attr "predicable" "yes")
1063+
(set (attr "type") (if_then_else (match_operand 4 "const_int_operand" "")
1064+
(const_string "alu_shift_imm")
1065+
(const_string "alu_shift_reg")))]
1066+
)
1067+
10511068
(define_insn "*rsbsi3_carryin_shift"
10521069
[(set (match_operand:SI 0 "s_register_operand" "=r")
10531070
(minus:SI (minus:SI
@@ -1065,6 +1082,23 @@
10651082
(const_string "alu_shift_reg")))]
10661083
)
10671084

1085+
(define_insn "*rsbsi3_carryin_shift_alt"
1086+
[(set (match_operand:SI 0 "s_register_operand" "=r")
1087+
(minus:SI (minus:SI
1088+
(match_operator:SI 2 "shift_operator"
1089+
[(match_operand:SI 3 "s_register_operand" "r")
1090+
(match_operand:SI 4 "reg_or_int_operand" "rM")])
1091+
(match_operand:SI 5 "arm_borrow_operation" ""))
1092+
(match_operand:SI 1 "s_register_operand" "r")))]
1093+
"TARGET_ARM"
1094+
"rsc%?\\t%0, %1, %3%S2"
1095+
[(set_attr "conds" "use")
1096+
(set_attr "predicable" "yes")
1097+
(set (attr "type") (if_then_else (match_operand 4 "const_int_operand" "")
1098+
(const_string "alu_shift_imm")
1099+
(const_string "alu_shift_reg")))]
1100+
)
1101+
10681102
; transform ((x << y) - 1) to ~(~(x-1) << y) Where X is a constant.
10691103
(define_split
10701104
[(set (match_operand:SI 0 "s_register_operand" "")

0 commit comments

Comments
 (0)