#include <stdio.h> int main() { int i; for(i=0;i<10000;i++){ printf("%d",i); } }
I want to do a loop unwrap on this code using gcc but even using a flag.
gcc -O2 -funroll-all-loops --save-temps unroll.c
the compiled code that I get contains a loop of 10,000 iterations
_main: Leh_func_begin1: pushq %rbp Ltmp0: movq %rsp, %rbp Ltmp1: pushq %r14 pushq %rbx Ltmp2: xorl %ebx, %ebx leaq L_.str(%rip), %r14 .align 4, 0x90 LBB1_1: xorb %al, %al movq %r14, %rdi movl %ebx, %esi callq _printf incl %ebx cmpl $10000, %ebx jne LBB1_1 popq %rbx popq %r14 popq %rbp ret Leh_func_end1:
Can somone plz tell me how to properly execute a loop unfolding in gcc
optimization with gcc loop-unrolling
Neel choudhury
source share