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