Home | History | Annotate | Download | only in X86
      1 ; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
      2 
      3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
      4 target triple = "x86_64-apple-macosx10.8.0"
      5 
      6 ; int foo(double *A, float *B, int g) {
      7 ;   float B0 = B[0];
      8 ;   float B1 = B[1]; <----- BasicBlock #1
      9 ;   B0 += 5;
     10 ;   B1 += 8;
     11 ;
     12 ;   if (g) bar();
     13 ;
     14 ;   A[0] += B0;     <------- BasicBlock #3
     15 ;   A[1] += B1;
     16 ; }
     17 
     18 
     19 ;CHECK-LABEL: @foo(
     20 ;CHECK: load <2 x float>
     21 ;CHECK: fadd <2 x float>
     22 ;CHECK: call i32
     23 ;CHECK: load <2 x double>
     24 ;CHECK: fadd <2 x double>
     25 ;CHECK: store <2 x double>
     26 ;CHECK: ret
     27 define i32 @foo(double* nocapture %A, float* nocapture %B, i32 %g) {
     28 entry:
     29   %0 = load float, float* %B, align 4
     30   %arrayidx1 = getelementptr inbounds float, float* %B, i64 1
     31   %1 = load float, float* %arrayidx1, align 4
     32   %add = fadd float %0, 5.000000e+00
     33   %add2 = fadd float %1, 8.000000e+00
     34   %tobool = icmp eq i32 %g, 0
     35   br i1 %tobool, label %if.end, label %if.then
     36 
     37 if.then:
     38   %call = tail call i32 (...) @bar()
     39   br label %if.end
     40 
     41 if.end:
     42   %conv = fpext float %add to double
     43   %2 = load double, double* %A, align 8
     44   %add4 = fadd double %conv, %2
     45   store double %add4, double* %A, align 8
     46   %conv5 = fpext float %add2 to double
     47   %arrayidx6 = getelementptr inbounds double, double* %A, i64 1
     48   %3 = load double, double* %arrayidx6, align 8
     49   %add7 = fadd double %conv5, %3
     50   store double %add7, double* %arrayidx6, align 8
     51   ret i32 undef
     52 }
     53 
     54 declare i32 @bar(...)
     55