41 lines · plain
1; RUN: opt -S -scalarizer -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s2 3; Make sure dxil operation function calls for ddy_coarse are generated for half/float and matching vectors4 5define noundef half @deriv_coarse_y_half(half noundef %a) {6; CHECK: call half @dx.op.unary.f16(i32 84, half %{{.*}})7entry:8 %dx.ddy.coarse = call half @llvm.dx.ddy.coarse.f16(half %a)9 ret half %dx.ddy.coarse10}11 12define noundef float @deriv_coarse_y_float(float noundef %a) {13; CHECK: call float @dx.op.unary.f32(i32 84, float %{{.*}})14entry:15 %dx.ddy.coarse = call float @llvm.dx.ddy.coarse.f32(float %a)16 ret float %dx.ddy.coarse17}18 19define noundef <4 x float> @deriv_coarse_y_float4(<4 x float> noundef %a) {20; CHECK: [[ee0:%.*]] = extractelement <4 x float> %a, i64 021; CHECK: [[ie0:%.*]] = call float @dx.op.unary.f32(i32 84, float [[ee0]])22; CHECK: [[ee1:%.*]] = extractelement <4 x float> %a, i64 123; CHECK: [[ie1:%.*]] = call float @dx.op.unary.f32(i32 84, float [[ee1]])24; CHECK: [[ee2:%.*]] = extractelement <4 x float> %a, i64 225; CHECK: [[ie2:%.*]] = call float @dx.op.unary.f32(i32 84, float [[ee2]])26; CHECK: [[ee3:%.*]] = extractelement <4 x float> %a, i64 327; CHECK: [[ie3:%.*]] = call float @dx.op.unary.f32(i32 84, float [[ee3]])28; CHECK: insertelement <4 x float> poison, float [[ie0]], i64 029; CHECK: insertelement <4 x float> %{{.*}}, float [[ie1]], i64 130; CHECK: insertelement <4 x float> %{{.*}}, float [[ie2]], i64 231; CHECK: insertelement <4 x float> %{{.*}}, float [[ie3]], i64 332; CHECK: ret <4 x float> %{{.*}}33entry:34 %dx.ddy.coarse = call <4 x float> @llvm.dx.ddy.coarse.v4f32(<4 x float> %a)35 ret <4 x float> %dx.ddy.coarse36}37 38declare half @llvm.dx.ddy.coarse.f16(half)39declare float @llvm.dx.ddy.coarse.f32(float)40declare <4 x float> @llvm.dx.ddy.coarse.v4f32(<4 x float>)41