|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| 2 | +; RUN: opt -mcpu=gfx900 -S -passes=instcombine -mtriple=amdgcn-amd-amdhsa %s | FileCheck -check-prefixes=GCN %s |
| 3 | +; RUN: opt -mcpu=gfx1010 -S -passes=instcombine -mtriple=amdgcn-amd-amdhsa %s | FileCheck -check-prefixes=GCN %s |
| 4 | +; RUN: opt -mcpu=gfx1100 -S -passes=instcombine -mtriple=amdgcn-amd-amdhsa %s | FileCheck -check-prefixes=GCN %s |
| 5 | + |
| 6 | +define amdgpu_ps void @image_store_1d_store_all_zeros(<8 x i32> inreg %rsrc, i32 %s) #0 { |
| 7 | +; GCN-LABEL: @image_store_1d_store_all_zeros( |
| 8 | +; GCN-NEXT: call void @llvm.amdgcn.image.store.1d.f32.i32(float 0.000000e+00, i32 1, i32 [[S:%.*]], <8 x i32> [[RSRC:%.*]], i32 0, i32 0) |
| 9 | +; GCN-NEXT: ret void |
| 10 | +; |
| 11 | + call void @llvm.amdgcn.image.store.1d.v4f32.i32(<4 x float> zeroinitializer, i32 15, i32 %s, <8 x i32> %rsrc, i32 0, i32 0) |
| 12 | + ret void |
| 13 | +} |
| 14 | + |
| 15 | +define amdgpu_ps void @image_store_1d_store_insert_zeros_at_end(<8 x i32> inreg %rsrc, float %vdata1, i32 %s) #0 { |
| 16 | +; GCN-LABEL: @image_store_1d_store_insert_zeros_at_end( |
| 17 | +; GCN-NEXT: call void @llvm.amdgcn.image.store.1d.f32.i32(float [[VDATA1:%.*]], i32 1, i32 [[S:%.*]], <8 x i32> [[RSRC:%.*]], i32 0, i32 0) |
| 18 | +; GCN-NEXT: ret void |
| 19 | +; |
| 20 | + %newvdata1 = insertelement <4 x float> undef, float %vdata1, i32 0 |
| 21 | + %newvdata2 = insertelement <4 x float> %newvdata1, float 0.0, i32 1 |
| 22 | + %newvdata3 = insertelement <4 x float> %newvdata2, float 0.0, i32 2 |
| 23 | + %newvdata4 = insertelement <4 x float> %newvdata3, float 0.0, i32 3 |
| 24 | + call void @llvm.amdgcn.image.store.1d.v4f32.i32(<4 x float> %newvdata4, i32 15, i32 %s, <8 x i32> %rsrc, i32 0, i32 0) |
| 25 | + ret void |
| 26 | +} |
| 27 | + |
| 28 | +define amdgpu_ps void @image_store_mip_1d_store_insert_zeros_at_end(<8 x i32> inreg %rsrc, float %vdata1, float %vdata2, i32 %s, i32 %mip) #0 { |
| 29 | +; GCN-LABEL: @image_store_mip_1d_store_insert_zeros_at_end( |
| 30 | +; GCN-NEXT: [[TMP1:%.*]] = insertelement <3 x float> <float 0.000000e+00, float poison, float poison>, float [[VDATA1:%.*]], i64 1 |
| 31 | +; GCN-NEXT: [[TMP2:%.*]] = insertelement <3 x float> [[TMP1]], float [[VDATA2:%.*]], i64 2 |
| 32 | +; GCN-NEXT: call void @llvm.amdgcn.image.store.1d.v3f32.i32(<3 x float> [[TMP2]], i32 7, i32 [[S:%.*]], <8 x i32> [[RSRC:%.*]], i32 0, i32 0) |
| 33 | +; GCN-NEXT: ret void |
| 34 | +; |
| 35 | + %newvdata1 = insertelement <4 x float> undef, float 0.0, i32 0 |
| 36 | + %newvdata2 = insertelement <4 x float> %newvdata1, float %vdata1, i32 1 |
| 37 | + %newvdata3 = insertelement <4 x float> %newvdata2, float %vdata2, i32 2 |
| 38 | + %newvdata4 = insertelement <4 x float> %newvdata3, float 0.0, i32 3 |
| 39 | + call void @llvm.amdgcn.image.store.mip.1d.v4f32.i32(<4 x float> %newvdata4, i32 7, i32 %s, i32 0, <8 x i32> %rsrc, i32 0, i32 0) |
| 40 | + ret void |
| 41 | +} |
| 42 | + |
| 43 | +define amdgpu_ps void @buffer_store_format_insert_zeros_at_end(<4 x i32> inreg %a, float %vdata1, i32 %b) { |
| 44 | +; GCN-LABEL: @buffer_store_format_insert_zeros_at_end( |
| 45 | +; GCN-NEXT: [[TMP1:%.*]] = insertelement <2 x float> undef, float [[VDATA1:%.*]], i64 0 |
| 46 | +; GCN-NEXT: [[TMP2:%.*]] = shufflevector <2 x float> [[TMP1]], <2 x float> poison, <2 x i32> zeroinitializer |
| 47 | +; GCN-NEXT: call void @llvm.amdgcn.buffer.store.format.v2f32(<2 x float> [[TMP2]], <4 x i32> [[A:%.*]], i32 [[B:%.*]], i32 0, i1 false, i1 false) |
| 48 | +; GCN-NEXT: ret void |
| 49 | +; |
| 50 | + %newvdata1 = insertelement <4 x float> undef, float %vdata1, i32 0 |
| 51 | + %newvdata2 = insertelement <4 x float> %newvdata1, float %vdata1, i32 1 |
| 52 | + %newvdata3 = insertelement <4 x float> %newvdata2, float 0.0, i32 2 |
| 53 | + %newvdata4 = insertelement <4 x float> %newvdata3, float 0.0, i32 3 |
| 54 | + call void @llvm.amdgcn.buffer.store.format.v4f32(<4 x float> %newvdata4, <4 x i32> %a, i32 %b, i32 0, i1 0, i1 0) |
| 55 | + ret void |
| 56 | +} |
| 57 | + |
| 58 | +define amdgpu_ps void @struct_buffer_store_format_insert_zeros(<4 x i32> inreg %a, float %vdata1, i32 %b) { |
| 59 | +; GCN-LABEL: @struct_buffer_store_format_insert_zeros( |
| 60 | +; GCN-NEXT: [[TMP1:%.*]] = insertelement <3 x float> <float poison, float 0.000000e+00, float poison>, float [[VDATA1:%.*]], i64 0 |
| 61 | +; GCN-NEXT: [[TMP2:%.*]] = insertelement <3 x float> [[TMP1]], float [[VDATA1]], i64 2 |
| 62 | +; GCN-NEXT: call void @llvm.amdgcn.struct.buffer.store.format.v3f32(<3 x float> [[TMP2]], <4 x i32> [[A:%.*]], i32 [[B:%.*]], i32 0, i32 42, i32 0) |
| 63 | +; GCN-NEXT: ret void |
| 64 | +; |
| 65 | + %newvdata1 = insertelement <4 x float> undef, float %vdata1, i32 0 |
| 66 | + %newvdata2 = insertelement <4 x float> %newvdata1, float 0.0, i32 1 |
| 67 | + %newvdata3 = insertelement <4 x float> %newvdata2, float %vdata1, i32 2 |
| 68 | + %newvdata4 = insertelement <4 x float> %newvdata3, float 0.0, i32 3 |
| 69 | + call void @llvm.amdgcn.struct.buffer.store.format.v4f32(<4 x float> %newvdata4, <4 x i32> %a, i32 %b, i32 0, i32 42, i32 0) |
| 70 | + ret void |
| 71 | +} |
| 72 | + |
| 73 | +define amdgpu_ps void @struct_tbuffer_store_insert_zeros_at_beginning(<4 x i32> inreg %a, float %vdata1, i32 %b) { |
| 74 | +; GCN-LABEL: @struct_tbuffer_store_insert_zeros_at_beginning( |
| 75 | +; GCN-NEXT: [[NEWVDATA4:%.*]] = insertelement <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float poison>, float [[VDATA1:%.*]], i64 3 |
| 76 | +; GCN-NEXT: call void @llvm.amdgcn.struct.tbuffer.store.v4f32(<4 x float> [[NEWVDATA4]], <4 x i32> [[A:%.*]], i32 [[B:%.*]], i32 0, i32 42, i32 0, i32 15) |
| 77 | +; GCN-NEXT: ret void |
| 78 | +; |
| 79 | + %newvdata1 = insertelement <4 x float> undef, float 0.0, i32 0 |
| 80 | + %newvdata2 = insertelement <4 x float> %newvdata1, float 0.0, i32 1 |
| 81 | + %newvdata3 = insertelement <4 x float> %newvdata2, float 0.0, i32 2 |
| 82 | + %newvdata4 = insertelement <4 x float> %newvdata3, float %vdata1, i32 3 |
| 83 | + call void @llvm.amdgcn.struct.tbuffer.store.v4f32(<4 x float> %newvdata4, <4 x i32> %a, i32 %b, i32 0, i32 42, i32 0, i32 15) |
| 84 | + ret void |
| 85 | +} |
| 86 | + |
| 87 | +declare void @llvm.amdgcn.raw.buffer.store.format.v4f32(<4 x float>, <4 x i32>, i32, i32, i32) #2 |
| 88 | +declare void @llvm.amdgcn.buffer.store.format.v4f32(<4 x float>, <4 x i32>, i32, i32, i1, i1) #1 |
| 89 | +declare void @llvm.amdgcn.struct.buffer.store.format.v4f32(<4 x float>, <4 x i32>, i32, i32, i32, i32) #2 |
| 90 | +declare void @llvm.amdgcn.struct.tbuffer.store.v4f32(<4 x float>, <4 x i32>, i32, i32, i32, i32, i32) #0 |
| 91 | +declare void @llvm.amdgcn.raw.tbuffer.store.v4f32(<4 x float>, <4 x i32>, i32, i32, i32, i32) #0 |
| 92 | +declare void @llvm.amdgcn.tbuffer.store.v4f32(<4 x float>, <4 x i32>, i32, i32, i32, i32, i32, i32, i1, i1) #0 |
| 93 | +declare void @llvm.amdgcn.image.store.1d.v4f32.i32(<4 x float>, i32, i32, <8 x i32>, i32, i32) #0 |
| 94 | +declare void @llvm.amdgcn.image.store.2d.v4f32.i32(<4 x float>, i32, i32, i32, <8 x i32>, i32, i32) #0 |
| 95 | +declare void @llvm.amdgcn.image.store.3d.v4f32.i32(<4 x float>, i32, i32, i32, i32, <8 x i32>, i32, i32) #0 |
| 96 | +declare void @llvm.amdgcn.image.store.cube.v4f32.i32(<4 x float>, i32, i32, i32, i32, <8 x i32>, i32, i32) #0 |
| 97 | +declare void @llvm.amdgcn.image.store.1darray.v4f32.i32(<4 x float>, i32, i32, i32, <8 x i32>, i32, i32) #0 |
| 98 | +declare void @llvm.amdgcn.image.store.2darray.v4f32.i32(<4 x float>, i32, i32, i32, i32, <8 x i32>, i32, i32) #0 |
| 99 | +declare void @llvm.amdgcn.image.store.2dmsaa.v4f32.i32(<4 x float>, i32, i32, i32, i32, <8 x i32>, i32, i32) #0 |
| 100 | +declare void @llvm.amdgcn.image.store.2darraymsaa.v4f32.i32(<4 x float>, i32, i32, i32, i32, i32, <8 x i32>, i32, i32) #0 |
| 101 | +declare void @llvm.amdgcn.image.store.mip.1d.v4f32.i32(<4 x float>, i32, i32, i32, <8 x i32>, i32, i32) #0 |
| 102 | +declare void @llvm.amdgcn.image.store.mip.2d.v4f32.i32(<4 x float>, i32, i32, i32, i32, <8 x i32>, i32, i32) #0 |
| 103 | +declare void @llvm.amdgcn.image.store.mip.3d.v4f32.i32(<4 x float>, i32, i32, i32, i32, i32, <8 x i32>, i32, i32) #0 |
| 104 | +declare void @llvm.amdgcn.image.store.mip.cube.v4f32.i32(<4 x float>, i32, i32, i32, i32, i32, <8 x i32>, i32, i32) #0 |
| 105 | +declare void @llvm.amdgcn.image.store.mip.1darray.v4f32.i32(<4 x float>, i32, i32, i32, i32, <8 x i32>, i32, i32) #0 |
| 106 | +declare void @llvm.amdgcn.image.store.mip.2darray.v4f32.i32(<4 x float>, i32, i32, i32, i32, i32, <8 x i32>, i32, i32) #0 |
| 107 | + |
| 108 | +attributes #0 = { nounwind } |
| 109 | +attributes #1 = { nounwind writeonly } |
| 110 | +attributes #2 = { nounwind } |
0 commit comments