• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**************************************************************************
2  *
3  * Copyright 2009 VMware, Inc.
4  * All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sub license, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice (including the
15  * next paragraph) shall be included in all copies or substantial portions
16  * of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21  * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  *
26  **************************************************************************/
27 
28 /**
29  * @file
30  * Helper functions for logical operations.
31  *
32  * @author Jose Fonseca <jfonseca@vmware.com>
33  */
34 
35 
36 #ifndef LP_BLD_LOGIC_H
37 #define LP_BLD_LOGIC_H
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 #include "gallivm/lp_bld.h"
44 
45 #include "pipe/p_defines.h" /* For PIPE_FUNC_xxx */
46 
47 
48 struct lp_type;
49 struct lp_build_context;
50 
51 
52 LLVMValueRef
53 lp_build_compare(struct gallivm_state *gallivm,
54                  const struct lp_type type,
55                  unsigned func,
56                  LLVMValueRef a,
57                  LLVMValueRef b);
58 
59 
60 /**
61  * @param func is one of PIPE_FUNC_xxx
62  */
63 LLVMValueRef
64 lp_build_cmp(struct lp_build_context *bld,
65              unsigned func,
66              LLVMValueRef a,
67              LLVMValueRef b);
68 
69 LLVMValueRef
70 lp_build_cmp_ordered(struct lp_build_context *bld,
71                      unsigned func,
72                      LLVMValueRef a,
73                      LLVMValueRef b);
74 
75 LLVMValueRef
76 lp_build_select_bitwise(struct lp_build_context *bld,
77                         LLVMValueRef mask,
78                         LLVMValueRef a,
79                         LLVMValueRef b);
80 
81 LLVMValueRef
82 lp_build_select(struct lp_build_context *bld,
83                 LLVMValueRef mask,
84                 LLVMValueRef a,
85                 LLVMValueRef b);
86 
87 LLVMValueRef
88 lp_build_select_aos(struct lp_build_context *bld,
89                     unsigned mask,
90                     LLVMValueRef a,
91                     LLVMValueRef b,
92                     unsigned num_channels);
93 
94 
95 LLVMValueRef
96 lp_build_any_true_range(struct lp_build_context *bld,
97                         unsigned real_length,
98                         LLVMValueRef val);
99 
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 #endif /* !LP_BLD_LOGIC_H */
105