1319c7a42SGreg Roth; RUN: opt -S -dxil-intrinsic-expansion -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s --check-prefixes=CHECK,EXPCHECK 27d0ca601SFarzon Lotfi; RUN: opt -S -dxil-intrinsic-expansion -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s --check-prefixes=CHECK,DOPCHECK 3060df78cSFarzon Lotfi 4319c7a42SGreg Roth; Make sure dxil operation function calls for dot are generated for float type vectors. 5060df78cSFarzon Lotfi 6060df78cSFarzon Lotfi; CHECK-LABEL: dot_half2 7060df78cSFarzon Lotfidefine noundef half @dot_half2(<2 x half> noundef %a, <2 x half> noundef %b) { 8060df78cSFarzon Lotfientry: 9319c7a42SGreg Roth; DOPCHECK: extractelement <2 x half> %a, i32 0 10319c7a42SGreg Roth; DOPCHECK: extractelement <2 x half> %a, i32 1 11319c7a42SGreg Roth; DOPCHECK: extractelement <2 x half> %b, i32 0 12319c7a42SGreg Roth; DOPCHECK: extractelement <2 x half> %b, i32 1 13*011b6186SFinn Plummer; DOPCHECK: call half @dx.op.dot2.f16(i32 54, half %{{.*}}, half %{{.*}}, half %{{.*}}, half %{{.*}}) #[[#ATTR:]] 14319c7a42SGreg Roth; EXPCHECK: call half @llvm.dx.dot2.v2f16(<2 x half> %a, <2 x half> %b) 15319c7a42SGreg Roth %dx.dot = call half @llvm.dx.fdot.v2f16(<2 x half> %a, <2 x half> %b) 16060df78cSFarzon Lotfi ret half %dx.dot 17060df78cSFarzon Lotfi} 18060df78cSFarzon Lotfi 19060df78cSFarzon Lotfi; CHECK-LABEL: dot_half3 20060df78cSFarzon Lotfidefine noundef half @dot_half3(<3 x half> noundef %a, <3 x half> noundef %b) { 21060df78cSFarzon Lotfientry: 22319c7a42SGreg Roth; DOPCHECK: extractelement <3 x half> %a, i32 0 23319c7a42SGreg Roth; DOPCHECK: extractelement <3 x half> %a, i32 1 24319c7a42SGreg Roth; DOPCHECK: extractelement <3 x half> %a, i32 2 25319c7a42SGreg Roth; DOPCHECK: extractelement <3 x half> %b, i32 0 26319c7a42SGreg Roth; DOPCHECK: extractelement <3 x half> %b, i32 1 27319c7a42SGreg Roth; DOPCHECK: extractelement <3 x half> %b, i32 2 28*011b6186SFinn Plummer; DOPCHECK: call half @dx.op.dot3.f16(i32 55, half %{{.*}}, half %{{.*}}, half %{{.*}}, half %{{.*}}, half %{{.*}}, half %{{.*}}) #[[#ATTR]] 29319c7a42SGreg Roth; EXPCHECK: call half @llvm.dx.dot3.v3f16(<3 x half> %a, <3 x half> %b) 30319c7a42SGreg Roth %dx.dot = call half @llvm.dx.fdot.v3f16(<3 x half> %a, <3 x half> %b) 31060df78cSFarzon Lotfi ret half %dx.dot 32060df78cSFarzon Lotfi} 33060df78cSFarzon Lotfi 34060df78cSFarzon Lotfi; CHECK-LABEL: dot_half4 35060df78cSFarzon Lotfidefine noundef half @dot_half4(<4 x half> noundef %a, <4 x half> noundef %b) { 36060df78cSFarzon Lotfientry: 37319c7a42SGreg Roth; DOPCHECK: extractelement <4 x half> %a, i32 0 38319c7a42SGreg Roth; DOPCHECK: extractelement <4 x half> %a, i32 1 39319c7a42SGreg Roth; DOPCHECK: extractelement <4 x half> %a, i32 2 40319c7a42SGreg Roth; DOPCHECK: extractelement <4 x half> %a, i32 3 41319c7a42SGreg Roth; DOPCHECK: extractelement <4 x half> %b, i32 0 42319c7a42SGreg Roth; DOPCHECK: extractelement <4 x half> %b, i32 1 43319c7a42SGreg Roth; DOPCHECK: extractelement <4 x half> %b, i32 2 44319c7a42SGreg Roth; DOPCHECK: extractelement <4 x half> %b, i32 3 45*011b6186SFinn Plummer; DOPCHECK: call half @dx.op.dot4.f16(i32 56, half %{{.*}}, half %{{.*}}, half %{{.*}}, half %{{.*}}, half %{{.*}}, half %{{.*}}, half %{{.*}}, half %{{.*}}) #[[#ATTR]] 46319c7a42SGreg Roth; EXPCHECK: call half @llvm.dx.dot4.v4f16(<4 x half> %a, <4 x half> %b) 47319c7a42SGreg Roth %dx.dot = call half @llvm.dx.fdot.v4f16(<4 x half> %a, <4 x half> %b) 48060df78cSFarzon Lotfi ret half %dx.dot 49060df78cSFarzon Lotfi} 50060df78cSFarzon Lotfi 51060df78cSFarzon Lotfi; CHECK-LABEL: dot_float2 52060df78cSFarzon Lotfidefine noundef float @dot_float2(<2 x float> noundef %a, <2 x float> noundef %b) { 53060df78cSFarzon Lotfientry: 54319c7a42SGreg Roth; DOPCHECK: extractelement <2 x float> %a, i32 0 55319c7a42SGreg Roth; DOPCHECK: extractelement <2 x float> %a, i32 1 56319c7a42SGreg Roth; DOPCHECK: extractelement <2 x float> %b, i32 0 57319c7a42SGreg Roth; DOPCHECK: extractelement <2 x float> %b, i32 1 58*011b6186SFinn Plummer; DOPCHECK: call float @dx.op.dot2.f32(i32 54, float %{{.*}}, float %{{.*}}, float %{{.*}}, float %{{.*}}) #[[#ATTR]] 59319c7a42SGreg Roth; EXPCHECK: call float @llvm.dx.dot2.v2f32(<2 x float> %a, <2 x float> %b) 60319c7a42SGreg Roth %dx.dot = call float @llvm.dx.fdot.v2f32(<2 x float> %a, <2 x float> %b) 61060df78cSFarzon Lotfi ret float %dx.dot 62060df78cSFarzon Lotfi} 63060df78cSFarzon Lotfi 64060df78cSFarzon Lotfi; CHECK-LABEL: dot_float3 65060df78cSFarzon Lotfidefine noundef float @dot_float3(<3 x float> noundef %a, <3 x float> noundef %b) { 66060df78cSFarzon Lotfientry: 67319c7a42SGreg Roth; DOPCHECK: extractelement <3 x float> %a, i32 0 68319c7a42SGreg Roth; DOPCHECK: extractelement <3 x float> %a, i32 1 69319c7a42SGreg Roth; DOPCHECK: extractelement <3 x float> %a, i32 2 70319c7a42SGreg Roth; DOPCHECK: extractelement <3 x float> %b, i32 0 71319c7a42SGreg Roth; DOPCHECK: extractelement <3 x float> %b, i32 1 72319c7a42SGreg Roth; DOPCHECK: extractelement <3 x float> %b, i32 2 73*011b6186SFinn Plummer; DOPCHECK: call float @dx.op.dot3.f32(i32 55, float %{{.*}}, float %{{.*}}, float %{{.*}}, float %{{.*}}, float %{{.*}}, float %{{.*}}) #[[#ATTR]] 74319c7a42SGreg Roth; EXPCHECK: call float @llvm.dx.dot3.v3f32(<3 x float> %a, <3 x float> %b) 75319c7a42SGreg Roth %dx.dot = call float @llvm.dx.fdot.v3f32(<3 x float> %a, <3 x float> %b) 76060df78cSFarzon Lotfi ret float %dx.dot 77060df78cSFarzon Lotfi} 78060df78cSFarzon Lotfi 79060df78cSFarzon Lotfi; CHECK-LABEL: dot_float4 80060df78cSFarzon Lotfidefine noundef float @dot_float4(<4 x float> noundef %a, <4 x float> noundef %b) { 81060df78cSFarzon Lotfientry: 82319c7a42SGreg Roth; DOPCHECK: extractelement <4 x float> %a, i32 0 83319c7a42SGreg Roth; DOPCHECK: extractelement <4 x float> %a, i32 1 84319c7a42SGreg Roth; DOPCHECK: extractelement <4 x float> %a, i32 2 85319c7a42SGreg Roth; DOPCHECK: extractelement <4 x float> %a, i32 3 86319c7a42SGreg Roth; DOPCHECK: extractelement <4 x float> %b, i32 0 87319c7a42SGreg Roth; DOPCHECK: extractelement <4 x float> %b, i32 1 88319c7a42SGreg Roth; DOPCHECK: extractelement <4 x float> %b, i32 2 89319c7a42SGreg Roth; DOPCHECK: extractelement <4 x float> %b, i32 3 90*011b6186SFinn Plummer; DOPCHECK: call float @dx.op.dot4.f32(i32 56, float %{{.*}}, float %{{.*}}, float %{{.*}}, float %{{.*}}, float %{{.*}}, float %{{.*}}, float %{{.*}}, float %{{.*}}) #[[#ATTR]] 91319c7a42SGreg Roth; EXPCHECK: call float @llvm.dx.dot4.v4f32(<4 x float> %a, <4 x float> %b) 92319c7a42SGreg Roth %dx.dot = call float @llvm.dx.fdot.v4f32(<4 x float> %a, <4 x float> %b) 93060df78cSFarzon Lotfi ret float %dx.dot 94060df78cSFarzon Lotfi} 95060df78cSFarzon Lotfi 96*011b6186SFinn Plummer; DOPCHECK: attributes #[[#ATTR]] = {{{.*}} memory(none) {{.*}}} 97*011b6186SFinn Plummer 98319c7a42SGreg Rothdeclare half @llvm.dx.fdot.v2f16(<2 x half> , <2 x half> ) 99319c7a42SGreg Rothdeclare half @llvm.dx.fdot.v3f16(<3 x half> , <3 x half> ) 100319c7a42SGreg Rothdeclare half @llvm.dx.fdot.v4f16(<4 x half> , <4 x half> ) 101319c7a42SGreg Rothdeclare float @llvm.dx.fdot.v2f32(<2 x float>, <2 x float>) 102319c7a42SGreg Rothdeclare float @llvm.dx.fdot.v3f32(<3 x float>, <3 x float>) 103319c7a42SGreg Rothdeclare float @llvm.dx.fdot.v4f32(<4 x float>, <4 x float>) 104