Home | History | Annotate | Download | only in Thumb2
      1 ; RUN: opt < %s -std-compile-opts | \
      2 ; RUN:   llc -mtriple=thumbv7-apple-darwin10 -mattr=+neon | FileCheck %s
      3 
      4 define void @fred(i32 %three_by_three, i8* %in, double %dt1, i32 %x_size, i32 %y_size, i8* %bp) nounwind {
      5 entry:
      6 ; -- The loop following the load should only use a single add-literation
      7 ;    instruction.
      8 ; CHECK: ldr.64
      9 ; CHECK: adds r{{[0-9]+.*}}#1
     10 ; CHECK-NOT: adds
     11 ; CHECK: subsections_via_symbols
     12 
     13 
     14   %three_by_three_addr = alloca i32               ; <i32*> [#uses=2]
     15   %in_addr = alloca i8*                           ; <i8**> [#uses=2]
     16   %dt_addr = alloca float                         ; <float*> [#uses=4]
     17   %x_size_addr = alloca i32                       ; <i32*> [#uses=2]
     18   %y_size_addr = alloca i32                       ; <i32*> [#uses=1]
     19   %bp_addr = alloca i8*                           ; <i8**> [#uses=1]
     20   %tmp_image = alloca i8*                         ; <i8**> [#uses=0]
     21   %out = alloca i8*                               ; <i8**> [#uses=1]
     22   %cp = alloca i8*                                ; <i8**> [#uses=0]
     23   %dpt = alloca i8*                               ; <i8**> [#uses=4]
     24   %dp = alloca i8*                                ; <i8**> [#uses=2]
     25   %ip = alloca i8*                                ; <i8**> [#uses=0]
     26   %centre = alloca i32                            ; <i32*> [#uses=0]
     27   %tmp = alloca i32                               ; <i32*> [#uses=0]
     28   %brightness = alloca i32                        ; <i32*> [#uses=0]
     29   %area = alloca i32                              ; <i32*> [#uses=0]
     30   %y = alloca i32                                 ; <i32*> [#uses=0]
     31   %x = alloca i32                                 ; <i32*> [#uses=2]
     32   %j = alloca i32                                 ; <i32*> [#uses=6]
     33   %i = alloca i32                                 ; <i32*> [#uses=1]
     34   %mask_size = alloca i32                         ; <i32*> [#uses=5]
     35   %increment = alloca i32                         ; <i32*> [#uses=1]
     36   %n_max = alloca i32                             ; <i32*> [#uses=4]
     37   %temp = alloca float                            ; <float*> [#uses=1]
     38   %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
     39   store i32 %three_by_three, i32* %three_by_three_addr
     40   store i8* %in, i8** %in_addr
     41   %dt = fptrunc double %dt1 to float              ; <float> [#uses=1]
     42   store float %dt, float* %dt_addr
     43   store i32 %x_size, i32* %x_size_addr
     44   store i32 %y_size, i32* %y_size_addr
     45   store i8* %bp, i8** %bp_addr
     46   %0 = load i8** %in_addr, align 4                ; <i8*> [#uses=1]
     47   store i8* %0, i8** %out, align 4
     48   %1 = call  i32 (...)* @foo() nounwind ; <i32> [#uses=1]
     49   store i32 %1, i32* %i, align 4
     50   %2 = load i32* %three_by_three_addr, align 4    ; <i32> [#uses=1]
     51   %3 = icmp eq i32 %2, 0                          ; <i1> [#uses=1]
     52   br i1 %3, label %bb, label %bb2
     53 
     54 bb:                                               ; preds = %entry
     55   %4 = load float* %dt_addr, align 4              ; <float> [#uses=1]
     56   %5 = fpext float %4 to double                   ; <double> [#uses=1]
     57   %6 = fmul double %5, 1.500000e+00               ; <double> [#uses=1]
     58   %7 = fptosi double %6 to i32                    ; <i32> [#uses=1]
     59   %8 = add nsw i32 %7, 1                          ; <i32> [#uses=1]
     60   store i32 %8, i32* %mask_size, align 4
     61   br label %bb3
     62 
     63 bb2:                                              ; preds = %entry
     64   store i32 1, i32* %mask_size, align 4
     65   br label %bb3
     66 
     67 bb3:                                              ; preds = %bb2, %bb
     68   %9 = load i32* %mask_size, align 4              ; <i32> [#uses=1]
     69   %10 = mul i32 %9, 2                             ; <i32> [#uses=1]
     70   %11 = add nsw i32 %10, 1                        ; <i32> [#uses=1]
     71   store i32 %11, i32* %n_max, align 4
     72   %12 = load i32* %x_size_addr, align 4           ; <i32> [#uses=1]
     73   %13 = load i32* %n_max, align 4                 ; <i32> [#uses=1]
     74   %14 = sub i32 %12, %13                          ; <i32> [#uses=1]
     75   store i32 %14, i32* %increment, align 4
     76   %15 = load i32* %n_max, align 4                 ; <i32> [#uses=1]
     77   %16 = load i32* %n_max, align 4                 ; <i32> [#uses=1]
     78   %17 = mul i32 %15, %16                          ; <i32> [#uses=1]
     79   %18 = call  noalias i8* @malloc(i32 %17) nounwind ; <i8*> [#uses=1]
     80   store i8* %18, i8** %dp, align 4
     81   %19 = load i8** %dp, align 4                    ; <i8*> [#uses=1]
     82   store i8* %19, i8** %dpt, align 4
     83   %20 = load float* %dt_addr, align 4             ; <float> [#uses=1]
     84   %21 = load float* %dt_addr, align 4             ; <float> [#uses=1]
     85   %22 = fmul float %20, %21                       ; <float> [#uses=1]
     86   %23 = fsub float -0.000000e+00, %22             ; <float> [#uses=1]
     87   store float %23, float* %temp, align 4
     88   %24 = load i32* %mask_size, align 4             ; <i32> [#uses=1]
     89   %25 = sub i32 0, %24                            ; <i32> [#uses=1]
     90   store i32 %25, i32* %j, align 4
     91   br label %bb5
     92 
     93 bb4:                                              ; preds = %bb5
     94   %26 = load i32* %j, align 4                     ; <i32> [#uses=1]
     95   %27 = load i32* %j, align 4                     ; <i32> [#uses=1]
     96   %28 = mul i32 %26, %27                          ; <i32> [#uses=1]
     97   %29 = sitofp i32 %28 to double                  ; <double> [#uses=1]
     98   %30 = fmul double %29, 1.234000e+00             ; <double> [#uses=1]
     99   %31 = fptosi double %30 to i32                  ; <i32> [#uses=1]
    100   store i32 %31, i32* %x, align 4
    101   %32 = load i32* %x, align 4                     ; <i32> [#uses=1]
    102   %33 = trunc i32 %32 to i8                       ; <i8> [#uses=1]
    103   %34 = load i8** %dpt, align 4                   ; <i8*> [#uses=1]
    104   store i8 %33, i8* %34, align 1
    105   %35 = load i8** %dpt, align 4                   ; <i8*> [#uses=1]
    106   %36 = getelementptr inbounds i8* %35, i64 1     ; <i8*> [#uses=1]
    107   store i8* %36, i8** %dpt, align 4
    108   %37 = load i32* %j, align 4                     ; <i32> [#uses=1]
    109   %38 = add nsw i32 %37, 1                        ; <i32> [#uses=1]
    110   store i32 %38, i32* %j, align 4
    111   br label %bb5
    112 
    113 bb5:                                              ; preds = %bb4, %bb3
    114   %39 = load i32* %j, align 4                     ; <i32> [#uses=1]
    115   %40 = load i32* %mask_size, align 4             ; <i32> [#uses=1]
    116   %41 = icmp sle i32 %39, %40                     ; <i1> [#uses=1]
    117   br i1 %41, label %bb4, label %bb6
    118 
    119 bb6:                                              ; preds = %bb5
    120   br label %return
    121 
    122 return:                                           ; preds = %bb6
    123   ret void
    124 }
    125 
    126 declare i32 @foo(...)
    127 
    128 declare noalias i8* @malloc(i32) nounwind
    129