blob: b4d07cf8047b8a352c5cf47d2695fc02d08bd71c [file] [log] [blame]
Sanjoy Das87b9e1b2016-04-08 18:21:11 +00001; 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}