> On Jun 25, 2020, at 1:37 PM, Richard Henderson <richard.hender...@linaro.org> > wrote: > > On 6/25/20 10:00 AM, Lijun Pan wrote: >> +#define VDIV_MOD_DO(name, op, element, sign, bit) \ >> + void helper_v##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ >> + { \ >> + int i; \ >> + \ >> + \ >> + for (i = 0; i < ARRAY_SIZE(r->element); i++) { \ >> + if (unlikely((b->element[i] == 0) || \ >> + (sign && \ >> + (b->element[i] == UINT##bit##_MAX) && \ >> + (a->element[i] == INT##bit##_MIN)))) \ >> + continue; \ >> + r->element[i] = a->element[i] op b->element[i]; \ >> + } \ >> + } > > Missing braces for the if. Extra blank line before the for. No, the braces are enough. "unlikely" is to describe the whole logic, eg. if (unlikely( (divisor == 0) || (sign && (divisor == 0xFFFFFFFF) && (dividend = 0x80000000) ) ) ) I will remove that blank line. > > I see that the ISA document says divide-by-zero produces an undefined result, > so leaving the previous contents does seem to be within the letter of the law. > > However... Are you able to test what real hardware produces? It would be nice > (but not required) to match if it is simple to do so. > > Whichever way we go with the undefined result, this deserves a comment. I will add “continue; / * Undefined, No Special Registers Altered */ " Lijun
- [PATCH v3 1/8] target/ppc: Introduce Power ISA 3.1 flag Lijun Pan
- Re: [PATCH v3 1/8] target/ppc: Introduce Power ISA ... Richard Henderson
- Re: [PATCH v3 1/8] target/ppc: Introduce Power ... Lijun Pan
- Re: [PATCH v3 1/8] target/ppc: Introduce Po... Richard Henderson
- [PATCH v3 4/8] target/ppc: add vmulld instruction Lijun Pan
- Re: [PATCH v3 4/8] target/ppc: add vmulld instructi... Richard Henderson
- Re: [PATCH v3 4/8] target/ppc: add vmulld instr... Lijun Pan
- Re: [PATCH v3 4/8] target/ppc: add vmulld i... Richard Henderson
- [PATCH v3 8/8] target/ppc: add vdiv{su}{wd} vmod{su}{wd}... Lijun Pan
- Re: [PATCH v3 8/8] target/ppc: add vdiv{su}{wd} vmo... Richard Henderson
- Re: [PATCH v3 8/8] target/ppc: add vdiv{su}{wd}... Lijun Pan
- Re: [PATCH v3 8/8] target/ppc: add vdiv{su}... Richard Henderson
- Re: [PATCH v3 8/8] target/ppc: add vdiv... David Gibson
- [PATCH v3 6/8] fix the prototype of muls64/mulu64 Lijun Pan
- Re: [PATCH v3 6/8] fix the prototype of muls64/mulu... Richard Henderson
- [PATCH v3 3/8] target/ppc: convert vmuluwm to tcg_gen_gv... Lijun Pan
- Re: [PATCH v3 3/8] target/ppc: convert vmuluwm to t... Richard Henderson
- [PATCH v3 2/8] target/ppc: add byte-reverse br[dwh] inst... Lijun Pan
- Re: [PATCH v3 2/8] target/ppc: add byte-reverse br[... Richard Henderson
- [PATCH v3 7/8] target/ppc: add vmulh{su}d instructions Lijun Pan