16 Jul 13:05
Question about doloop_end pattern
From: Bingfeng Mei <bmei <at> broadcom.com>
Subject: Question about doloop_end pattern
Newsgroups: gmane.comp.gcc.devel
Date: 2008-07-16 11:05:51 GMT
Subject: Question about doloop_end pattern
Newsgroups: gmane.comp.gcc.devel
Date: 2008-07-16 11:05:51 GMT
Hello,
I tried to use doloop_end pattern to reduce loop overhead for our target
processor, which features a dedicated loop instruction. Somehow even a
simple loop just cannot pass the test of doloop_condition_get, which
requires following canonical pattern.
/* The canonical doloop pattern we expect has one of the following
forms:
1) (parallel [(set (pc) (if_then_else (condition)
(label_ref (label))
(pc)))
(set (reg) (plus (reg) (const_int -1)))
(additional clobbers and uses)])
The branch must be the first entry of the parallel (also required
by jump.c), and the second entry of the parallel must be a set of
the loop counter register. Some targets (IA-64) wrap the set of
the loop counter in an if_then_else too.
2) (set (reg) (plus (reg) (const_int -1))
(set (pc) (if_then_else (reg != 0)
(label_ref (label))
(pc))). */
Here is a simple function I used, it should meet all doloop optimization
requirements.
void Unroll( short s, int * restrict b_inout, int *restrict out, int N)
{
int i;
(Continue reading)
RSS Feed