From: Sanjay Patel Date: Tue, 20 Feb 2018 23:08:47 +0000 (+0000) Subject: [InstCombine] auto-generate full checks; NFC X-Git-Tag: llvmorg-7.0.0-rc1~12392 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f65e0d00822bdcbd0a5c0f0dd6c808b3e2c80db;p=platform%2Fupstream%2Fllvm.git [InstCombine] auto-generate full checks; NFC llvm-svn: 325639 --- diff --git a/llvm/test/Transforms/InstCombine/cos-intrinsic.ll b/llvm/test/Transforms/InstCombine/cos-intrinsic.ll index 24b605e..7bd6283 100644 --- a/llvm/test/Transforms/InstCombine/cos-intrinsic.ll +++ b/llvm/test/Transforms/InstCombine/cos-intrinsic.ll @@ -1,5 +1,5 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -instcombine -S | FileCheck %s -; This test makes sure that the undef is propagated for the cos instrinsic declare double @llvm.cos.f64(double %Val) declare float @llvm.cos.f32(float %Val) @@ -8,74 +8,80 @@ declare <2 x float> @llvm.cos.v2f32(<2 x float> %Val) declare float @llvm.fabs.f32(float %Val) declare <2 x float> @llvm.fabs.v2f32(<2 x float> %Val) -; Function Attrs: nounwind readnone -define double @test1() { -; CHECK-LABEL: define double @test1( -; CHECK-NEXT: ret double 0.000000e+00 - %1 = call double @llvm.cos.f64(double undef) - ret double %1 +define double @undef_arg() { +; CHECK-LABEL: @undef_arg( +; CHECK-NEXT: ret double 0.000000e+00 +; + %r = call double @llvm.cos.f64(double undef) + ret double %r } - -; Function Attrs: nounwind readnone -define float @test2(float %d) { -; CHECK-LABEL: define float @test2( -; CHECK-NEXT: %cosval = call float @llvm.cos.f32(float %d) - %cosval = call float @llvm.cos.f32(float %d) - %cosval2 = call float @llvm.cos.f32(float undef) - %fsum = fadd float %cosval2, %cosval - ret float %fsum -; CHECK-NEXT: %fsum -; CHECK: ret float %fsum +define float @undef_arg2(float %d) { +; CHECK-LABEL: @undef_arg2( +; CHECK-NEXT: [[COSVAL:%.*]] = call float @llvm.cos.f32(float [[D:%.*]]) +; CHECK-NEXT: [[FSUM:%.*]] = fadd float [[COSVAL]], 0.000000e+00 +; CHECK-NEXT: ret float [[FSUM]] +; + %cosval = call float @llvm.cos.f32(float %d) + %cosval2 = call float @llvm.cos.f32(float undef) + %fsum = fadd float %cosval2, %cosval + ret float %fsum } -; CHECK-LABEL: @cos_fneg_f32( -; CHECK: %cos = call float @llvm.cos.f32(float %x) -; CHECK-NEXT: ret float %cos -define float @cos_fneg_f32(float %x) { +define float @fneg_f32(float %x) { +; CHECK-LABEL: @fneg_f32( +; CHECK-NEXT: [[COS:%.*]] = call float @llvm.cos.f32(float [[X:%.*]]) +; CHECK-NEXT: ret float [[COS]] +; %x.fneg = fsub float -0.0, %x %cos = call float @llvm.cos.f32(float %x.fneg) ret float %cos } ; FIXME: m_FNeg() doesn't handle vectors -; CHECK-LABEL: @cos_fneg_v2f32( -; CHECK: %x.fneg = fsub <2 x float> , %x -; CHECK-NEXT: %cos = call <2 x float> @llvm.cos.v2f32(<2 x float> %x.fneg) -; CHECK-NEXT: ret <2 x float> %cos -define <2 x float> @cos_fneg_v2f32(<2 x float> %x) { + +define <2 x float> @fneg_v2f32(<2 x float> %x) { +; CHECK-LABEL: @fneg_v2f32( +; CHECK-NEXT: [[X_FNEG:%.*]] = fsub <2 x float> , [[X:%.*]] +; CHECK-NEXT: [[COS:%.*]] = call <2 x float> @llvm.cos.v2f32(<2 x float> [[X_FNEG]]) +; CHECK-NEXT: ret <2 x float> [[COS]] +; %x.fneg = fsub <2 x float> , %x %cos = call <2 x float> @llvm.cos.v2f32(<2 x float> %x.fneg) ret <2 x float> %cos } -; CHECK-LABEL: @cos_fabs_f32( -; CHECK-NEXT: %cos = call float @llvm.cos.f32(float %x) -; CHECK-NEXT: ret float %cos -define float @cos_fabs_f32(float %x) { +define float @fabs_f32(float %x) { +; CHECK-LABEL: @fabs_f32( +; CHECK-NEXT: [[COS:%.*]] = call float @llvm.cos.f32(float [[X:%.*]]) +; CHECK-NEXT: ret float [[COS]] +; %x.fabs = call float @llvm.fabs.f32(float %x) %cos = call float @llvm.cos.f32(float %x.fabs) ret float %cos } -; CHECK-LABEL: @cos_fabs_fneg_f32( -; CHECK: %cos = call float @llvm.cos.f32(float %x) -; CHECK-NEXT: ret float %cos -define float @cos_fabs_fneg_f32(float %x) { +define float @fabs_fneg_f32(float %x) { +; CHECK-LABEL: @fabs_fneg_f32( +; CHECK-NEXT: [[COS:%.*]] = call float @llvm.cos.f32(float [[X:%.*]]) +; CHECK-NEXT: ret float [[COS]] +; %x.fabs = call float @llvm.fabs.f32(float %x) %x.fabs.fneg = fsub float -0.0, %x.fabs %cos = call float @llvm.cos.f32(float %x.fabs.fneg) ret float %cos } -; CHECK-LABEL: @cos_fabs_fneg_v2f32( -; CHECK: %x.fabs = call <2 x float> @llvm.fabs.v2f32(<2 x float> %x) -; CHECK-NEXT: %x.fabs.fneg = fsub <2 x float> , %x.fabs -; CHECK-NEXT: %cos = call <2 x float> @llvm.cos.v2f32(<2 x float> %x.fabs.fneg) -; CHECK-NEXT: ret <2 x float> %cos -define <2 x float> @cos_fabs_fneg_v2f32(<2 x float> %x) { +define <2 x float> @fabs_fneg_v2f32(<2 x float> %x) { +; CHECK-LABEL: @fabs_fneg_v2f32( +; CHECK-NEXT: [[X_FABS:%.*]] = call <2 x float> @llvm.fabs.v2f32(<2 x float> [[X:%.*]]) +; CHECK-NEXT: [[X_FABS_FNEG:%.*]] = fsub <2 x float> , [[X_FABS]] +; CHECK-NEXT: [[COS:%.*]] = call <2 x float> @llvm.cos.v2f32(<2 x float> [[X_FABS_FNEG]]) +; CHECK-NEXT: ret <2 x float> [[COS]] +; %x.fabs = call <2 x float> @llvm.fabs.v2f32(<2 x float> %x) %x.fabs.fneg = fsub <2 x float> , %x.fabs %cos = call <2 x float> @llvm.cos.v2f32(<2 x float> %x.fabs.fneg) ret <2 x float> %cos } +