projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
086c885
)
nir: fix interger divide by zero crash during constant folding
author
Timothy Arceri
<tarceri@itsqueeze.com>
Wed, 28 Feb 2018 03:33:55 +0000
(14:33 +1100)
committer
Timothy Arceri
<tarceri@itsqueeze.com>
Wed, 28 Feb 2018 04:55:39 +0000
(15:55 +1100)
From the GLSL 4.60 spec Section 5.9 (Expressions):
"Dividing by zero does not cause an exception but does result in
an unspecified value."
Fixes: 89285e4d47a6 "nir: add new constant folding infrastructure"
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105271
src/compiler/nir/nir_opcodes.py
patch
|
blob
|
history
diff --git
a/src/compiler/nir/nir_opcodes.py
b/src/compiler/nir/nir_opcodes.py
index 278562b2bd1172dd4f2581e483fd874591245a5a..97da4db28f16b789c33077a701bc24e970cebfbc 100644
(file)
--- a/
src/compiler/nir/nir_opcodes.py
+++ b/
src/compiler/nir/nir_opcodes.py
@@
-404,8
+404,8
@@
binop("umul_high", tuint32, commutative,
"(uint32_t)(((uint64_t) src0 * (uint64_t) src1) >> 32)")
binop("fdiv", tfloat, "", "src0 / src1")
-binop("idiv", tint, "", "src
0 / src1
")
-binop("udiv", tuint, "", "src
0 / src1
")
+binop("idiv", tint, "", "src
1 == 0 ? 0 : (src0 / src1)
")
+binop("udiv", tuint, "", "src
1 == 0 ? 0 : (src0 / src1)
")
# returns a boolean representing the carry resulting from the addition of
# the two unsigned arguments.