1*0e51b54bSJustin Bogner; RUN: opt -S -dxil-op-lower %s | FileCheck %s 2*0e51b54bSJustin Bogner 3*0e51b54bSJustin Bognertarget triple = "dxil-pc-shadermodel6.6-compute" 4*0e51b54bSJustin Bogner 5*0e51b54bSJustin Bogner; CHECK-LABEL: define void @storef32_struct 6*0e51b54bSJustin Bognerdefine void @storef32_struct(i32 %index, float %data) { 7*0e51b54bSJustin Bogner %buffer = call target("dx.RawBuffer", float, 1, 0, 0) 8*0e51b54bSJustin Bogner @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_f32_0_0_0( 9*0e51b54bSJustin Bogner i32 0, i32 0, i32 1, i32 0, i1 false) 10*0e51b54bSJustin Bogner 11*0e51b54bSJustin Bogner ; CHECK: call void @dx.op.rawBufferStore.f32(i32 140, %dx.types.Handle %buffer_annot, i32 %index, i32 0, float %data, float undef, float undef, float undef, i8 1, i32 4) 12*0e51b54bSJustin Bogner call void @llvm.dx.resource.store.rawbuffer.f32( 13*0e51b54bSJustin Bogner target("dx.RawBuffer", float, 1, 0, 0) %buffer, 14*0e51b54bSJustin Bogner i32 %index, i32 0, float %data) 15*0e51b54bSJustin Bogner 16*0e51b54bSJustin Bogner ret void 17*0e51b54bSJustin Bogner} 18*0e51b54bSJustin Bogner 19*0e51b54bSJustin Bogner; CHECK-LABEL: define void @storef32_byte 20*0e51b54bSJustin Bognerdefine void @storef32_byte(i32 %offset, float %data) { 21*0e51b54bSJustin Bogner %buffer = call target("dx.RawBuffer", i8, 1, 0, 0) 22*0e51b54bSJustin Bogner @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_i8_0_0_0( 23*0e51b54bSJustin Bogner i32 0, i32 0, i32 1, i32 0, i1 false) 24*0e51b54bSJustin Bogner 25*0e51b54bSJustin Bogner ; CHECK: call void @dx.op.rawBufferStore.f32(i32 140, %dx.types.Handle %buffer_annot, i32 %offset, i32 0, float %data, float undef, float undef, float undef, i8 1, i32 4) 26*0e51b54bSJustin Bogner call void @llvm.dx.resource.store.rawbuffer.f32( 27*0e51b54bSJustin Bogner target("dx.RawBuffer", i8, 1, 0, 0) %buffer, 28*0e51b54bSJustin Bogner i32 %offset, i32 0, float %data) 29*0e51b54bSJustin Bogner 30*0e51b54bSJustin Bogner ret void 31*0e51b54bSJustin Bogner} 32*0e51b54bSJustin Bogner 33*0e51b54bSJustin Bogner; CHECK-LABEL: define void @storev4f32_struct 34*0e51b54bSJustin Bognerdefine void @storev4f32_struct(i32 %index, <4 x float> %data) { 35*0e51b54bSJustin Bogner %buffer = call target("dx.RawBuffer", <4 x float>, 1, 0, 0) 36*0e51b54bSJustin Bogner @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_v4f32_0_0_0( 37*0e51b54bSJustin Bogner i32 0, i32 0, i32 1, i32 0, i1 false) 38*0e51b54bSJustin Bogner 39*0e51b54bSJustin Bogner ; CHECK: [[DATA0:%.*]] = extractelement <4 x float> %data, i32 0 40*0e51b54bSJustin Bogner ; CHECK: [[DATA1:%.*]] = extractelement <4 x float> %data, i32 1 41*0e51b54bSJustin Bogner ; CHECK: [[DATA2:%.*]] = extractelement <4 x float> %data, i32 2 42*0e51b54bSJustin Bogner ; CHECK: [[DATA3:%.*]] = extractelement <4 x float> %data, i32 3 43*0e51b54bSJustin Bogner ; CHECK: call void @dx.op.rawBufferStore.f32(i32 140, %dx.types.Handle %buffer_annot, i32 %index, i32 0, float [[DATA0]], float [[DATA1]], float [[DATA2]], float [[DATA3]], i8 15, i32 4) 44*0e51b54bSJustin Bogner call void @llvm.dx.resource.store.rawbuffer.v4f32( 45*0e51b54bSJustin Bogner target("dx.RawBuffer", <4 x float>, 1, 0, 0) %buffer, 46*0e51b54bSJustin Bogner i32 %index, i32 0, <4 x float> %data) 47*0e51b54bSJustin Bogner 48*0e51b54bSJustin Bogner ret void 49*0e51b54bSJustin Bogner} 50*0e51b54bSJustin Bogner 51*0e51b54bSJustin Bogner; CHECK-LABEL: define void @storev4f32_byte 52*0e51b54bSJustin Bognerdefine void @storev4f32_byte(i32 %offset, <4 x float> %data) { 53*0e51b54bSJustin Bogner %buffer = call target("dx.RawBuffer", i8, 1, 0, 0) 54*0e51b54bSJustin Bogner @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_i8_0_0_0( 55*0e51b54bSJustin Bogner i32 0, i32 0, i32 1, i32 0, i1 false) 56*0e51b54bSJustin Bogner 57*0e51b54bSJustin Bogner ; CHECK: [[DATA0:%.*]] = extractelement <4 x float> %data, i32 0 58*0e51b54bSJustin Bogner ; CHECK: [[DATA1:%.*]] = extractelement <4 x float> %data, i32 1 59*0e51b54bSJustin Bogner ; CHECK: [[DATA2:%.*]] = extractelement <4 x float> %data, i32 2 60*0e51b54bSJustin Bogner ; CHECK: [[DATA3:%.*]] = extractelement <4 x float> %data, i32 3 61*0e51b54bSJustin Bogner ; CHECK: call void @dx.op.rawBufferStore.f32(i32 140, %dx.types.Handle %buffer_annot, i32 %offset, i32 0, float [[DATA0]], float [[DATA1]], float [[DATA2]], float [[DATA3]], i8 15, i32 4) 62*0e51b54bSJustin Bogner call void @llvm.dx.resource.store.rawbuffer.v4f32( 63*0e51b54bSJustin Bogner target("dx.RawBuffer", i8, 1, 0, 0) %buffer, 64*0e51b54bSJustin Bogner i32 %offset, i32 0, <4 x float> %data) 65*0e51b54bSJustin Bogner 66*0e51b54bSJustin Bogner ret void 67*0e51b54bSJustin Bogner} 68*0e51b54bSJustin Bogner 69*0e51b54bSJustin Bogner; CHECK-LABEL: define void @storeelements 70*0e51b54bSJustin Bognerdefine void @storeelements(i32 %index, <4 x float> %data0, <4 x i32> %data1) { 71*0e51b54bSJustin Bogner %buffer = call target("dx.RawBuffer", {<4 x float>, <4 x i32>}, 1, 0, 0) 72*0e51b54bSJustin Bogner @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_sl_v4f32v4i32s_0_0_0( 73*0e51b54bSJustin Bogner i32 0, i32 0, i32 1, i32 0, i1 false) 74*0e51b54bSJustin Bogner 75*0e51b54bSJustin Bogner ; CHECK: [[DATA0_0:%.*]] = extractelement <4 x float> %data0, i32 0 76*0e51b54bSJustin Bogner ; CHECK: [[DATA0_1:%.*]] = extractelement <4 x float> %data0, i32 1 77*0e51b54bSJustin Bogner ; CHECK: [[DATA0_2:%.*]] = extractelement <4 x float> %data0, i32 2 78*0e51b54bSJustin Bogner ; CHECK: [[DATA0_3:%.*]] = extractelement <4 x float> %data0, i32 3 79*0e51b54bSJustin Bogner ; CHECK: call void @dx.op.rawBufferStore.f32(i32 140, %dx.types.Handle %buffer_annot, i32 %index, i32 0, float [[DATA0_0]], float [[DATA0_1]], float [[DATA0_2]], float [[DATA0_3]], i8 15, i32 4) 80*0e51b54bSJustin Bogner call void @llvm.dx.resource.store.rawbuffer.v4f32( 81*0e51b54bSJustin Bogner target("dx.RawBuffer", {<4 x float>, <4 x i32>}, 1, 0, 0) %buffer, 82*0e51b54bSJustin Bogner i32 %index, i32 0, <4 x float> %data0) 83*0e51b54bSJustin Bogner 84*0e51b54bSJustin Bogner ; CHECK: [[DATA1_0:%.*]] = extractelement <4 x i32> %data1, i32 0 85*0e51b54bSJustin Bogner ; CHECK: [[DATA1_1:%.*]] = extractelement <4 x i32> %data1, i32 1 86*0e51b54bSJustin Bogner ; CHECK: [[DATA1_2:%.*]] = extractelement <4 x i32> %data1, i32 2 87*0e51b54bSJustin Bogner ; CHECK: [[DATA1_3:%.*]] = extractelement <4 x i32> %data1, i32 3 88*0e51b54bSJustin Bogner ; CHECK: call void @dx.op.rawBufferStore.i32(i32 140, %dx.types.Handle %buffer_annot, i32 %index, i32 16, i32 [[DATA1_0]], i32 [[DATA1_1]], i32 [[DATA1_2]], i32 [[DATA1_3]], i8 15, i32 4) 89*0e51b54bSJustin Bogner call void @llvm.dx.resource.store.rawbuffer.v4i32( 90*0e51b54bSJustin Bogner target("dx.RawBuffer", {<4 x float>, <4 x i32>}, 1, 0, 0) %buffer, 91*0e51b54bSJustin Bogner i32 %index, i32 16, <4 x i32> %data1) 92*0e51b54bSJustin Bogner 93*0e51b54bSJustin Bogner ret void 94*0e51b54bSJustin Bogner} 95*0e51b54bSJustin Bogner 96*0e51b54bSJustin Bogner; CHECK-LABEL: define void @storenested 97*0e51b54bSJustin Bognerdefine void @storenested(i32 %index, i32 %data0, <4 x float> %data1, <3 x half> %data2) { 98*0e51b54bSJustin Bogner %buffer = call 99*0e51b54bSJustin Bogner target("dx.RawBuffer", {i32, {<4 x float>, <3 x half>}}, 1, 0, 0) 100*0e51b54bSJustin Bogner @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, i1 false) 101*0e51b54bSJustin Bogner 102*0e51b54bSJustin Bogner ; CHECK: call void @dx.op.rawBufferStore.i32(i32 140, %dx.types.Handle %buffer_annot, i32 %index, i32 0, i32 %data0, i32 undef, i32 undef, i32 undef, i8 1, i32 4) 103*0e51b54bSJustin Bogner call void @llvm.dx.resource.store.rawbuffer.i32( 104*0e51b54bSJustin Bogner target("dx.RawBuffer", {i32, {<4 x float>, <3 x half>}}, 1, 0, 0) %buffer, 105*0e51b54bSJustin Bogner i32 %index, i32 0, i32 %data0) 106*0e51b54bSJustin Bogner 107*0e51b54bSJustin Bogner ; CHECK: [[DATA1_0:%.*]] = extractelement <4 x float> %data1, i32 0 108*0e51b54bSJustin Bogner ; CHECK: [[DATA1_1:%.*]] = extractelement <4 x float> %data1, i32 1 109*0e51b54bSJustin Bogner ; CHECK: [[DATA1_2:%.*]] = extractelement <4 x float> %data1, i32 2 110*0e51b54bSJustin Bogner ; CHECK: [[DATA1_3:%.*]] = extractelement <4 x float> %data1, i32 3 111*0e51b54bSJustin Bogner ; CHECK: call void @dx.op.rawBufferStore.f32(i32 140, %dx.types.Handle %buffer_annot, i32 %index, i32 4, float [[DATA1_0]], float [[DATA1_1]], float [[DATA1_2]], float [[DATA1_3]], i8 15, i32 4) 112*0e51b54bSJustin Bogner call void @llvm.dx.resource.store.rawbuffer.v4f32( 113*0e51b54bSJustin Bogner target("dx.RawBuffer", {i32, {<4 x float>, <3 x half>}}, 1, 0, 0) %buffer, 114*0e51b54bSJustin Bogner i32 %index, i32 4, <4 x float> %data1) 115*0e51b54bSJustin Bogner 116*0e51b54bSJustin Bogner ; CHECK: [[DATA2_0:%.*]] = extractelement <3 x half> %data2, i32 0 117*0e51b54bSJustin Bogner ; CHECK: [[DATA2_1:%.*]] = extractelement <3 x half> %data2, i32 1 118*0e51b54bSJustin Bogner ; CHECK: [[DATA2_2:%.*]] = extractelement <3 x half> %data2, i32 2 119*0e51b54bSJustin Bogner ; CHECK: call void @dx.op.rawBufferStore.f16(i32 140, %dx.types.Handle %buffer_annot, i32 %index, i32 20, half [[DATA2_0]], half [[DATA2_1]], half [[DATA2_2]], half undef, i8 7, i32 2) 120*0e51b54bSJustin Bogner call void @llvm.dx.resource.store.rawbuffer.v3f16( 121*0e51b54bSJustin Bogner target("dx.RawBuffer", {i32, {<4 x float>, <3 x half>}}, 1, 0, 0) %buffer, 122*0e51b54bSJustin Bogner i32 %index, i32 20, <3 x half> %data2) 123*0e51b54bSJustin Bogner 124*0e51b54bSJustin Bogner ret void 125*0e51b54bSJustin Bogner} 126*0e51b54bSJustin Bogner 127*0e51b54bSJustin Bogner; byteaddressbuf.Store<int64_t4> 128*0e51b54bSJustin Bogner; CHECK-LABEL: define void @storev4f64_byte 129*0e51b54bSJustin Bognerdefine void @storev4f64_byte(i32 %offset, <4 x double> %data) { 130*0e51b54bSJustin Bogner %buffer = call target("dx.RawBuffer", i8, 1, 0, 0) 131*0e51b54bSJustin Bogner @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_i8_0_0_0( 132*0e51b54bSJustin Bogner i32 0, i32 0, i32 1, i32 0, i1 false) 133*0e51b54bSJustin Bogner 134*0e51b54bSJustin Bogner ; CHECK: [[DATA0:%.*]] = extractelement <4 x double> %data, i32 0 135*0e51b54bSJustin Bogner ; CHECK: [[DATA1:%.*]] = extractelement <4 x double> %data, i32 1 136*0e51b54bSJustin Bogner ; CHECK: [[DATA2:%.*]] = extractelement <4 x double> %data, i32 2 137*0e51b54bSJustin Bogner ; CHECK: [[DATA3:%.*]] = extractelement <4 x double> %data, i32 3 138*0e51b54bSJustin Bogner ; CHECK: call void @dx.op.rawBufferStore.f64(i32 140, %dx.types.Handle %buffer_annot, i32 %offset, i32 0, double [[DATA0]], double [[DATA1]], double [[DATA2]], double [[DATA3]], i8 15, i32 8) 139*0e51b54bSJustin Bogner call void @llvm.dx.resource.store.rawbuffer.v4i64( 140*0e51b54bSJustin Bogner target("dx.RawBuffer", i8, 1, 0, 0) %buffer, 141*0e51b54bSJustin Bogner i32 %offset, i32 0, <4 x double> %data) 142*0e51b54bSJustin Bogner 143*0e51b54bSJustin Bogner ret void 144*0e51b54bSJustin Bogner} 145