1; RUN: opt < %s -instcombine -S | FileCheck %s
2; This test makes sure that the undef is propagated for the cos instrinsic
3
4declare double    @llvm.cos.f64(double %Val)
5declare float     @llvm.cos.f32(float %Val)
6
7; Function Attrs: nounwind readnone
8define 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
17define 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}
27