mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 07:10:15 +01:00
gallivm: add integer and unsigned mod arit functions. (v2)
use a single entry point, as per Jose's suggestion. Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
c3e3df9b18
commit
4ffc8b9ae4
2 changed files with 25 additions and 0 deletions
|
|
@ -2555,3 +2555,23 @@ lp_build_ilog2(struct lp_build_context *bld,
|
|||
|
||||
return ipart;
|
||||
}
|
||||
|
||||
LLVMValueRef
|
||||
lp_build_mod(struct lp_build_context *bld,
|
||||
LLVMValueRef x,
|
||||
LLVMValueRef y)
|
||||
{
|
||||
LLVMBuilderRef builder = bld->gallivm->builder;
|
||||
LLVMValueRef res;
|
||||
const struct lp_type type = bld->type;
|
||||
|
||||
assert(type.floating);
|
||||
assert(lp_check_value(type, x));
|
||||
assert(lp_check_value(type, y));
|
||||
|
||||
if (type.sign)
|
||||
res = LLVMBuildSRem(builder, x, y, "");
|
||||
else
|
||||
res = LLVMBuildURem(builder, x, y, "");
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,4 +249,9 @@ lp_build_log2_approx(struct lp_build_context *bld,
|
|||
LLVMValueRef *p_floor_log2,
|
||||
LLVMValueRef *p_log2);
|
||||
|
||||
LLVMValueRef
|
||||
lp_build_mod(struct lp_build_context *bld,
|
||||
LLVMValueRef x,
|
||||
LLVMValueRef y);
|
||||
|
||||
#endif /* !LP_BLD_ARIT_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue