1 ; Test floating-point absolute on z14.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
6 declare float @llvm.fabs.f32(float %f)
7 define float @f1(float %f) {
9 ; CHECK: lpdfr %f0, %f0
11 %res = call float @llvm.fabs.f32(float %f)
16 declare double @llvm.fabs.f64(double %f)
17 define double @f2(double %f) {
19 ; CHECK: lpdfr %f0, %f0
21 %res = call double @llvm.fabs.f64(double %f)
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.
28 declare fp128 @llvm.fabs.f128(fp128 %f)
29 define void @f3(ptr %ptr, ptr %ptr2) {
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)
37 %orig = load fp128, ptr %ptr
38 %abs = call fp128 @llvm.fabs.f128(fp128 %orig)
39 %op2 = load fp128, ptr %ptr2
40 %res = fdiv fp128 %abs, %op2
41 store fp128 %res, ptr %ptr