1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/test/Transforms/InstCombine/cos-intrinsic.ll
Sanjoy Das 224e72eaad Propagate Undef in llvm.cos Intrinsic
Summary:
The llvm cos intrinsic currently does not propagate undef's. This change
transforms cos(undef) to null value or 0.

There are 2 test cases added as well.

Patch by Anna Thomas!

Reviewers: sanjoy

Subscribers: majnemer, llvm-commits

Differential Revision: http://reviews.llvm.org/D18863

llvm-svn: 265825
2016-04-08 18:21:11 +00:00

27 lines
790 B
LLVM

; 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)
; 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
}
; 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
}