xref: /llvm-project/llvm/test/Transforms/InstCombine/AMDGPU/tan.ll (revision acdc419c897f8a9414c7a00c8908ac32312afee2)
1; RUN: opt -mtriple=amdgcn--amdpal -S -passes=instcombine <%s | FileCheck --check-prefixes=GCN %s
2
3; Check that sin/cos is not folded to tan on amdgcn.
4
5; GCN-LABEL: define amdgpu_ps float @llpc.shader.FS.main
6; GCN: call float @llvm.sin.f32
7; GCN: call float @llvm.cos.f32
8
9declare float @llvm.sin.f32(float) #0
10declare float @llvm.cos.f32(float) #0
11
12define amdgpu_ps float @llpc.shader.FS.main(float %arg) {
13.entry:
14  %tmp32 = call float @llvm.sin.f32(float %arg)
15  %tmp33 = call float @llvm.cos.f32(float %arg)
16  %tmp34 = fdiv reassoc nnan nsz arcp contract float 1.000000e+00, %tmp33
17  %tmp35 = fmul reassoc nnan nsz arcp contract float %tmp32, %tmp34
18  ret float %tmp35
19}
20
21attributes #0 = { nounwind readnone speculatable willreturn }
22