1; Test f128 copysign operations on z14. 2; 3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s 4 5declare float @copysignf(float, float) readnone 6declare double @copysign(double, double) readnone 7; FIXME: not really the correct prototype for SystemZ. 8declare fp128 @copysignl(fp128, fp128) readnone 9 10; Test f32 copies in which the sign comes from an f128. 11define float @f1(float %a, fp128 *%bptr) { 12; CHECK-LABEL: f1: 13; CHECK: vl %v[[REG:[0-9]+]], 0(%r2) 14; CHECK: cpsdr %f0, %f[[REG]], %f0 15; CHECK: br %r14 16 %bl = load volatile fp128, fp128 *%bptr 17 %b = fptrunc fp128 %bl to float 18 %res = call float @copysignf(float %a, float %b) readnone 19 ret float %res 20} 21 22; Test f64 copies in which the sign comes from an f128. 23define double @f2(double %a, fp128 *%bptr) { 24; CHECK-LABEL: f2: 25; CHECK: vl %v[[REG:[0-9]+]], 0(%r2) 26; CHECK: cpsdr %f0, %f[[REG]], %f0 27; CHECK: br %r14 28 %bl = load volatile fp128, fp128 *%bptr 29 %b = fptrunc fp128 %bl to double 30 %res = call double @copysign(double %a, double %b) readnone 31 ret double %res 32} 33 34; Test f128 copies in which the sign comes from an f32. 35define void @f7(fp128 *%cptr, fp128 *%aptr, float %bf) { 36; CHECK-LABEL: f7: 37; CHECK: vl [[REG1:%v[0-7]+]], 0(%r3) 38; CHECK: tmlh 39; CHECK: wflnxb [[REG2:%v[0-9]+]], [[REG1]] 40; CHECK: wflpxb [[REG2]], [[REG1]] 41; CHECK: vst [[REG2]], 0(%r2) 42; CHECK: br %r14 43 %a = load volatile fp128, fp128 *%aptr 44 %b = fpext float %bf to fp128 45 %c = call fp128 @copysignl(fp128 %a, fp128 %b) readnone 46 store fp128 %c, fp128 *%cptr 47 ret void 48} 49 50; As above, but the sign comes from an f64. 51define void @f8(fp128 *%cptr, fp128 *%aptr, double %bd) { 52; CHECK-LABEL: f8: 53; CHECK: vl [[REG1:%v[0-7]+]], 0(%r3) 54; CHECK: tmhh 55; CHECK: wflnxb [[REG2:%v[0-9]+]], [[REG1]] 56; CHECK: wflpxb [[REG2]], [[REG1]] 57; CHECK: vst [[REG2]], 0(%r2) 58; CHECK: br %r14 59 %a = load volatile fp128, fp128 *%aptr 60 %b = fpext double %bd to fp128 61 %c = call fp128 @copysignl(fp128 %a, fp128 %b) readnone 62 store fp128 %c, fp128 *%cptr 63 ret void 64} 65 66; As above, but the sign comes from an f128. 67define void @f9(fp128 *%cptr, fp128 *%aptr, fp128 *%bptr) { 68; CHECK-LABEL: f9: 69; CHECK: vl [[REG1:%v[0-7]+]], 0(%r3) 70; CHECK: vl [[REG2:%v[0-7]+]], 0(%r4) 71; CHECK: tm 72; CHECK: wflnxb [[REG1]], [[REG1]] 73; CHECK: wflpxb [[REG1]], [[REG1]] 74; CHECK: vst [[REG1]], 0(%r2) 75; CHECK: br %r14 76 %a = load volatile fp128, fp128 *%aptr 77 %b = load volatile fp128, fp128 *%bptr 78 %c = call fp128 @copysignl(fp128 %a, fp128 %b) readnone 79 store fp128 %c, fp128 *%cptr 80 ret void 81} 82