1 ; RUN: llc -mcpu=pwr7 -mtriple=powerpc64-unknown-linux-gnu -mattr=-vsx < %s | FileCheck %s 2 ; RUN: llc -mcpu=pwr7 -mtriple=powerpc64-unknown-linux-gnu -mattr=+vsx < %s | FileCheck %s -check-prefix=CHECK-VSX 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-f128:128:128-v128:128:128-n32:64" 4 target triple = "powerpc64-unknown-linux-gnu" 5 6 define double @foo_d_ll(ppc_fp128 %a, ppc_fp128 %b) #0 { 7 entry: 8 %call = tail call ppc_fp128 @copysignl(ppc_fp128 %a, ppc_fp128 %b) #0 9 %conv = fptrunc ppc_fp128 %call to double 10 ret double %conv 11 12 ; CHECK-LABEL: @foo_d_ll 13 ; CHECK: fcpsgn 1, 3, 1 14 ; CHECK: blr 15 ; CHECK-VSX-LABEL: @foo_d_ll 16 ; CHECK-VSX: xscpsgndp 1, 3, 1 17 ; CHECK-VSX: blr 18 } 19 20 declare ppc_fp128 @copysignl(ppc_fp128, ppc_fp128) #0 21 22 define double @foo_dl(double %a, ppc_fp128 %b) #0 { 23 entry: 24 %conv = fptrunc ppc_fp128 %b to double 25 %call = tail call double @copysign(double %a, double %conv) #0 26 ret double %call 27 28 ; CHECK-LABEL: @foo_dl 29 ; CHECK: fcpsgn 1, 2, 1 30 ; CHECK: blr 31 ; CHECK-VSX-LABEL: @foo_dl 32 ; CHECK-VSX: xscpsgndp 1, 2, 1 33 ; CHECK-VSX: blr 34 } 35 36 declare double @copysign(double, double) #0 37 38 define ppc_fp128 @foo_ll(double %a, ppc_fp128 %b) #0 { 39 entry: 40 %conv = fpext double %a to ppc_fp128 41 %call = tail call ppc_fp128 @copysignl(ppc_fp128 %conv, ppc_fp128 %b) #0 42 ret ppc_fp128 %call 43 44 ; CHECK-LABEL: @foo_ll 45 ; CHECK: bl copysignl 46 ; CHECK: blr 47 ; CHECK-VSX-LABEL: @foo_ll 48 ; CHECK-VSX: bl copysignl 49 ; CHECK-VSX: blr 50 } 51 52 define ppc_fp128 @foo_ld(double %a, double %b) #0 { 53 entry: 54 %conv = fpext double %a to ppc_fp128 55 %conv1 = fpext double %b to ppc_fp128 56 %call = tail call ppc_fp128 @copysignl(ppc_fp128 %conv, ppc_fp128 %conv1) #0 57 ret ppc_fp128 %call 58 59 ; CHECK-LABEL: @foo_ld 60 ; CHECK: bl copysignl 61 ; CHECK: blr 62 ; CHECK-VSX-LABEL: @foo_ld 63 ; CHECK-VSX: bl copysignl 64 ; CHECK-VSX: blr 65 } 66 67 define ppc_fp128 @foo_lf(double %a, float %b) #0 { 68 entry: 69 %conv = fpext double %a to ppc_fp128 70 %conv1 = fpext float %b to ppc_fp128 71 %call = tail call ppc_fp128 @copysignl(ppc_fp128 %conv, ppc_fp128 %conv1) #0 72 ret ppc_fp128 %call 73 74 ; CHECK-LABEL: @foo_lf 75 ; CHECK: bl copysignl 76 ; CHECK: blr 77 ; CHECK-VSX-LABEL: @foo_lf 78 ; CHECK-VSX: bl copysignl 79 ; CHECK-VSX: blr 80 } 81 82 attributes #0 = { nounwind readnone } 83 84