Home | History | Annotate | Download | only in SPARC
      1 ; RUN: llc -march=sparc < %s | FileCheck %s -check-prefix=V8
      2 ; RUN: llc -march=sparc -O0 < %s | FileCheck %s -check-prefix=V8-UNOPT
      3 ; RUN: llc -march=sparc -mattr=v9 < %s | FileCheck %s -check-prefix=V9
      4 ; RUN: llc -mtriple=sparc64-unknown-linux < %s | FileCheck %s -check-prefix=SPARC64
      5 
      6 ; V8-LABEL:     test_neg:
      7 ; V8:     call get_double
      8 ; V8:     fnegs %f0, %f0
      9 
     10 ; V8-UNOPT-LABEL:     test_neg:
     11 ; V8-UNOPT:     fnegs
     12 ; V8-UNOPT:     ! implicit-def
     13 ; V8-UNOPT:     fmovs {{.+}}, %f0
     14 ; V8-UNOPT:     fmovs {{.+}}, %f1
     15 
     16 ; V9-LABEL:     test_neg:
     17 ; V9:     fnegd %f0, %f0
     18 
     19 ; SPARC64-LABEL: test_neg:
     20 ; SPARC64:       fnegd %f0, %f0
     21 
     22 define double @test_neg() {
     23 entry:
     24   %0 = tail call double @get_double()
     25   %1 = fsub double -0.000000e+00, %0
     26   ret double %1
     27 }
     28 
     29 ; V8-LABEL:     test_abs:
     30 ; V8:     fabss %f0, %f0
     31 
     32 ; V8-UNOPT-LABEL:     test_abs:
     33 ; V8-UNOPT:     fabss
     34 ; V8-UNOPT:     ! implicit-def
     35 ; V8-UNOPT:     fmovs {{.+}}, %f0
     36 ; V8-UNOPT:     fmovs {{.+}}, %f1
     37 
     38 ; V9-LABEL:     test_abs:
     39 ; V9:     fabsd %f0, %f0
     40 
     41 
     42 ; SPARC64-LABEL:     test_abs:
     43 ; SPARC64:     fabsd %f0, %f0
     44 
     45 define double @test_abs() {
     46 entry:
     47   %0 = tail call double @get_double()
     48   %1 = tail call double @llvm.fabs.f64(double %0)
     49   ret double %1
     50 }
     51 
     52 declare double @get_double()
     53 declare double @llvm.fabs.f64(double) nounwind readonly
     54 
     55 ; V8-LABEL:    test_v9_floatreg:
     56 ; V8:          fsubd {{.+}}, {{.+}}, {{.+}}
     57 ; V8:          faddd {{.+}}, {{.+}}, [[R:%f(((1|2)?(0|2|4|6|8))|30)]]
     58 ; V8:          std [[R]], [%{{.+}}]
     59 ; V8:          ldd [%{{.+}}], %f0
     60 
     61 ; V9-LABEL:    test_v9_floatreg:
     62 ; V9:          fsubd {{.+}}, {{.+}}, {{.+}}
     63 ; V9:          faddd {{.+}}, {{.+}}, [[R:%f((3(2|4|6|8))|((4|5)(0|2|4|6|8))|(60|62))]]
     64 ; V9:          fmovd [[R]], %f0
     65 
     66 ; SPARC64-LABEL:    test_v9_floatreg:
     67 ; SPARC64:          fsubd {{.+}}, {{.+}}, {{.+}}
     68 ; SPARC64:          faddd {{.+}}, {{.+}}, [[R:%f((3(2|4|6|8))|((4|5)(0|2|4|6|8))|(60|62))]]
     69 ; SPARC64:          fmovd [[R]], %f0
     70 
     71 define double @test_v9_floatreg() {
     72 entry:
     73   %0 = tail call double @get_double()
     74   %1 = tail call double @get_double()
     75   %2 = fsub double %0, %1
     76   tail call void asm sideeffect "", "~{f0},~{f2},~{f3},~{f4},~{f5},~{f6},~{f7},~{f8},~{f9},~{f10},~{f11},~{f12},~{f13},~{f14},~{f15},~{f16},~{f17},~{f18},~{f19},~{f20},~{f21},~{f22},~{f23},~{f24},~{f25},~{f26},~{f27},~{f28},~{f29},~{f30},~{f31}"()
     77   %3 = fadd double %2, %2
     78   ret double %3
     79 }
     80 
     81 ; V8-LABEL:    test_xtos_stox
     82 ; V8:          call __floatdisf
     83 ; V8:          call __fixsfdi
     84 
     85 ; V9-LABEL:    test_xtos_stox
     86 ; V9:          call __floatdisf
     87 ; V9:          call __fixsfdi
     88 
     89 ; SPARC64-LABEL:    test_xtos_stox
     90 ; SPARC64:          fxtos
     91 ; SPARC64:          fstox
     92 
     93 define void @test_xtos_stox(i64 %a, i64* %ptr0, float* %ptr1) {
     94 entry:
     95   %0 = sitofp i64 %a to float
     96   store float %0, float* %ptr1, align 8
     97   %1 = fptosi float %0 to i64
     98   store i64 %1, i64* %ptr0, align 8
     99   ret void
    100 }
    101 
    102 ; V8-LABEL:    test_itos_stoi
    103 ; V8:          fitos
    104 ; V8:          fstoi
    105 
    106 ; V9-LABEL:    test_itos_stoi
    107 ; V9:          fitos
    108 ; V9:          fstoi
    109 
    110 ; SPARC64-LABEL:    test_itos_stoi
    111 ; SPARC64:          fitos
    112 ; SPARC64:          fstoi
    113 
    114 define void @test_itos_stoi(i32 %a, i32* %ptr0, float* %ptr1) {
    115 entry:
    116   %0 = sitofp i32 %a to float
    117   store float %0, float* %ptr1, align 8
    118   %1 = fptosi float %0 to i32
    119   store i32 %1, i32* %ptr0, align 8
    120   ret void
    121 }
    122 
    123 
    124 ; V8-LABEL:    test_xtod_dtox
    125 ; V8:          call __floatdidf
    126 ; V8:          call __fixdfdi
    127 
    128 ; V9-LABEL:    test_xtod_dtox
    129 ; V9:          call __floatdidf
    130 ; V9:          call __fixdfdi
    131 
    132 ; SPARC64-LABEL:    test_xtod_dtox
    133 ; SPARC64:          fxtod
    134 ; SPARC64:          fdtox
    135 
    136 define void @test_xtod_dtox(i64 %a, i64* %ptr0, double* %ptr1) {
    137 entry:
    138   %0 = sitofp i64 %a to double
    139   store double %0, double* %ptr1, align 8
    140   %1 = fptosi double %0 to i64
    141   store i64 %1, i64* %ptr0, align 8
    142   ret void
    143 }
    144 
    145 ; V8-LABEL:    test_itod_dtoi
    146 ; V8:          fitod
    147 ; V8:          fdtoi
    148 
    149 ; V9-LABEL:    test_itod_dtoi
    150 ; V9:          fitod
    151 ; V9:          fdtoi
    152 
    153 ; SPARC64-LABEL:    test_itod_dtoi
    154 ; SPARC64:          fitod
    155 ; SPARC64:          fdtoi
    156 
    157 define void @test_itod_dtoi(i32 %a, i32* %ptr0, double* %ptr1) {
    158 entry:
    159   %0 = sitofp i32 %a to double
    160   store double %0, double* %ptr1, align 8
    161   %1 = fptosi double %0 to i32
    162   store i32 %1, i32* %ptr0, align 8
    163   ret void
    164 }
    165 
    166 ; V8-LABEL:    test_uxtos_stoux
    167 ; V8:          call __floatundisf
    168 ; V8:          call __fixunssfdi
    169 
    170 ; V9-LABEL:    test_uxtos_stoux
    171 ; V9:          call __floatundisf
    172 ; V9:          call __fixunssfdi
    173 
    174 ; SPARC64-LABEL:   test_uxtos_stoux
    175 ; SPARC64-NOT:     call __floatundisf
    176 ; SPARC64-NOT:     call __fixunssfdi
    177 
    178 define void @test_uxtos_stoux(i64 %a, i64* %ptr0, float* %ptr1) {
    179 entry:
    180   %0 = uitofp i64 %a to float
    181   store float %0, float* %ptr1, align 8
    182   %1 = fptoui float %0 to i64
    183   store i64 %1, i64* %ptr0, align 8
    184   ret void
    185 }
    186 
    187 ; V8-LABEL:    test_utos_stou
    188 ; V8:          fdtos
    189 ; V8:          fstoi
    190 
    191 ; V9-LABEL:    test_utos_stou
    192 ; V9:          fdtos
    193 ; V9:          fstoi
    194 
    195 ; SPARC64-LABEL:    test_utos_stou
    196 ; SPARC64:     fdtos
    197 ; SPARC64:     fstoi
    198 
    199 define void @test_utos_stou(i32 %a, i32* %ptr0, float* %ptr1) {
    200 entry:
    201   %0 = uitofp i32 %a to float
    202   store float %0, float* %ptr1, align 8
    203   %1 = fptoui float %0 to i32
    204   store i32 %1, i32* %ptr0, align 8
    205   ret void
    206 }
    207 
    208 
    209 ; V8-LABEL:    test_uxtod_dtoux
    210 ; V8:          call __floatundidf
    211 ; V8:          call __fixunsdfdi
    212 
    213 ; V9-LABEL:    test_uxtod_dtoux
    214 ; V9:          call __floatundidf
    215 ; V9:          call __fixunsdfdi
    216 
    217 ; SPARC64-LABEL:    test_uxtod_dtoux
    218 ; SPARC64-NOT:          call __floatundidf
    219 ; SPARC64-NOT:          call __floatunsdfdi
    220 
    221 define void @test_uxtod_dtoux(i64 %a, i64* %ptr0, double* %ptr1) {
    222 entry:
    223   %0 = uitofp i64 %a to double
    224   store double %0, double* %ptr1, align 8
    225   %1 = fptoui double %0 to i64
    226   store i64 %1, i64* %ptr0, align 8
    227   ret void
    228 }
    229 
    230 ; V8-LABEL:    test_utod_dtou
    231 ; V8-NOT:      fitod
    232 ; V8:          fdtoi
    233 
    234 ; V9-LABEL:    test_utod_dtou
    235 ; V9-NOT:      fitod
    236 ; V9:          fdtoi
    237 
    238 ; SPARC64-LABEL:    test_utod_dtou
    239 ; SPARC64-NOT:      fitod
    240 ; SPARC64:          fdtoi
    241 
    242 define void @test_utod_dtou(i32 %a, double %b, i32* %ptr0, double* %ptr1) {
    243 entry:
    244   %0 = uitofp i32 %a to double
    245   store double %0, double* %ptr1, align 8
    246   %1 = fptoui double %b to i32
    247   store i32 %1, i32* %ptr0, align 8
    248   ret void
    249 }
    250