xref: /aosp_15_r20/external/llvm/test/Transforms/InstCombine/cos-intrinsic.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -instcombine -S | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; This test makes sure that the undef is propagated for the cos instrinsic
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Workerdeclare double    @llvm.cos.f64(double %Val)
5*9880d681SAndroid Build Coastguard Workerdeclare float     @llvm.cos.f32(float %Val)
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
8*9880d681SAndroid Build Coastguard Workerdefine double @test1() {
9*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: define double @test1(
10*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret double 0.000000e+00
11*9880d681SAndroid Build Coastguard Worker  %1 = call double @llvm.cos.f64(double undef)
12*9880d681SAndroid Build Coastguard Worker  ret double %1
13*9880d681SAndroid Build Coastguard Worker}
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
17*9880d681SAndroid Build Coastguard Workerdefine float @test2(float %d) {
18*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: define float @test2(
19*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: %cosval = call float @llvm.cos.f32(float %d)
20*9880d681SAndroid Build Coastguard Worker   %cosval   = call float @llvm.cos.f32(float %d)
21*9880d681SAndroid Build Coastguard Worker   %cosval2  = call float @llvm.cos.f32(float undef)
22*9880d681SAndroid Build Coastguard Worker   %fsum   = fadd float %cosval2, %cosval
23*9880d681SAndroid Build Coastguard Worker   ret float %fsum
24*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: %fsum
25*9880d681SAndroid Build Coastguard Worker; CHECK: ret float %fsum
26*9880d681SAndroid Build Coastguard Worker}
27