From 527e82c2679a4bfc6549e81652fa165449c3495f Mon Sep 17 00:00:00 2001 From: Wei Guozhi Date: Thu, 9 Jun 2011 18:46:22 +0000 Subject: [PATCH] arm.md (*addsi3_carryin_compare0_): New pattern. * config/arm/arm.md (*addsi3_carryin_compare0_): New pattern. (peephole2 for conditional move): Generate 16 bit instructions. * gcc.target/arm/pr46975.c: New testcase. From-SVN: r174854 --- gcc/ChangeLog | 6 ++++++ gcc/config/arm/arm.md | 24 ++++++++++++++++++++---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/arm/pr46975.c | 9 +++++++++ 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arm/pr46975.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 76053c9eed7..29dcf554fc7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-06-09 Wei Guozhi + + PR target/46975 + * config/arm/arm.md (*addsi3_carryin_compare0_): New pattern. + (peephole2 for conditional move): Generate 16 bit instructions. + 2011-06-09 Uros Bizjak * config/i386/i386.md (*movdi_internal_rex64): Merge diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 4e84826dd35..70f703c3e7b 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -985,6 +985,17 @@ (const_string "alu_shift_reg")))] ) +(define_insn "*addsi3_carryin_clobercc_" + [(set (match_operand:SI 0 "s_register_operand" "=r") + (plus:SI (plus:SI (match_operand:SI 1 "s_register_operand" "%r") + (match_operand:SI 2 "arm_rhs_operand" "rI")) + (LTUGEU:SI (reg: CC_REGNUM) (const_int 0)))) + (clobber (reg:CC CC_REGNUM))] + "TARGET_32BIT" + "adc%.\\t%0, %1, %2" + [(set_attr "conds" "set")] +) + (define_expand "incscc" [(set (match_operand:SI 0 "s_register_operand" "=r,r") (plus:SI (match_operator:SI 2 "arm_comparison_operator" @@ -8873,14 +8884,19 @@ (set (match_dup 0) (const_int 1))) (match_scratch:SI 3 "r")] "TARGET_32BIT" - [(set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2))) + [(parallel + [(set (reg:CC CC_REGNUM) + (compare:CC (match_dup 1) (match_dup 2))) + (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))]) (parallel [(set (reg:CC CC_REGNUM) (compare:CC (const_int 0) (match_dup 3))) (set (match_dup 0) (minus:SI (const_int 0) (match_dup 3)))]) - (set (match_dup 0) - (plus:SI (plus:SI (match_dup 0) (match_dup 3)) - (geu:SI (reg:CC CC_REGNUM) (const_int 0))))]) + (parallel + [(set (match_dup 0) + (plus:SI (plus:SI (match_dup 0) (match_dup 3)) + (geu:SI (reg:CC CC_REGNUM) (const_int 0)))) + (clobber (reg:CC CC_REGNUM))])]) (define_insn "*cond_move" [(set (match_operand:SI 0 "s_register_operand" "=r,r,r") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 12f41f641ab..f84baa1221a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-06-09 Wei Guozhi + + PR target/46975 + * gcc.target/arm/pr46975.c: New testcase. + 2011-06-09 Nicola Pero * objc-obj-c++-shared/objc-test-suite-next-encode-assist.h diff --git a/gcc/testsuite/gcc.target/arm/pr46975.c b/gcc/testsuite/gcc.target/arm/pr46975.c new file mode 100644 index 00000000000..60d773b1e6e --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr46975.c @@ -0,0 +1,9 @@ +/* { dg-options "-mthumb -Os" } */ +/* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-final { scan-assembler "subs" } } */ +/* { dg-final { scan-assembler "adcs" } } */ + +int foo (int s) +{ + return s == 1; +} -- 2.30.2