- To: dibstar <dibyam4@xxxxxxxxx>
- Subject: Re: FORCING GCC TO UNROLL LOOPS
- From: Ian Lance Taylor <iant@xxxxxxxxxx>
- Date: Wed, 07 Mar 2012 07:18:12 -0800
- Cc: gcc-help@xxxxxxxxxxx
- Comment: DKIM? See http://www.dkim.org
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1331738318; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:From:To:Cc:Subject:References:Date:In-Reply-To: Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=bp+kWefK5dOGUPdCK52F6hgj7CU=; b=Jyn+dimS6S2Crj9L1oP4jVyy7ZDQ+oaG4uC3mXQX3IZ1P9Dsd9UWUZZkwUxDgk euur+Vrf0Xsf183vZlVurER/B5JnRRSjQ8ESeoDvUZ010jpOUJuNXovhKd8AXTSL 6PowiwhYvexqKZfsYW9F/wo4uw4bMvzguuq0OrtYKTr50=
- In-reply-to: <33455948.post@talk.nabble.com> (dibstar's message of "Tue, 6 Mar 2012 21:30:18 -0800 (PST)")
- User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
dibstar <dibyam4@xxxxxxxxx> writes:
> I wish to force gcc to unroll both the constant time iterating loops
> and the runtime iterating loops as outlined in loop-unroll.c. I modified the
> loop-unroll.c to place all unrolling decisions in the function
> decide-unroll-and-peel. I also made gcc interact with the user by asking the
> user the function name that which contains the desired loop and the loop
> number and the desired unroll factor. This seems to be fine for unrolling
> constant time iterating loops, i.e. i am able to unroll these loops by all
> factors from 1 to 8. However, for runtime loops, i get a segmentation fault.
> I analysed the code and found that gcc assumes that the unroll factor is a
> power of 2 for runtime loops. I wish to change this and force gcc to unroll
> a particular loop by all factors from 1 to 8. How can I do this?
What version of gcc?
I assume you mean decide_unrolling_and_peeling rather than
decide-unroll-and-peel.
I agree that the code assumes that the unroll factor is a power of 2.
If you want to use a different factor, you will have to change the code.
Are you asking how to do that? Look in unroll_loop_runtime_iterations.
It uses AND; as the comment explains, that only works because it is
unrolling by a power of 2. If you want something else to work, you will
need to change that.
Ian
[Linux C Programming]
[Linux Kernel]
[eCos]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[The DWARVES Debugging Tools]
[Yosemite Campsites]
[Yosemite News]
[Linux GCC]