brintos

brintos / llvm-project-archived public Read only

0
0
Text · 9.7 KiB · bd22568 Raw
205 lines · plain
1; RUN: opt -S -dxil-op-lower %s | FileCheck %s2 3target triple = "dxil-pc-shadermodel6.6-compute"4 5; CHECK-LABEL: define void @storefloats6define void @storefloats(<4 x float> %data, i32 %index) {7 8  ; CHECK: [[BIND:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217,9  ; CHECK: [[HANDLE:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[BIND]]10  %buffer = call target("dx.TypedBuffer", <4 x float>, 1, 0, 0)11      @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_v4f32_1_0_0(12          i32 0, i32 0, i32 1, i32 0, ptr null)13 14  ; The temporary casts should all have been cleaned up15  ; CHECK-NOT: %dx.resource.casthandle16 17  ; CHECK: [[DATA0_0:%.*]] = extractelement <4 x float> %data, i32 018  ; CHECK: [[DATA0_1:%.*]] = extractelement <4 x float> %data, i32 119  ; CHECK: [[DATA0_2:%.*]] = extractelement <4 x float> %data, i32 220  ; CHECK: [[DATA0_3:%.*]] = extractelement <4 x float> %data, i32 321  ; CHECK: call void @dx.op.bufferStore.f32(i32 69, %dx.types.Handle [[HANDLE]], i32 %index, i32 undef, float [[DATA0_0]], float [[DATA0_1]], float [[DATA0_2]], float [[DATA0_3]], i8 15){{$}}22  call void @llvm.dx.resource.store.typedbuffer(23      target("dx.TypedBuffer", <4 x float>, 1, 0, 0) %buffer,24      i32 %index, <4 x float> %data)25 26  ret void27}28 29; CHECK-LABEL: define void @storeonefloat30define void @storeonefloat(float %data, i32 %index) {31 32  ; CHECK: [[BIND:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217,33  ; CHECK: [[HANDLE:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[BIND]]34  %buffer = call target("dx.TypedBuffer", float, 1, 0, 0)35      @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_f32_1_0_0(36          i32 0, i32 0, i32 1, i32 0, ptr null)37 38  ; The temporary casts should all have been cleaned up39  ; CHECK-NOT: %dx.resource.casthandle40 41  ; CHECK: call void @dx.op.bufferStore.f32(i32 69, %dx.types.Handle [[HANDLE]], i32 %index, i32 undef, float %data, float %data, float %data, float %data, i8 15){{$}}42  call void @llvm.dx.resource.store.typedbuffer(43      target("dx.TypedBuffer", float, 1, 0, 0) %buffer,44      i32 %index, float %data)45 46  ret void47}48 49; CHECK-LABEL: define void @storetwofloat50define void @storetwofloat(<2 x float> %data, i32 %index) {51 52  ; CHECK: [[BIND:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217,53  ; CHECK: [[HANDLE:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[BIND]]54  %buffer = call target("dx.TypedBuffer", <2 x float>, 1, 0, 0)55      @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_v2f32_1_0_0(56          i32 0, i32 0, i32 1, i32 0, ptr null)57 58  ; The temporary casts should all have been cleaned up59  ; CHECK-NOT: %dx.resource.casthandle60 61  ; CHECK: [[DATA0_0:%.*]] = extractelement <2 x float> %data, i32 062  ; CHECK: [[DATA0_1:%.*]] = extractelement <2 x float> %data, i32 163  ; CHECK: call void @dx.op.bufferStore.f32(i32 69, %dx.types.Handle [[HANDLE]], i32 %index, i32 undef, float [[DATA0_0]], float [[DATA0_1]], float [[DATA0_0]], float [[DATA0_0]], i8 15){{$}}64  call void @llvm.dx.resource.store.typedbuffer(65      target("dx.TypedBuffer", <2 x float>, 1, 0, 0) %buffer,66      i32 %index, <2 x float> %data)67 68  ret void69}70 71; CHECK-LABEL: define void @storeint72define void @storeint(<4 x i32> %data, i32 %index) {73 74  ; CHECK: [[BIND:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217,75  ; CHECK: [[HANDLE:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[BIND]]76  %buffer = call target("dx.TypedBuffer", <4 x i32>, 1, 0, 0)77      @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_v4i32_1_0_0(78          i32 0, i32 0, i32 1, i32 0, ptr null)79 80  ; CHECK: [[DATA0_0:%.*]] = extractelement <4 x i32> %data, i32 081  ; CHECK: [[DATA0_1:%.*]] = extractelement <4 x i32> %data, i32 182  ; CHECK: [[DATA0_2:%.*]] = extractelement <4 x i32> %data, i32 283  ; CHECK: [[DATA0_3:%.*]] = extractelement <4 x i32> %data, i32 384  ; CHECK: call void @dx.op.bufferStore.i32(i32 69, %dx.types.Handle [[HANDLE]], i32 %index, i32 undef, i32 [[DATA0_0]], i32 [[DATA0_1]], i32 [[DATA0_2]], i32 [[DATA0_3]], i8 15){{$}}85  call void @llvm.dx.resource.store.typedbuffer(86      target("dx.TypedBuffer", <4 x i32>, 1, 0, 0) %buffer,87      i32 %index, <4 x i32> %data)88 89  ret void90}91 92; CHECK-LABEL: define void @storehalf93define void @storehalf(<4 x half> %data, i32 %index) {94 95  ; CHECK: [[BIND:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217,96  ; CHECK: [[HANDLE:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[BIND]]97  %buffer = call target("dx.TypedBuffer", <4 x half>, 1, 0, 0)98      @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_v4f16_1_0_0(99          i32 0, i32 0, i32 1, i32 0, ptr null)100 101  ; The temporary casts should all have been cleaned up102  ; CHECK-NOT: %dx.resource.casthandle103 104  ; CHECK: [[DATA0_0:%.*]] = extractelement <4 x half> %data, i32 0105  ; CHECK: [[DATA0_1:%.*]] = extractelement <4 x half> %data, i32 1106  ; CHECK: [[DATA0_2:%.*]] = extractelement <4 x half> %data, i32 2107  ; CHECK: [[DATA0_3:%.*]] = extractelement <4 x half> %data, i32 3108  ; CHECK: call void @dx.op.bufferStore.f16(i32 69, %dx.types.Handle [[HANDLE]], i32 %index, i32 undef, half [[DATA0_0]], half [[DATA0_1]], half [[DATA0_2]], half [[DATA0_3]], i8 15){{$}}109  call void @llvm.dx.resource.store.typedbuffer(110      target("dx.TypedBuffer", <4 x half>, 1, 0, 0) %buffer,111      i32 %index, <4 x half> %data)112 113  ret void114}115 116; CHECK-LABEL: define void @storei16117define void @storei16(<4 x i16> %data, i32 %index) {118 119  ; CHECK: [[BIND:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217,120  ; CHECK: [[HANDLE:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[BIND]]121  %buffer = call target("dx.TypedBuffer", <4 x i16>, 1, 0, 0)122      @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_v4i16_1_0_0(123          i32 0, i32 0, i32 1, i32 0, ptr null)124 125  ; The temporary casts should all have been cleaned up126  ; CHECK-NOT: %dx.resource.casthandle127 128  ; CHECK: [[DATA0_0:%.*]] = extractelement <4 x i16> %data, i32 0129  ; CHECK: [[DATA0_1:%.*]] = extractelement <4 x i16> %data, i32 1130  ; CHECK: [[DATA0_2:%.*]] = extractelement <4 x i16> %data, i32 2131  ; CHECK: [[DATA0_3:%.*]] = extractelement <4 x i16> %data, i32 3132  ; CHECK: call void @dx.op.bufferStore.i16(i32 69, %dx.types.Handle [[HANDLE]], i32 %index, i32 undef, i16 [[DATA0_0]], i16 [[DATA0_1]], i16 [[DATA0_2]], i16 [[DATA0_3]], i8 15){{$}}133  call void @llvm.dx.resource.store.typedbuffer(134      target("dx.TypedBuffer", <4 x i16>, 1, 0, 0) %buffer,135      i32 %index, <4 x i16> %data)136 137  ret void138}139 140; CHECK-LABEL: define void @store_scalarized_floats141define void @store_scalarized_floats(float %data0, float %data1, float %data2, float %data3, i32 %index) {142 143  ; CHECK: [[BIND:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217,144  ; CHECK: [[HANDLE:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[BIND]]145  %buffer = call target("dx.TypedBuffer", <4 x float>, 1, 0, 0)146      @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_v4f32_1_0_0(147          i32 0, i32 0, i32 1, i32 0, ptr null)148 149  ; We shouldn't end up with any inserts/extracts.150  ; CHECK-NOT: insertelement151  ; CHECK-NOT: extractelement152 153  ; CHECK: call void @dx.op.bufferStore.f32(i32 69, %dx.types.Handle [[HANDLE]], i32 %index, i32 undef, float %data0, float %data1, float %data2, float %data3, i8 15)154  %vec.upto0 = insertelement <4 x float> poison, float %data0, i64 0155  %vec.upto1 = insertelement <4 x float> %vec.upto0, float %data1, i64 1156  %vec.upto2 = insertelement <4 x float> %vec.upto1, float %data2, i64 2157  %vec = insertelement <4 x float> %vec.upto2, float %data3, i64 3158  call void @llvm.dx.resource.store.typedbuffer(159      target("dx.TypedBuffer", <4 x float>, 1, 0, 0) %buffer,160      i32 %index, <4 x float> %vec)161 162  ret void163}164 165define void @storef64(<2 x i32> %0) {166  ; CHECK: [[B1:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217,167  ; CHECK: [[BA:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[B1]]168  169  %buffer = tail call target("dx.TypedBuffer", double, 1, 0, 0)170      @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_f64_1_0_0t(171          i32 0, i32 0, i32 1, i32 0, ptr null)172 173  ; The temporary casts should all have been cleaned up174  ; CHECK-NOT: %dx.resource.casthandle175 176  ; CHECK: [[D0:%.*]] = extractelement <2 x i32> %0, i32 0177  ; CHECK: [[D1:%.*]] = extractelement <2 x i32> %0, i32 1178  ; CHECK: call void @dx.op.bufferStore.i32(i32 69, %dx.types.Handle [[BA]], i32 0, i32 undef, i32 %2, i32 %3, i32 %2, i32 %2, i8 15)179  call void @llvm.dx.resource.store.typedbuffer(180      target("dx.TypedBuffer", double, 1, 0, 0) %buffer, i32 0, <2 x i32> %0)181  ret void182}183 184define void @storev2f64(<4 x i32> %0) {185  ; CHECK: [[B1:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217,186  ; CHECK: [[BA:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[B1]]187  188  %buffer = tail call target("dx.TypedBuffer", <2 x double>, 1, 0, 0)189      @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_v2f64_1_0_0t(190          i32 0, i32 0, i32 1, i32 0, ptr null)191 192  ; The temporary casts should all have been cleaned up193  ; CHECK-NOT: %dx.resource.casthandle194 195  ; CHECK: [[D0:%.*]] = extractelement <4 x i32> %0, i32 0196  ; CHECK: [[D1:%.*]] = extractelement <4 x i32> %0, i32 1197  ; CHECK: [[D2:%.*]] = extractelement <4 x i32> %0, i32 2198  ; CHECK: [[D3:%.*]] = extractelement <4 x i32> %0, i32 3199  ; CHECK: call void @dx.op.bufferStore.i32(i32 69, %dx.types.Handle [[BA]], i32 0, i32 undef, i32 [[D0]], i32 [[D1]], i32 [[D2]], i32 [[D3]], i8 15)200  call void @llvm.dx.resource.store.typedbuffer(201      target("dx.TypedBuffer", <2 x double>, 1, 0, 0) %buffer, i32 0,202      <4 x i32> %0)203  ret void204}205