xref: /llvm-project/llvm/test/CodeGen/DirectX/cosh.ll (revision 011b618644113996e2c0a8e57db40f89d20878e3)
1c05e29bfSFarzon Lotfi; RUN: opt -S -scalarizer -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
2936bc9bbSFarzon Lotfi
3936bc9bbSFarzon Lotfi; Make sure dxil operation function calls for cosh are generated for float and half.
4936bc9bbSFarzon Lotfi
5c05e29bfSFarzon Lotfidefine noundef float @cosh_float(float noundef %a) {
6936bc9bbSFarzon Lotfientry:
7*011b6186SFinn Plummer; CHECK:call float @dx.op.unary.f32(i32 18, float %{{.*}}) #[[#ATTR:]]
8936bc9bbSFarzon Lotfi  %elt.cosh = call float @llvm.cosh.f32(float %a)
9936bc9bbSFarzon Lotfi  ret float %elt.cosh
10936bc9bbSFarzon Lotfi}
11936bc9bbSFarzon Lotfi
12c05e29bfSFarzon Lotfidefine noundef half @cosh_half(half noundef %a) {
13936bc9bbSFarzon Lotfientry:
14*011b6186SFinn Plummer; CHECK:call half @dx.op.unary.f16(i32 18, half %{{.*}}) #[[#ATTR]]
15936bc9bbSFarzon Lotfi  %elt.cosh = call half @llvm.cosh.f16(half %a)
16936bc9bbSFarzon Lotfi  ret half %elt.cosh
17936bc9bbSFarzon Lotfi}
18936bc9bbSFarzon Lotfi
19c05e29bfSFarzon Lotfidefine noundef <4 x float> @cosh_float4(<4 x float> noundef %a) #0 {
20c05e29bfSFarzon Lotfientry:
21c05e29bfSFarzon Lotfi  ; CHECK: [[ee0:%.*]] = extractelement <4 x float> %a, i64 0
22*011b6186SFinn Plummer  ; CHECK: [[ie0:%.*]] = call float @dx.op.unary.f32(i32 18, float [[ee0]]) #[[#ATTR]]
23c05e29bfSFarzon Lotfi  ; CHECK: [[ee1:%.*]] = extractelement <4 x float> %a, i64 1
24*011b6186SFinn Plummer  ; CHECK: [[ie1:%.*]] = call float @dx.op.unary.f32(i32 18, float [[ee1]]) #[[#ATTR]]
25c05e29bfSFarzon Lotfi  ; CHECK: [[ee2:%.*]] = extractelement <4 x float> %a, i64 2
26*011b6186SFinn Plummer  ; CHECK: [[ie2:%.*]] = call float @dx.op.unary.f32(i32 18, float [[ee2]]) #[[#ATTR]]
27c05e29bfSFarzon Lotfi  ; CHECK: [[ee3:%.*]] = extractelement <4 x float> %a, i64 3
28*011b6186SFinn Plummer  ; CHECK: [[ie3:%.*]] = call float @dx.op.unary.f32(i32 18, float [[ee3]]) #[[#ATTR]]
29c05e29bfSFarzon Lotfi  ; CHECK: insertelement <4 x float> poison, float [[ie0]], i64 0
30c05e29bfSFarzon Lotfi  ; CHECK: insertelement <4 x float> %{{.*}}, float [[ie1]], i64 1
31c05e29bfSFarzon Lotfi  ; CHECK: insertelement <4 x float> %{{.*}}, float [[ie2]], i64 2
32c05e29bfSFarzon Lotfi  ; CHECK: insertelement <4 x float> %{{.*}}, float [[ie3]], i64 3
33c05e29bfSFarzon Lotfi  %2 = call <4 x float> @llvm.cosh.v4f32(<4 x float> %a)
34c05e29bfSFarzon Lotfi  ret <4 x float> %2
35c05e29bfSFarzon Lotfi}
36c05e29bfSFarzon Lotfi
37*011b6186SFinn Plummer; CHECK: attributes #[[#ATTR]] = {{{.*}} memory(none) {{.*}}}
38*011b6186SFinn Plummer
39936bc9bbSFarzon Lotfideclare half @llvm.cosh.f16(half)
40936bc9bbSFarzon Lotfideclare float @llvm.cosh.f32(float)
41c05e29bfSFarzon Lotfideclare <4 x float> @llvm.cosh.v4f32(<4 x float>)
42