55 lines · plain
1; RUN: opt -S -dxil-intrinsic-expansion -scalarizer -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s2 3; Make sure dxil op function calls for degrees are expanded and lowered as fmul for float and half.4 5define noundef half @degrees_half(half noundef %a) {6; CHECK-LABEL: define noundef half @degrees_half(7; CHECK-SAME: half noundef [[A:%.*]]) {8; CHECK-NEXT: [[ENTRY:.*:]]9; CHECK-NEXT: [[DX_DEGREES1:%.*]] = fmul half [[A]], 0xH532910; CHECK-NEXT: ret half [[DX_DEGREES1]]11;12entry:13 %dx.degrees = call half @llvm.dx.degrees.f16(half %a)14 ret half %dx.degrees15}16 17define noundef float @degrees_float(float noundef %a) #0 {18; CHECK-LABEL: define noundef float @degrees_float(19; CHECK-SAME: float noundef [[A:%.*]]) {20; CHECK-NEXT: entry:21; CHECK-NEXT: [[DEGREES:%.*]] = fmul float [[A]], 0x404CA5DC2000000022; CHECK-NEXT: ret float [[DEGREES]]23;24entry:25 %dx.degrees = call float @llvm.dx.degrees.f32(float %a)26 ret float %dx.degrees27}28 29define noundef <4 x float> @degrees_float4(<4 x float> noundef %a) #0 {30; CHECK-LABEL: define noundef <4 x float> @degrees_float4(31; CHECK-SAME: <4 x float> noundef [[A:%.*]]) {32; CHECK-NEXT: entry:33; CHECK-NEXT: [[A0:%.*]] = extractelement <4 x float> [[A]], i64 034; CHECK-NEXT: [[DEGREES_A0:%.*]] = fmul float [[A0]], 0x404CA5DC2000000035; CHECK-NEXT: [[A1:%.*]] = extractelement <4 x float> [[A]], i64 136; CHECK-NEXT: [[DEGREES_A1:%.*]] = fmul float [[A1]], 0x404CA5DC2000000037; CHECK-NEXT: [[A2:%.*]] = extractelement <4 x float> [[A]], i64 238; CHECK-NEXT: [[DEGREES_A2:%.*]] = fmul float [[A2]], 0x404CA5DC2000000039; CHECK-NEXT: [[A3:%.*]] = extractelement <4 x float> [[A]], i64 340; CHECK-NEXT: [[DEGREES_A3:%.*]] = fmul float [[A3]], 0x404CA5DC2000000041; CHECK-NEXT: [[INSERT_0:%.*]] = insertelement <4 x float> poison, float [[DEGREES_A0]], i64 042; CHECK-NEXT: [[INSERT_1:%.*]] = insertelement <4 x float> [[INSERT_0]], float [[DEGREES_A1]], i64 143; CHECK-NEXT: [[INSERT_2:%.*]] = insertelement <4 x float> [[INSERT_1]], float [[DEGREES_A2]], i64 244; CHECK-NEXT: [[RES:%.*]] = insertelement <4 x float> [[INSERT_2]], float [[DEGREES_A3]], i64 345; CHECK-NEXT: ret <4 x float> [[RES]]46;47entry:48 %2 = call <4 x float> @llvm.dx.degrees.v4f32(<4 x float> %a)49 ret <4 x float> %250}51 52declare half @llvm.dx.degrees.f16(half)53declare float @llvm.dx.degrees.f32(float)54declare <4 x float> @llvm.dx.degrees.v4f32(<4 x float>)55