44 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 round are generated for float and half.4 5; CHECK-LABEL: round_half6define 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.roundeven11}12 13; CHECK-LABEL: round_float14define 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.roundeven19}20 21define noundef <4 x float> @round_float4(<4 x float> noundef %a) #0 {22entry:23 ; CHECK: [[ee0:%.*]] = extractelement <4 x float> %a, i64 024 ; CHECK: [[ie0:%.*]] = call float @dx.op.unary.f32(i32 26, float [[ee0]]) #[[#ATTR]]25 ; CHECK: [[ee1:%.*]] = extractelement <4 x float> %a, i64 126 ; CHECK: [[ie1:%.*]] = call float @dx.op.unary.f32(i32 26, float [[ee1]]) #[[#ATTR]]27 ; CHECK: [[ee2:%.*]] = extractelement <4 x float> %a, i64 228 ; CHECK: [[ie2:%.*]] = call float @dx.op.unary.f32(i32 26, float [[ee2]]) #[[#ATTR]]29 ; CHECK: [[ee3:%.*]] = extractelement <4 x float> %a, i64 330 ; CHECK: [[ie3:%.*]] = call float @dx.op.unary.f32(i32 26, float [[ee3]]) #[[#ATTR]]31 ; CHECK: insertelement <4 x float> poison, float [[ie0]], i64 032 ; CHECK: insertelement <4 x float> %{{.*}}, float [[ie1]], i64 133 ; CHECK: insertelement <4 x float> %{{.*}}, float [[ie2]], i64 234 ; CHECK: insertelement <4 x float> %{{.*}}, float [[ie3]], i64 335 %2 = call <4 x float> @llvm.roundeven.v4f32(<4 x float> %a) 36 ret <4 x float> %237}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