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