[PATCH] D90218: Fix PR47973: Addressing integer division edge case with INT_MIN
Serge Pavlov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 9 23:06:07 PST 2020
sepavloff added inline comments.
================
Comment at: compiler-rt/lib/builtins/int_div_impl.inc:77
+ fixint_t s_b = b >> N; // s_b = b < 0 ? -1 : 0
+ fixuint_t a_u = (fixuint_t)(a ^ s_a) + (-s_a); // negate if s_a == -1
+ fixuint_t b_u = (fixuint_t)(b ^ s_b) + (-s_b); // negate if s_b == -1
----------------
What is the purpose of using addition+negation instead of subtraction?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90218/new/
https://reviews.llvm.org/D90218
More information about the llvm-commits
mailing list