Added
Link Here
|
1 |
https://gitlab.freedesktop.org/mesa/mesa/commit/dded2edf8bed |
2 |
|
3 |
--- src/gallium/auxiliary/gallivm/lp_bld_arit.c.orig 2019-01-17 11:26:22 UTC |
4 |
+++ src/gallium/auxiliary/gallivm/lp_bld_arit.c |
5 |
@@ -555,6 +555,12 @@ lp_build_add(struct lp_build_context *bld, |
6 |
return bld->one; |
7 |
|
8 |
if (!type.floating && !type.fixed) { |
9 |
+ if (HAVE_LLVM >= 0x0900) { |
10 |
+ char intrin[32]; |
11 |
+ intrinsic = type.sign ? "llvm.sadd.sat" : "llvm.uadd.sat"; |
12 |
+ lp_format_intrinsic(intrin, sizeof intrin, intrinsic, bld->vec_type); |
13 |
+ return lp_build_intrinsic_binary(builder, intrin, bld->vec_type, a, b); |
14 |
+ } |
15 |
if (type.width * type.length == 128) { |
16 |
if (util_cpu_caps.has_sse2) { |
17 |
if (type.width == 8) |
18 |
@@ -625,6 +631,7 @@ lp_build_add(struct lp_build_context *bld, |
19 |
* NOTE: cmp/select does sext/trunc of the mask. Does not seem to |
20 |
* interfere with llvm's ability to recognize the pattern but seems |
21 |
* a bit brittle. |
22 |
+ * NOTE: llvm 9+ always uses (non arch specific) intrinsic. |
23 |
*/ |
24 |
LLVMValueRef overflowed = lp_build_cmp(bld, PIPE_FUNC_GREATER, a, res); |
25 |
res = lp_build_select(bld, overflowed, |
26 |
@@ -876,6 +883,12 @@ lp_build_sub(struct lp_build_context *bld, |
27 |
return bld->zero; |
28 |
|
29 |
if (!type.floating && !type.fixed) { |
30 |
+ if (HAVE_LLVM >= 0x0900) { |
31 |
+ char intrin[32]; |
32 |
+ intrinsic = type.sign ? "llvm.ssub.sat" : "llvm.usub.sat"; |
33 |
+ lp_format_intrinsic(intrin, sizeof intrin, intrinsic, bld->vec_type); |
34 |
+ return lp_build_intrinsic_binary(builder, intrin, bld->vec_type, a, b); |
35 |
+ } |
36 |
if (type.width * type.length == 128) { |
37 |
if (util_cpu_caps.has_sse2) { |
38 |
if (type.width == 8) |
39 |
@@ -925,6 +938,7 @@ lp_build_sub(struct lp_build_context *bld, |
40 |
* NOTE: cmp/select does sext/trunc of the mask. Does not seem to |
41 |
* interfere with llvm's ability to recognize the pattern but seems |
42 |
* a bit brittle. |
43 |
+ * NOTE: llvm 9+ always uses (non arch specific) intrinsic. |
44 |
*/ |
45 |
LLVMValueRef no_ov = lp_build_cmp(bld, PIPE_FUNC_GREATER, a, b); |
46 |
a = lp_build_select(bld, no_ov, a, b); |