summaryrefslogtreecommitdiffstats
path: root/src/amd/common/ac_llvm_build.c
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2018-03-02 15:01:30 +0100
committerSamuel Pitoiset <[email protected]>2018-03-05 11:04:30 +0100
commit459e33900ff7f569ecfe12bf876d2a3e77cb6747 (patch)
tree35531b64ee99ecbb90756c7f0c7bfb6cef9662b2 /src/amd/common/ac_llvm_build.c
parentfe0647df5a70a4954d9399f0860a12ff691a88ee (diff)
ac: add ac_build_fract()
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/amd/common/ac_llvm_build.c')
-rw-r--r--src/amd/common/ac_llvm_build.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 15144addb9b..1a245bd8e68 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -1686,6 +1686,28 @@ void ac_build_waitcnt(struct ac_llvm_context *ctx, unsigned simm16)
ctx->voidt, args, 1, 0);
}
+LLVMValueRef ac_build_fract(struct ac_llvm_context *ctx, LLVMValueRef src0,
+ unsigned bitsize)
+{
+ LLVMTypeRef type;
+ char *intr;
+
+ if (bitsize == 32) {
+ intr = "llvm.floor.f32";
+ type = ctx->f32;
+ } else {
+ intr = "llvm.floor.f64";
+ type = ctx->f64;
+ }
+
+ LLVMValueRef params[] = {
+ src0,
+ };
+ LLVMValueRef floor = ac_build_intrinsic(ctx, intr, type, params, 1,
+ AC_FUNC_ATTR_READNONE);
+ return LLVMBuildFSub(ctx->builder, src0, floor, "");
+}
+
void ac_get_image_intr_name(const char *base_name,
LLVMTypeRef data_type,
LLVMTypeRef coords_type,