1 ; Test floating-point absolute. 2 ; 3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 4 5 ; Test f32. 6 declare float @llvm.fabs.f32(float %f) 7 define float @f1(float %f) { 8 ; CHECK-LABEL: f1: 9 ; CHECK: lpebr %f0, %f0 10 ; CHECK: br %r14 11 %res = call float @llvm.fabs.f32(float %f) 12 ret float %res 13 } 14 15 ; Test f64. 16 declare double @llvm.fabs.f64(double %f) 17 define double @f2(double %f) { 18 ; CHECK-LABEL: f2: 19 ; CHECK: lpdbr %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. 28 declare fp128 @llvm.fabs.f128(fp128 %f) 29 define void @f3(fp128 *%ptr, fp128 *%ptr2) { 30 ; CHECK-LABEL: f3: 31 ; CHECK: lpxbr 32 ; CHECK: dxbr 33 ; CHECK: br %r14 34 %orig = load fp128 *%ptr 35 %abs = call fp128 @llvm.fabs.f128(fp128 %orig) 36 %op2 = load fp128 *%ptr2 37 %res = fdiv fp128 %abs, %op2 38 store fp128 %res, fp128 *%ptr 39 ret void 40 } 41