1 ; Test f128 copysign operations on z14.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
5 declare float @copysignf(float, float) readnone
6 declare double @copysign(double, double) readnone
7 ; FIXME: not really the correct prototype for SystemZ.
8 declare fp128 @copysignl(fp128, fp128) readnone
10 ; Test f32 copies in which the sign comes from an f128.
11 define float @f1(float %a, ptr %bptr) {
13 ; CHECK: vl %v[[REG:[0-9]+]], 0(%r2)
14 ; CHECK: cpsdr %f0, %f[[REG]], %f0
16 %bl = load volatile fp128, ptr %bptr
17 %b = fptrunc fp128 %bl to float
18 %res = call float @copysignf(float %a, float %b) readnone
22 ; Test f64 copies in which the sign comes from an f128.
23 define double @f2(double %a, ptr %bptr) {
25 ; CHECK: vl %v[[REG:[0-9]+]], 0(%r2)
26 ; CHECK: cpsdr %f0, %f[[REG]], %f0
28 %bl = load volatile fp128, ptr %bptr
29 %b = fptrunc fp128 %bl to double
30 %res = call double @copysign(double %a, double %b) readnone
34 ; Test f128 copies in which the sign comes from an f32.
35 define void @f7(ptr %cptr, ptr %aptr, float %bf) {
37 ; CHECK: vl [[REG1:%v[0-7]+]], 0(%r3)
39 ; CHECK: wflnxb [[REG2:%v[0-9]+]], [[REG1]]
40 ; CHECK: wflpxb [[REG2]], [[REG1]]
41 ; CHECK: vst [[REG2]], 0(%r2)
43 %a = load volatile fp128, ptr %aptr
44 %b = fpext float %bf to fp128
45 %c = call fp128 @copysignl(fp128 %a, fp128 %b) readnone
46 store fp128 %c, ptr %cptr
50 ; As above, but the sign comes from an f64.
51 define void @f8(ptr %cptr, ptr %aptr, double %bd) {
53 ; CHECK: vl [[REG1:%v[0-7]+]], 0(%r3)
55 ; CHECK: wflnxb [[REG2:%v[0-9]+]], [[REG1]]
56 ; CHECK: wflpxb [[REG2]], [[REG1]]
57 ; CHECK: vst [[REG2]], 0(%r2)
59 %a = load volatile fp128, ptr %aptr
60 %b = fpext double %bd to fp128
61 %c = call fp128 @copysignl(fp128 %a, fp128 %b) readnone
62 store fp128 %c, ptr %cptr
66 ; As above, but the sign comes from an f128.
67 define void @f9(ptr %cptr, ptr %aptr, ptr %bptr) {
69 ; CHECK: vl [[REG1:%v[0-7]+]], 0(%r3)
70 ; CHECK: vl [[REG2:%v[0-7]+]], 0(%r4)
72 ; CHECK: wflnxb [[REG1]], [[REG1]]
73 ; CHECK: wflpxb [[REG1]], [[REG1]]
74 ; CHECK: vst [[REG1]], 0(%r2)
76 %a = load volatile fp128, ptr %aptr
77 %b = load volatile fp128, ptr %bptr
78 %c = call fp128 @copysignl(fp128 %a, fp128 %b) readnone
79 store fp128 %c, ptr %cptr