summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorJose Fonseca <[email protected]>2016-04-01 11:51:27 +0100
committerJose Fonseca <[email protected]>2016-04-03 22:09:09 +0100
commita293f57e1357e6affa319cd07199b457c0aead47 (patch)
treea9551a945723531980934c5f36c4e9b5f476e161 /src/gallium
parente4f01da15d8c6ce3e8c77ff3ff3d2ce2574a3f7b (diff)
gallivm: Use llvm.fabs.
Exactly the same code. Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_arit.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index 12777436d7c..587c83acfa0 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -1492,14 +1492,9 @@ lp_build_abs(struct lp_build_context *bld,
return a;
if(type.floating) {
- /* Mask out the sign bit */
- LLVMTypeRef int_vec_type = lp_build_int_vec_type(bld->gallivm, type);
- unsigned long long absMask = ~(1ULL << (type.width - 1));
- LLVMValueRef mask = lp_build_const_int_vec(bld->gallivm, type, ((unsigned long long) absMask));
- a = LLVMBuildBitCast(builder, a, int_vec_type, "");
- a = LLVMBuildAnd(builder, a, mask, "");
- a = LLVMBuildBitCast(builder, a, vec_type, "");
- return a;
+ char intrinsic[32];
+ util_snprintf(intrinsic, sizeof intrinsic, "llvm.fabs.v%uf%u", type.length, type.width);
+ return lp_build_intrinsic_unary(builder, intrinsic, vec_type, a);
}
if(type.width*type.length == 128 && util_cpu_caps.has_ssse3) {