1; Test floating-point negation.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
4; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
5
6; Test f32.
7define float @f1(float %f) {
8; CHECK-LABEL: f1:
9; CHECK: lcdfr %f0, %f0
10; CHECK: br %r14
11  %res = fneg float %f
12  ret float %res
13}
14
15; Test f64.
16define double @f2(double %f) {
17; CHECK-LABEL: f2:
18; CHECK: lcdfr %f0, %f0
19; CHECK: br %r14
20  %res = fneg double %f
21  ret double %res
22}
23
24; Test f128.  With the loads and stores, a pure negation would probably
25; be better implemented using an XI on the upper byte.  Do some extra
26; processing so that using FPRs is unequivocally better.
27define void @f3(fp128 *%ptr, fp128 *%ptr2) {
28; CHECK-LABEL: f3:
29; CHECK: lcxbr
30; CHECK: dxbr
31; CHECK: br %r14
32  %orig = load fp128, fp128 *%ptr
33  %negzero = fpext float -0.0 to fp128
34  %neg = fneg fp128 %orig
35  %op2 = load fp128, fp128 *%ptr2
36  %res = fdiv fp128 %neg, %op2
37  store fp128 %res, fp128 *%ptr
38  ret void
39}
40