1; Test floating-point absolute on z14.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
4
5; Test f32.
6declare float @llvm.fabs.f32(float %f)
7define float @f1(float %f) {
8; CHECK-LABEL: f1:
9; CHECK: lpdfr %f0, %f0
10; CHECK: br %r14
11  %res = call float @llvm.fabs.f32(float %f)
12  ret float %res
13}
14
15; Test f64.
16declare double @llvm.fabs.f64(double %f)
17define double @f2(double %f) {
18; CHECK-LABEL: f2:
19; CHECK: lpdfr %f0, %f0
20; CHECK: br %r14
21  %res = call double @llvm.fabs.f64(double %f)
22  ret double %res
23}
24
25; Test f128.  With the loads and stores, a pure absolute would probably
26; be better implemented using an NI on the upper byte.  Do some extra
27; processing so that using FPRs is unequivocally better.
28declare fp128 @llvm.fabs.f128(fp128 %f)
29define void @f3(fp128 *%ptr, fp128 *%ptr2) {
30; CHECK-LABEL: f3:
31; CHECK-DAG: vl [[REG1:%v[0-9]+]], 0(%r2)
32; CHECK-DAG: vl [[REG2:%v[0-9]+]], 0(%r3)
33; CHECK-DAG: wflpxb [[POSREG1:%v[0-9]+]], [[REG1]]
34; CHECK: wfdxb [[RES:%v[0-9]+]], [[POSREG1]], [[REG2]]
35; CHECK: vst [[RES]], 0(%r2)
36; CHECK: br %r14
37  %orig = load fp128, fp128 *%ptr
38  %abs = call fp128 @llvm.fabs.f128(fp128 %orig)
39  %op2 = load fp128, fp128 *%ptr2
40  %res = fdiv fp128 %abs, %op2
41  store fp128 %res, fp128 *%ptr
42  ret void
43}
44