Sanjoy Das | 87b9e1b | 2016-04-08 18:21:11 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -instcombine -S | FileCheck %s |
| 2 | ; This test makes sure that the undef is propagated for the cos instrinsic |
| 3 | |
| 4 | declare double @llvm.cos.f64(double %Val) |
| 5 | declare float @llvm.cos.f32(float %Val) |
| 6 | |
| 7 | ; Function Attrs: nounwind readnone |
| 8 | define double @test1() { |
| 9 | ; CHECK-LABEL: define double @test1( |
| 10 | ; CHECK-NEXT: ret double 0.000000e+00 |
| 11 | %1 = call double @llvm.cos.f64(double undef) |
| 12 | ret double %1 |
| 13 | } |
| 14 | |
| 15 | |
| 16 | ; Function Attrs: nounwind readnone |
| 17 | define float @test2(float %d) { |
| 18 | ; CHECK-LABEL: define float @test2( |
| 19 | ; CHECK-NEXT: %cosval = call float @llvm.cos.f32(float %d) |
| 20 | %cosval = call float @llvm.cos.f32(float %d) |
| 21 | %cosval2 = call float @llvm.cos.f32(float undef) |
| 22 | %fsum = fadd float %cosval2, %cosval |
| 23 | ret float %fsum |
| 24 | ; CHECK-NEXT: %fsum |
| 25 | ; CHECK: ret float %fsum |
| 26 | } |