Home | History | Annotate | Download | only in SystemZ
      1 ; Test f64 and v2f64 absolute.
      2 ;
      3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
      4 
      5 declare double @llvm.fabs.f64(double)
      6 declare <2 x double> @llvm.fabs.v2f64(<2 x double>)
      7 
      8 ; Test a plain absolute.
      9 define <2 x double> @f1(<2 x double> %val) {
     10 ; CHECK-LABEL: f1:
     11 ; CHECK: vflpdb %v24, %v24
     12 ; CHECK: br %r14
     13   %ret = call <2 x double> @llvm.fabs.v2f64(<2 x double> %val)
     14   ret <2 x double> %ret
     15 }
     16 
     17 ; Test a negative absolute.
     18 define <2 x double> @f2(<2 x double> %val) {
     19 ; CHECK-LABEL: f2:
     20 ; CHECK: vflndb %v24, %v24
     21 ; CHECK: br %r14
     22   %abs = call <2 x double> @llvm.fabs.v2f64(<2 x double> %val)
     23   %ret = fsub <2 x double> <double -0.0, double -0.0>, %abs
     24   ret <2 x double> %ret
     25 }
     26 
     27 ; Test an f64 absolute that uses vector registers.
     28 define double @f3(<2 x double> %val) {
     29 ; CHECK-LABEL: f3:
     30 ; CHECK: wflpdb %f0, %v24
     31 ; CHECK: br %r14
     32   %scalar = extractelement <2 x double> %val, i32 0
     33   %ret = call double @llvm.fabs.f64(double %scalar)
     34   ret double %ret
     35 }
     36 
     37 ; Test an f64 negative absolute that uses vector registers.
     38 define double @f4(<2 x double> %val) {
     39 ; CHECK-LABEL: f4:
     40 ; CHECK: wflndb %f0, %v24
     41 ; CHECK: br %r14
     42   %scalar = extractelement <2 x double> %val, i32 0
     43   %abs = call double @llvm.fabs.f64(double %scalar)
     44   %ret = fsub double -0.0, %abs
     45   ret double %ret
     46 }
     47