summaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2018-01-10 12:57:19 +0100
committerSamuel Pitoiset <[email protected]>2018-01-10 19:02:23 +0100
commit7239e265ebe200891f161a07337cd31a92bf6ff8 (patch)
tree6a567e45469b614ed612107c2322a04a9b0a1dee /src/amd
parentb391fb26df9f1b0c1673cb79be2478b0fe459f9e (diff)
amd/common: import get_{load,store}_intr_attribs() from RadeonSI
v2: move those helpers to the header and use static inline Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]> (v1)
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/common/ac_llvm_build.c12
-rw-r--r--src/amd/common/ac_llvm_util.h18
2 files changed, 20 insertions, 10 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index efc6fa12e56..07044142b0b 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -983,11 +983,7 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
return ac_build_intrinsic(ctx, name, types[func], args,
ARRAY_SIZE(args),
- /* READNONE means writes can't affect it, while
- * READONLY means that writes can affect it. */
- can_speculate && HAVE_LLVM >= 0x0400 ?
- AC_FUNC_ATTR_READNONE :
- AC_FUNC_ATTR_READONLY);
+ ac_get_load_intr_attribs(can_speculate));
}
LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx,
@@ -1007,11 +1003,7 @@ LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx,
return ac_build_intrinsic(ctx,
"llvm.amdgcn.buffer.load.format.v4f32",
ctx->v4f32, args, ARRAY_SIZE(args),
- /* READNONE means writes can't affect it, while
- * READONLY means that writes can affect it. */
- can_speculate && HAVE_LLVM >= 0x0400 ?
- AC_FUNC_ATTR_READNONE :
- AC_FUNC_ATTR_READONLY);
+ ac_get_load_intr_attribs(can_speculate));
}
/**
diff --git a/src/amd/common/ac_llvm_util.h b/src/amd/common/ac_llvm_util.h
index 7c8b6b0a130..61bcc4e54ed 100644
--- a/src/amd/common/ac_llvm_util.h
+++ b/src/amd/common/ac_llvm_util.h
@@ -81,6 +81,24 @@ void
ac_llvm_add_target_dep_function_attr(LLVMValueRef F,
const char *name, int value);
+static inline unsigned
+ac_get_load_intr_attribs(bool can_speculate)
+{
+ /* READNONE means writes can't affect it, while READONLY means that
+ * writes can affect it. */
+ return can_speculate && HAVE_LLVM >= 0x0400 ?
+ AC_FUNC_ATTR_READNONE :
+ AC_FUNC_ATTR_READONLY;
+}
+
+static inline unsigned
+ac_get_store_intr_attribs(bool writeonly_memory)
+{
+ return writeonly_memory && HAVE_LLVM >= 0x0400 ?
+ AC_FUNC_ATTR_INACCESSIBLE_MEM_ONLY :
+ AC_FUNC_ATTR_WRITEONLY;
+}
+
#ifdef __cplusplus
}
#endif