re PR target/93002 (while(i--) optimization)
PR target/93002 * config/i386/i386.md (dec reg; cmp $-1, reg; jne lab): New define_peephole2. * gcc.target/i386/pr93002.c: New test. From-SVN: r279632
This commit is contained in:
parent
9be3ac5d63
commit
99675d5c45
@ -1,3 +1,9 @@
|
||||
2019-12-20 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR target/93002
|
||||
* config/i386/i386.md (dec reg; cmp $-1, reg; jne lab): New
|
||||
define_peephole2.
|
||||
|
||||
2019-12-19 Julian Brown <julian@codesourcery.com>
|
||||
|
||||
* gimplify.c (gimplify_omp_var_data): Add GOVD_MAP_HAS_ATTACHMENTS.
|
||||
|
@ -6503,6 +6503,36 @@
|
||||
[(set (reg:CC FLAGS_REG)
|
||||
(compare:CC (match_dup 0) (match_dup 1)))])
|
||||
|
||||
;; decl %eax; cmpl $-1, %eax; jne .Lxx; can be optimized into
|
||||
;; subl $1, %eax; jnc .Lxx;
|
||||
(define_peephole2
|
||||
[(parallel
|
||||
[(set (match_operand:SWI 0 "general_reg_operand")
|
||||
(plus:SWI (match_dup 0) (const_int -1)))
|
||||
(clobber (reg FLAGS_REG))])
|
||||
(set (reg:CCZ FLAGS_REG)
|
||||
(compare:CCZ (match_dup 0) (const_int -1)))
|
||||
(set (pc)
|
||||
(if_then_else (match_operator 1 "bt_comparison_operator"
|
||||
[(reg:CCZ FLAGS_REG) (const_int 0)])
|
||||
(match_operand 2)
|
||||
(pc)))]
|
||||
"peep2_regno_dead_p (3, FLAGS_REG)"
|
||||
[(parallel
|
||||
[(set (reg:CC FLAGS_REG)
|
||||
(compare:CC (match_dup 0) (const_int 1)))
|
||||
(set (match_dup 0)
|
||||
(minus:SWI (match_dup 0) (const_int 1)))])
|
||||
(set (pc)
|
||||
(if_then_else (match_dup 3)
|
||||
(match_dup 2)
|
||||
(pc)))]
|
||||
{
|
||||
rtx cc = gen_rtx_REG (CCmode, FLAGS_REG);
|
||||
operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[1]) == NE
|
||||
? GEU : LTU, VOIDmode, cc, const0_rtx);
|
||||
})
|
||||
|
||||
(define_insn "*subsi_3_zext"
|
||||
[(set (reg FLAGS_REG)
|
||||
(compare (match_operand:SI 1 "register_operand" "0")
|
||||
|
@ -1,3 +1,8 @@
|
||||
2019-12-20 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR target/93002
|
||||
* gcc.target/i386/pr93002.c: New test.
|
||||
|
||||
2019-12-19 Julian Brown <julian@codesourcery.com>
|
||||
|
||||
* gfortran.dg/goacc/derived-types.f90: New test.
|
||||
|
22
gcc/testsuite/gcc.target/i386/pr93002.c
Normal file
22
gcc/testsuite/gcc.target/i386/pr93002.c
Normal file
@ -0,0 +1,22 @@
|
||||
/* PR target/93002 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2" } */
|
||||
/* { dg-final { scan-assembler-not "cmp\[^\n\r]*-1" } } */
|
||||
|
||||
volatile int sink;
|
||||
|
||||
void
|
||||
foo (void)
|
||||
{
|
||||
unsigned i = 1000;
|
||||
while (i--)
|
||||
sink = i;
|
||||
}
|
||||
|
||||
void
|
||||
bar (void)
|
||||
{
|
||||
int i = 2000;
|
||||
while (i--)
|
||||
sink = i;
|
||||
}
|
Loading…
Reference in New Issue
Block a user