Home | History | Annotate | Download | only in ARM
      1 ; RUN: llc < %s -mtriple=arm-apple-ios -mattr=+vfp2 -disable-post-ra | FileCheck %s
      2 ; RUN: llc < %s -mtriple=arm-apple-ios -mattr=+vfp2 -disable-post-ra -regalloc=basic | FileCheck %s
      3 
      4 define void @test(float* %P, double* %D) {
      5 	%A = load float, float* %P		; <float> [#uses=1]
      6 	%B = load double, double* %D		; <double> [#uses=1]
      7 	store float %A, float* %P
      8 	store double %B, double* %D
      9 	ret void
     10 }
     11 
     12 declare float @fabsf(float)
     13 
     14 declare double @fabs(double)
     15 
     16 define void @test_abs(float* %P, double* %D) {
     17 ;CHECK-LABEL: test_abs:
     18 	%a = load float, float* %P		; <float> [#uses=1]
     19 ;CHECK: vabs.f32
     20 	%b = call float @fabsf( float %a ) readnone	; <float> [#uses=1]
     21 	store float %b, float* %P
     22 	%A = load double, double* %D		; <double> [#uses=1]
     23 ;CHECK: vabs.f64
     24 	%B = call double @fabs( double %A ) readnone	; <double> [#uses=1]
     25 	store double %B, double* %D
     26 	ret void
     27 }
     28 
     29 define void @test_add(float* %P, double* %D) {
     30 ;CHECK-LABEL: test_add:
     31 	%a = load float, float* %P		; <float> [#uses=2]
     32 	%b = fadd float %a, %a		; <float> [#uses=1]
     33 	store float %b, float* %P
     34 	%A = load double, double* %D		; <double> [#uses=2]
     35 	%B = fadd double %A, %A		; <double> [#uses=1]
     36 	store double %B, double* %D
     37 	ret void
     38 }
     39 
     40 define void @test_ext_round(float* %P, double* %D) {
     41 ;CHECK-LABEL: test_ext_round:
     42 	%a = load float, float* %P		; <float> [#uses=1]
     43 ;CHECK: vcvt.f64.f32
     44 ;CHECK: vcvt.f32.f64
     45 	%b = fpext float %a to double		; <double> [#uses=1]
     46 	%A = load double, double* %D		; <double> [#uses=1]
     47 	%B = fptrunc double %A to float		; <float> [#uses=1]
     48 	store double %b, double* %D
     49 	store float %B, float* %P
     50 	ret void
     51 }
     52 
     53 define void @test_fma(float* %P1, float* %P2, float* %P3) {
     54 ;CHECK-LABEL: test_fma:
     55 	%a1 = load float, float* %P1		; <float> [#uses=1]
     56 	%a2 = load float, float* %P2		; <float> [#uses=1]
     57 	%a3 = load float, float* %P3		; <float> [#uses=1]
     58 ;CHECK: vnmls.f32
     59 	%X = fmul float %a1, %a2		; <float> [#uses=1]
     60 	%Y = fsub float %X, %a3		; <float> [#uses=1]
     61 	store float %Y, float* %P1
     62 	ret void
     63 }
     64 
     65 define i32 @test_ftoi(float* %P1) {
     66 ;CHECK-LABEL: test_ftoi:
     67 	%a1 = load float, float* %P1		; <float> [#uses=1]
     68 ;CHECK: vcvt.s32.f32
     69 	%b1 = fptosi float %a1 to i32		; <i32> [#uses=1]
     70 	ret i32 %b1
     71 }
     72 
     73 define i32 @test_ftou(float* %P1) {
     74 ;CHECK-LABEL: test_ftou:
     75 	%a1 = load float, float* %P1		; <float> [#uses=1]
     76 ;CHECK: vcvt.u32.f32
     77 	%b1 = fptoui float %a1 to i32		; <i32> [#uses=1]
     78 	ret i32 %b1
     79 }
     80 
     81 define i32 @test_dtoi(double* %P1) {
     82 ;CHECK-LABEL: test_dtoi:
     83 	%a1 = load double, double* %P1		; <double> [#uses=1]
     84 ;CHECK: vcvt.s32.f64
     85 	%b1 = fptosi double %a1 to i32		; <i32> [#uses=1]
     86 	ret i32 %b1
     87 }
     88 
     89 define i32 @test_dtou(double* %P1) {
     90 ;CHECK-LABEL: test_dtou:
     91 	%a1 = load double, double* %P1		; <double> [#uses=1]
     92 ;CHECK: vcvt.u32.f64
     93 	%b1 = fptoui double %a1 to i32		; <i32> [#uses=1]
     94 	ret i32 %b1
     95 }
     96 
     97 define void @test_utod(double* %P1, i32 %X) {
     98 ;CHECK-LABEL: test_utod:
     99 ;CHECK: vcvt.f64.u32
    100 	%b1 = uitofp i32 %X to double		; <double> [#uses=1]
    101 	store double %b1, double* %P1
    102 	ret void
    103 }
    104 
    105 define void @test_utod2(double* %P1, i8 %X) {
    106 ;CHECK-LABEL: test_utod2:
    107 ;CHECK: vcvt.f64.u32
    108 	%b1 = uitofp i8 %X to double		; <double> [#uses=1]
    109 	store double %b1, double* %P1
    110 	ret void
    111 }
    112 
    113 define void @test_cmp(float* %glob, i32 %X) {
    114 ;CHECK-LABEL: test_cmp:
    115 entry:
    116 	%tmp = load float, float* %glob		; <float> [#uses=2]
    117 	%tmp3 = getelementptr float, float* %glob, i32 2		; <float*> [#uses=1]
    118 	%tmp4 = load float, float* %tmp3		; <float> [#uses=2]
    119 	%tmp.upgrd.1 = fcmp oeq float %tmp, %tmp4		; <i1> [#uses=1]
    120 	%tmp5 = fcmp uno float %tmp, %tmp4		; <i1> [#uses=1]
    121 	%tmp6 = or i1 %tmp.upgrd.1, %tmp5		; <i1> [#uses=1]
    122 ;CHECK: bmi
    123 ;CHECK-NEXT: bgt
    124 	br i1 %tmp6, label %cond_true, label %cond_false
    125 
    126 cond_true:		; preds = %entry
    127 	%tmp.upgrd.2 = tail call i32 (...) @bar( )		; <i32> [#uses=0]
    128 	ret void
    129 
    130 cond_false:		; preds = %entry
    131 	%tmp7 = tail call i32 (...) @baz( )		; <i32> [#uses=0]
    132 	ret void
    133 }
    134 
    135 declare i1 @llvm.isunordered.f32(float, float)
    136 
    137 declare i32 @bar(...)
    138 
    139 declare i32 @baz(...)
    140 
    141 define void @test_cmpfp0(float* %glob, i32 %X) {
    142 ;CHECK-LABEL: test_cmpfp0:
    143 entry:
    144 	%tmp = load float, float* %glob		; <float> [#uses=1]
    145 ;CHECK: vcmpe.f32
    146 	%tmp.upgrd.3 = fcmp ogt float %tmp, 0.000000e+00		; <i1> [#uses=1]
    147 	br i1 %tmp.upgrd.3, label %cond_true, label %cond_false
    148 
    149 cond_true:		; preds = %entry
    150 	%tmp.upgrd.4 = tail call i32 (...) @bar( )		; <i32> [#uses=0]
    151 	ret void
    152 
    153 cond_false:		; preds = %entry
    154 	%tmp1 = tail call i32 (...) @baz( )		; <i32> [#uses=0]
    155 	ret void
    156 }
    157