summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_bld_arit.h
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-08-01 17:27:05 +0100
committerJosé Fonseca <jfonseca@vmware.com>2009-08-29 09:21:21 +0100
commitd2cf3e8dfd37d6225d5f6911fc53a07706cd07f7 (patch)
tree0b735cd3d6252e3c84f895eeb5a1aaddaf6fc645 /src/gallium/drivers/llvmpipe/lp_bld_arit.h
parentfa3514a57eeb093f38f163af7d3c03e182fc554e (diff)
llvmpipe: Arithmetic helpers.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_bld_arit.h')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_arit.h113
1 files changed, 113 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.h b/src/gallium/drivers/llvmpipe/lp_bld_arit.h
new file mode 100644
index 0000000000..0d2636aed9
--- /dev/null
+++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.h
@@ -0,0 +1,113 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef LP_BLD_ARIT_H
+#define LP_BLD_ARIT_H
+
+
+#include <llvm-c/Core.h>
+
+
+#define LP_MAX_VECTOR_SIZE 16
+
+
+/*
+ * Constants
+ */
+
+LLVMValueRef
+lp_build_const_aos(LLVMTypeRef type,
+ double r, double g, double b, double a,
+ const unsigned char *swizzle);
+
+/*
+ * Basic arithmetic
+ */
+
+LLVMValueRef
+lp_build_add(LLVMBuilderRef builder,
+ LLVMValueRef a,
+ LLVMValueRef b,
+ LLVMValueRef zero);
+
+LLVMValueRef
+lp_build_sub(LLVMBuilderRef builder,
+ LLVMValueRef a,
+ LLVMValueRef b,
+ LLVMValueRef zero);
+
+LLVMValueRef
+lp_build_mul(LLVMBuilderRef builder,
+ LLVMValueRef a,
+ LLVMValueRef b,
+ LLVMValueRef zero,
+ LLVMValueRef one);
+
+LLVMValueRef
+lp_build_min(LLVMBuilderRef builder,
+ LLVMValueRef a,
+ LLVMValueRef b);
+
+LLVMValueRef
+lp_build_max(LLVMBuilderRef builder,
+ LLVMValueRef a,
+ LLVMValueRef b);
+
+/*
+ * Satured arithmetic
+ */
+
+LLVMValueRef
+lp_build_add_sat(LLVMBuilderRef builder,
+ LLVMValueRef a,
+ LLVMValueRef b,
+ LLVMValueRef zero,
+ LLVMValueRef one);
+
+LLVMValueRef
+lp_build_sub_sat(LLVMBuilderRef builder,
+ LLVMValueRef a,
+ LLVMValueRef b,
+ LLVMValueRef zero,
+ LLVMValueRef one);
+
+LLVMValueRef
+lp_build_min_sat(LLVMBuilderRef builder,
+ LLVMValueRef a,
+ LLVMValueRef b,
+ LLVMValueRef zero,
+ LLVMValueRef one);
+
+LLVMValueRef
+lp_build_max_sat(LLVMBuilderRef builder,
+ LLVMValueRef a,
+ LLVMValueRef b,
+ LLVMValueRef zero,
+ LLVMValueRef one);
+
+
+#endif /* !LP_BLD_ARIT_H */