Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -mtriple=i386-linux-gnu -mcpu=atom  | \
      2 ; RUN:     FileCheck --check-prefix=ATOM %s
      3 ; RUN: llc < %s -mtriple=i386-linux-gnu -mcpu=core2 | \
      4 ; RUN:     FileCheck --check-prefix=CORE2 %s
      5 ; ATOM: calll *{{%[a-z]+}}
      6 ; CORE2: calll *funcp
      7 ;
      8 ; original source code built with clang -S -emit-llvm -M32 test32.c:
      9 ;
     10 ;   int a, b, c, d, e, f, g, h, i, j;
     11 ;   extern int (*funcp)(int, int, int, int, int, int, int, int);
     12 ;   extern int sum;
     13 ;   
     14 ;   void func()
     15 ;   {
     16 ;     sum = 0;
     17 ;     for( i = a; i < b; ++i )
     18 ;     {
     19 ;       sum += (*funcp)(i, b, c, d, e, f, g, h);
     20 ;     }
     21 ;   }
     22 ;
     23 @sum = external global i32
     24 @a = common global i32 0, align 4
     25 @i = common global i32 0, align 4
     26 @b = common global i32 0, align 4
     27 @funcp = external global i32 (i32, i32, i32, i32, i32, i32, i32, i32)*
     28 @c = common global i32 0, align 4
     29 @d = common global i32 0, align 4
     30 @e = common global i32 0, align 4
     31 @f = common global i32 0, align 4
     32 @g = common global i32 0, align 4
     33 @h = common global i32 0, align 4
     34 @j = common global i32 0, align 4
     35 
     36 define void @func() #0 {
     37 entry:
     38   store i32 0, i32* @sum, align 4
     39   %0 = load i32, i32* @a, align 4
     40   store i32 %0, i32* @i, align 4
     41   br label %for.cond
     42 
     43 for.cond:                                         ; preds = %for.inc, %entry
     44   %1 = load i32, i32* @i, align 4
     45   %2 = load i32, i32* @b, align 4
     46   %cmp = icmp slt i32 %1, %2
     47   br i1 %cmp, label %for.body, label %for.end
     48 
     49 for.body:                                         ; preds = %for.cond
     50   %3 = load i32 (i32, i32, i32, i32, i32, i32, i32, i32)*, i32 (i32, i32, i32, i32, i32, i32, i32, i32)** @funcp, align 4
     51   %4 = load i32, i32* @i, align 4
     52   %5 = load i32, i32* @b, align 4
     53   %6 = load i32, i32* @c, align 4
     54   %7 = load i32, i32* @d, align 4
     55   %8 = load i32, i32* @e, align 4
     56   %9 = load i32, i32* @f, align 4
     57   %10 = load i32, i32* @g, align 4
     58   %11 = load i32, i32* @h, align 4
     59   %call = call i32 %3(i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11)
     60   %12 = load i32, i32* @sum, align 4
     61   %add = add nsw i32 %12, %call
     62   store i32 %add, i32* @sum, align 4
     63   br label %for.inc
     64 
     65 for.inc:                                          ; preds = %for.body
     66   %13 = load i32, i32* @i, align 4
     67   %inc = add nsw i32 %13, 1
     68   store i32 %inc, i32* @i, align 4
     69   br label %for.cond
     70 
     71 for.end:                                          ; preds = %for.cond
     72   ret void
     73 }
     74 
     75