diff options
author | Samuel Pitoiset <[email protected]> | 2019-02-14 14:42:30 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2019-02-18 12:14:20 +0100 |
commit | 2cf5433b99f989fa0ae1d2b108779e247145af85 (patch) | |
tree | 84f99f34cb612bde0a2e502350c1fdaecd770f23 /src/amd/common | |
parent | f0223143a8ba26962cebcec9118ac5c9de3113aa (diff) |
ac: use new LLVM 8 intrinsic when loading 16-bit values
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/common')
-rw-r--r-- | src/amd/common/ac_llvm_build.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 3acf41728ac..867a13622f9 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -1347,20 +1347,33 @@ ac_build_tbuffer_load_short(struct ac_llvm_context *ctx, LLVMValueRef immoffset, LLVMValueRef glc) { - const char *name = "llvm.amdgcn.tbuffer.load.i32"; - LLVMTypeRef type = ctx->i32; - LLVMValueRef params[] = { - rsrc, - vindex, - voffset, - soffset, - immoffset, - LLVMConstInt(ctx->i32, V_008F0C_BUF_DATA_FORMAT_16, false), - LLVMConstInt(ctx->i32, V_008F0C_BUF_NUM_FORMAT_UINT, false), - glc, - ctx->i1false, - }; - LLVMValueRef res = ac_build_intrinsic(ctx, name, type, params, 9, 0); + unsigned dfmt = V_008F0C_BUF_DATA_FORMAT_16; + unsigned nfmt = V_008F0C_BUF_NUM_FORMAT_UINT; + LLVMValueRef res; + + if (HAVE_LLVM >= 0x0800) { + voffset = LLVMBuildAdd(ctx->builder, voffset, immoffset, ""); + + res = ac_build_llvm8_tbuffer_load(ctx, rsrc, vindex, voffset, + soffset, 1, dfmt, nfmt, glc, + false, true, true); + } else { + const char *name = "llvm.amdgcn.tbuffer.load.i32"; + LLVMTypeRef type = ctx->i32; + LLVMValueRef params[] = { + rsrc, + vindex, + voffset, + soffset, + immoffset, + LLVMConstInt(ctx->i32, dfmt, false), + LLVMConstInt(ctx->i32, nfmt, false), + glc, + ctx->i1false, + }; + res = ac_build_intrinsic(ctx, name, type, params, 9, 0); + } + return LLVMBuildTrunc(ctx->builder, res, ctx->i16, ""); } |