Home | History | Annotate | Download | only in SystemZ
      1 ; Test negated floating-point absolute.
      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.
      7 declare float @llvm.fabs.f32(float %f)
      8 define float @f1(float %f) {
      9 ; CHECK-LABEL: f1:
     10 ; CHECK: lndfr %f0, %f0
     11 ; CHECK: br %r14
     12   %abs = call float @llvm.fabs.f32(float %f)
     13   %res = fsub float -0.0, %abs
     14   ret float %res
     15 }
     16 
     17 ; Test f64.
     18 declare double @llvm.fabs.f64(double %f)
     19 define double @f2(double %f) {
     20 ; CHECK-LABEL: f2:
     21 ; CHECK: lndfr %f0, %f0
     22 ; CHECK: br %r14
     23   %abs = call double @llvm.fabs.f64(double %f)
     24   %res = fsub double -0.0, %abs
     25   ret double %res
     26 }
     27 
     28 ; Test f128.  With the loads and stores, a pure negative-absolute would
     29 ; probably be better implemented using an OI on the upper byte.  Do some
     30 ; extra processing so that using FPRs is unequivocally better.
     31 declare fp128 @llvm.fabs.f128(fp128 %f)
     32 define void @f3(fp128 *%ptr, fp128 *%ptr2) {
     33 ; CHECK-LABEL: f3:
     34 ; CHECK: lnxbr
     35 ; CHECK: dxbr
     36 ; CHECK: br %r14
     37   %orig = load fp128 , fp128 *%ptr
     38   %abs = call fp128 @llvm.fabs.f128(fp128 %orig)
     39   %negabs = fsub fp128 0xL00000000000000008000000000000000, %abs
     40   %op2 = load fp128 , fp128 *%ptr2
     41   %res = fdiv fp128 %negabs, %op2
     42   store fp128 %res, fp128 *%ptr
     43   ret void
     44 }
     45