1c05e29bfSFarzon Lotfi; RUN: opt -S -scalarizer -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s 279c32eb0SFarzon Lotfi 379c32eb0SFarzon Lotfi; Make sure dxil operation function calls for cos are generated for float and half. 479c32eb0SFarzon Lotfi 579c32eb0SFarzon Lotfidefine noundef float @cos_float(float noundef %a) #0 { 679c32eb0SFarzon Lotfientry: 7*011b6186SFinn Plummer; CHECK:call float @dx.op.unary.f32(i32 12, float %{{.*}}) #[[#ATTR:]] 879c32eb0SFarzon Lotfi %elt.cos = call float @llvm.cos.f32(float %a) 979c32eb0SFarzon Lotfi ret float %elt.cos 1079c32eb0SFarzon Lotfi} 1179c32eb0SFarzon Lotfi 1279c32eb0SFarzon Lotfidefine noundef half @cos_half(half noundef %a) #0 { 1379c32eb0SFarzon Lotfientry: 14*011b6186SFinn Plummer; CHECK:call half @dx.op.unary.f16(i32 12, half %{{.*}}) #[[#ATTR]] 1579c32eb0SFarzon Lotfi %elt.cos = call half @llvm.cos.f16(half %a) 1679c32eb0SFarzon Lotfi ret half %elt.cos 1779c32eb0SFarzon Lotfi} 1879c32eb0SFarzon Lotfi 19c05e29bfSFarzon Lotfidefine noundef <4 x float> @cos_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 12, 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 12, 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 12, 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 12, 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.cos.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 3979c32eb0SFarzon Lotfideclare half @llvm.cos.f16(half) 4079c32eb0SFarzon Lotfideclare float @llvm.cos.f32(float) 41c05e29bfSFarzon Lotfideclare <4 x float> @llvm.cos.v4f32(<4 x float>) 42