Home | History | Annotate | Download | only in AArch64
      1 ; RUN: llc < %s -mtriple=arm64-apple-darwin | FileCheck %s
      2 
      3 ; rdar://9332258
      4 
      5 define float @test1(float %x, float %y) nounwind {
      6 entry:
      7 ; CHECK-LABEL: test1:
      8 ; CHECK: movi.4s	v2, #0x80, lsl #24
      9 ; CHECK: bit.16b	v0, v1, v2
     10   %0 = tail call float @copysignf(float %x, float %y) nounwind readnone
     11   ret float %0
     12 }
     13 
     14 define double @test2(double %x, double %y) nounwind {
     15 entry:
     16 ; CHECK-LABEL: test2:
     17 ; CHECK: movi.2d	v2, #0
     18 ; CHECK: fneg.2d	v2, v2
     19 ; CHECK: bit.16b	v0, v1, v2
     20   %0 = tail call double @copysign(double %x, double %y) nounwind readnone
     21   ret double %0
     22 }
     23 
     24 ; rdar://9545768
     25 define double @test3(double %a, float %b, float %c) nounwind {
     26 ; CHECK-LABEL: test3:
     27 ; CHECK: fcvt d1, s1
     28 ; CHECK: fneg.2d v2, v{{[0-9]+}}
     29 ; CHECK: bit.16b v0, v1, v2
     30   %tmp1 = fadd float %b, %c
     31   %tmp2 = fpext float %tmp1 to double
     32   %tmp = tail call double @copysign( double %a, double %tmp2 ) nounwind readnone
     33   ret double %tmp
     34 }
     35 
     36 define float @test4() nounwind {
     37 entry:
     38 ; CHECK-LABEL: test4:
     39 ; CHECK: fcvt s0, d0
     40 ; CHECK: movi.4s v[[CONST:[0-9]+]], #0x80, lsl #24
     41 ; CHECK: bit.16b v{{[0-9]+}}, v0, v[[CONST]]
     42   %0 = tail call double (...) @bar() nounwind
     43   %1 = fptrunc double %0 to float
     44   %2 = tail call float @copysignf(float 5.000000e-01, float %1) nounwind readnone
     45   %3 = fadd float %1, %2
     46   ret float %3
     47 }
     48 
     49 declare double @bar(...)
     50 declare double @copysign(double, double) nounwind readnone
     51 declare float @copysignf(float, float) nounwind readnone
     52