diff options
author | Owen Anderson <resistor@mac.com> | 2013-10-03 21:08:05 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2013-10-03 21:08:05 +0000 |
commit | 03e84c9df91cbc1fe0219a51109e260cacdfd2b7 (patch) | |
tree | 08559633fe45071ebaa3d690c2afb195c24ff347 /test/Transforms | |
parent | e5830c4e2603ab36f08911ff6bb117638ae529c7 (diff) | |
download | external_llvm-03e84c9df91cbc1fe0219a51109e260cacdfd2b7.zip external_llvm-03e84c9df91cbc1fe0219a51109e260cacdfd2b7.tar.gz external_llvm-03e84c9df91cbc1fe0219a51109e260cacdfd2b7.tar.bz2 |
Pull fptrunc's upwards through selects when one of the select's selectands was a constant. This has a number of benefits, including producing small immediates (easier to materialize, smaller constant pools) as well as being more likely to allow the fptrunc to fuse with a preceding instruction (truncating selects are unusual).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191929 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/InstCombine/fpcast.ll | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/fpcast.ll b/test/Transforms/InstCombine/fpcast.ll index 09f0532..05d1b48 100644 --- a/test/Transforms/InstCombine/fpcast.ll +++ b/test/Transforms/InstCombine/fpcast.ll @@ -31,4 +31,16 @@ define half @test4(float %a) { ret half %c } +; CHECK: test5 +define half @test5(float %a, float %b, float %c) { +; CHECK: fcmp ogt +; CHECK: fptrunc +; CHECK: select +; CHECK: half 0xH3C00 + %d = fcmp ogt float %a, %b + %e = select i1 %d, float %c, float 1.0 + %f = fptrunc float %e to half + ret half %f +} + declare float @llvm.fabs.f32(float) nounwind readonly |