1; RUN: opt -S -scalarizer -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s 2 3; Make sure dxil operation function calls for round are generated for float and half. 4 5; CHECK-LABEL: round_half 6define noundef half @round_half(half noundef %a) { 7entry: 8; CHECK: call half @dx.op.unary.f16(i32 26, half %{{.*}}) #[[#ATTR:]] 9 %elt.roundeven = call half @llvm.roundeven.f16(half %a) 10 ret half %elt.roundeven 11} 12 13; CHECK-LABEL: round_float 14define noundef float @round_float(float noundef %a) { 15entry: 16; CHECK: call float @dx.op.unary.f32(i32 26, float %{{.*}}) #[[#ATTR]] 17 %elt.roundeven = call float @llvm.roundeven.f32(float %a) 18 ret float %elt.roundeven 19} 20 21define noundef <4 x float> @round_float4(<4 x float> noundef %a) #0 { 22entry: 23 ; CHECK: [[ee0:%.*]] = extractelement <4 x float> %a, i64 0 24 ; CHECK: [[ie0:%.*]] = call float @dx.op.unary.f32(i32 26, float [[ee0]]) #[[#ATTR]] 25 ; CHECK: [[ee1:%.*]] = extractelement <4 x float> %a, i64 1 26 ; CHECK: [[ie1:%.*]] = call float @dx.op.unary.f32(i32 26, float [[ee1]]) #[[#ATTR]] 27 ; CHECK: [[ee2:%.*]] = extractelement <4 x float> %a, i64 2 28 ; CHECK: [[ie2:%.*]] = call float @dx.op.unary.f32(i32 26, float [[ee2]]) #[[#ATTR]] 29 ; CHECK: [[ee3:%.*]] = extractelement <4 x float> %a, i64 3 30 ; CHECK: [[ie3:%.*]] = call float @dx.op.unary.f32(i32 26, float [[ee3]]) #[[#ATTR]] 31 ; CHECK: insertelement <4 x float> poison, float [[ie0]], i64 0 32 ; CHECK: insertelement <4 x float> %{{.*}}, float [[ie1]], i64 1 33 ; CHECK: insertelement <4 x float> %{{.*}}, float [[ie2]], i64 2 34 ; CHECK: insertelement <4 x float> %{{.*}}, float [[ie3]], i64 3 35 %2 = call <4 x float> @llvm.roundeven.v4f32(<4 x float> %a) 36 ret <4 x float> %2 37} 38 39; CHECK: attributes #[[#ATTR]] = {{{.*}} memory(none) {{.*}}} 40 41declare half @llvm.roundeven.f16(half) 42declare float @llvm.roundeven.f32(float) 43declare <4 x float> @llvm.roundeven.v4f32(<4 x float>) 44