brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · a8580db Raw
81 lines · plain
1; Test that floating-point instructions that set cc are used to2; eliminate compares for load complement, load negative and load3; positive.4;5; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s6; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s7 8; Load complement (sign-bit flipped).9; Test f3210define float @f1(float %a, float %b, float %f) {11; CHECK-LABEL: f1:12; CHECK: ltebr13; CHECK-NEXT: ber %r1414  %neg = fneg float %f15  %cond = fcmp oeq float %neg, 0.016  %res = select i1 %cond, float %a, float %b17  ret float %res18}19 20; Test f6421define double @f2(double %a, double %b, double %f) {22; CHECK-LABEL: f2:23; CHECK: ltdbr24; CHECK-NEXT: ber %r1425  %neg = fneg double %f26  %cond = fcmp oeq double %neg, 0.027  %res = select i1 %cond, double %a, double %b28  ret double %res29}30 31; Negation of floating-point absolute.32; Test f3233declare float @llvm.fabs.f32(float %f)34define float @f3(float %a, float %b, float %f) {35; CHECK-LABEL: f3:36; CHECK: lpebr37; CHECK-NEXT: ber %r1438  %abs = call float @llvm.fabs.f32(float %f)39  %neg = fneg float %abs40  %cond = fcmp oeq float %neg, 0.041  %res = select i1 %cond, float %a, float %b42  ret float %res43}44 45; Test f6446declare double @llvm.fabs.f64(double %f)47define double @f4(double %a, double %b, double %f) {48; CHECK-LABEL: f4:49; CHECK: lpdbr50; CHECK-NEXT: ber %r1451  %abs = call double @llvm.fabs.f64(double %f)52  %neg = fneg double %abs53  %cond = fcmp oeq double %neg, 0.054  %res = select i1 %cond, double %a, double %b55  ret double %res56}57 58; Absolute floating-point value.59; Test f3260define float @f5(float %a, float %b, float %f) {61; CHECK-LABEL: f5:62; CHECK: lpebr63; CHECK-NEXT: ber %r1464  %abs = call float @llvm.fabs.f32(float %f)65  %cond = fcmp oeq float %abs, 0.066  %res = select i1 %cond, float %a, float %b67  ret float %res68}69 70; Test f6471define double @f6(double %a, double %b, double %f) {72; CHECK-LABEL: f6:73; CHECK: lpdbr74; CHECK-NEXT: ber %r1475  %abs = call double @llvm.fabs.f64(double %f)76  %cond = fcmp oeq double %abs, 0.077  %res = select i1 %cond, double %a, double %b78  ret double %res79}80 81