[v2,09/12] ac/nir: use ac_build_buffer_store_dword() for SSBO store operations

Submitted by Samuel Pitoiset on March 13, 2019, 10:50 a.m.

Details

Message ID 20190313105020.17683-10-samuel.pitoiset@gmail.com
State New
Headers show
Series "ac: use LLVM 8 buffer intrinsics everywhere" ( rev: 2 ) in Mesa

Not browsing as part of any series.

Commit Message

Samuel Pitoiset March 13, 2019, 10:50 a.m.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
---
 src/amd/common/ac_nir_to_llvm.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index af0c3cc679d..f4d408cd587 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -1591,34 +1591,29 @@  static void visit_store_ssbo(struct ac_nir_context *ctx,
 					   ctx->ac.voidt, tbuffer_params, 10,
 					   ac_get_store_intr_attribs(writeonly_memory));
 		} else {
+			int num_channels = num_bytes / 4;
+
 			switch (num_bytes) {
 			case 16: /* v4f32 */
-				store_name = "llvm.amdgcn.buffer.store.v4f32";
 				data_type = ctx->ac.v4f32;
 				break;
 			case 8: /* v2f32 */
-				store_name = "llvm.amdgcn.buffer.store.v2f32";
 				data_type = ctx->ac.v2f32;
 				break;
 			case 4: /* f32 */
-				store_name = "llvm.amdgcn.buffer.store.f32";
 				data_type = ctx->ac.f32;
 				break;
 			default:
 				unreachable("Malformed vector store.");
 			}
 			data = LLVMBuildBitCast(ctx->ac.builder, data, data_type, "");
-			LLVMValueRef params[] = {
-				data,
-				rsrc,
-				ctx->ac.i32_0, /* vindex */
-				offset,
-				glc,
-				ctx->ac.i1false,  /* slc */
-			};
-			ac_build_intrinsic(&ctx->ac, store_name,
-					   ctx->ac.voidt, params, 6,
-					   ac_get_store_intr_attribs(writeonly_memory));
+
+			ac_build_buffer_store_dword(&ctx->ac, rsrc, data,
+						    num_channels, offset,
+						    ctx->ac.i32_0, 0,
+						    cache_policy & ac_glc,
+						    false, writeonly_memory,
+						    false);
 		}
 	}
 }