summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2019-03-26 12:37:39 +0100
committerSamuel Pitoiset <[email protected]>2019-04-17 22:10:30 +0200
commitad6dc13fc70a9802be41c1b9bb9e3487adb7ca7f (patch)
tree00a743e9050b6182050419c68a9e8ade48a780c5
parent26ea50623550dd84c19e4f2132a355509b1b0c41 (diff)
ac: use struct/raw store intrinsics for 8-bit/16-bit int with LLVM 9+
This changes requires LLVM r356465. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r--src/amd/common/ac_llvm_build.c48
1 files changed, 34 insertions, 14 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 55ad3534ae2..d75b28e1b82 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -1794,15 +1794,25 @@ ac_build_tbuffer_store_short(struct ac_llvm_context *ctx,
bool glc,
bool writeonly_memory)
{
- unsigned dfmt = V_008F0C_BUF_DATA_FORMAT_16;
- unsigned nfmt = V_008F0C_BUF_NUM_FORMAT_UINT;
-
vdata = LLVMBuildBitCast(ctx->builder, vdata, ctx->i16, "");
- vdata = LLVMBuildZExt(ctx->builder, vdata, ctx->i32, "");
- ac_build_raw_tbuffer_store(ctx, rsrc, vdata, voffset, soffset,
- ctx->i32_0, 1, dfmt, nfmt, glc, false,
- writeonly_memory);
+ if (HAVE_LLVM >= 0x900) {
+ /* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */
+ ac_build_llvm8_buffer_store_common(ctx, rsrc, vdata, NULL,
+ voffset, soffset, 1,
+ ctx->i16, glc, false,
+ writeonly_memory, false,
+ false);
+ } else {
+ unsigned dfmt = V_008F0C_BUF_DATA_FORMAT_16;
+ unsigned nfmt = V_008F0C_BUF_NUM_FORMAT_UINT;
+
+ vdata = LLVMBuildZExt(ctx->builder, vdata, ctx->i32, "");
+
+ ac_build_raw_tbuffer_store(ctx, rsrc, vdata, voffset, soffset,
+ ctx->i32_0, 1, dfmt, nfmt, glc, false,
+ writeonly_memory);
+ }
}
void
@@ -1814,15 +1824,25 @@ ac_build_tbuffer_store_byte(struct ac_llvm_context *ctx,
bool glc,
bool writeonly_memory)
{
- unsigned dfmt = V_008F0C_BUF_DATA_FORMAT_8;
- unsigned nfmt = V_008F0C_BUF_NUM_FORMAT_UINT;
-
vdata = LLVMBuildBitCast(ctx->builder, vdata, ctx->i8, "");
- vdata = LLVMBuildZExt(ctx->builder, vdata, ctx->i32, "");
- ac_build_raw_tbuffer_store(ctx, rsrc, vdata, voffset, soffset,
- ctx->i32_0, 1, dfmt, nfmt, glc, false,
- writeonly_memory);
+ if (HAVE_LLVM >= 0x900) {
+ /* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */
+ ac_build_llvm8_buffer_store_common(ctx, rsrc, vdata, NULL,
+ voffset, soffset, 1,
+ ctx->i8, glc, false,
+ writeonly_memory, false,
+ false);
+ } else {
+ unsigned dfmt = V_008F0C_BUF_DATA_FORMAT_8;
+ unsigned nfmt = V_008F0C_BUF_NUM_FORMAT_UINT;
+
+ vdata = LLVMBuildZExt(ctx->builder, vdata, ctx->i32, "");
+
+ ac_build_raw_tbuffer_store(ctx, rsrc, vdata, voffset, soffset,
+ ctx->i32_0, 1, dfmt, nfmt, glc, false,
+ writeonly_memory);
+ }
}
/**
* Set range metadata on an instruction. This can only be used on load and