On 06/24/2014 09:52 AM, Al Viro wrote: > unsigned long __attribute__((noinline)) f(double x) > { > return (unsigned long)x; // SVCTQ/SVC > } > > main() > { > unsigned long x; > extern unsigned long __ieee_get_fp_control(void); > printf("before:%lx\n", __ieee_get_fp_control()); > x = f(1ULL<<63); > printf("after:%lx\n", __ieee_get_fp_control()); > printf("result:%lx\n", x); > } > > On actual hardware: > before:0 > after:20000 > result:8000000000000000 > > On qemu: > before:0 > after:0 > result:8000000000000000 > > > IOW, gen_fcvttq() is also affected, not only gen_fp_exc_raise().
Clearly a gross misunderstanding of what bits are actually computed, never mind what gets signaled. Thanks for the test. I've not had working hardware for a couple of years to validate what's supposed to get set and what isn't. > Can't we simply have separate helpers for various trap suffices, with > all this work on getting exc, etc. taken inside them? It's not as if > we distinguished many variants, after all... Right now we have: > plain, /U, /V > /S, /SU > /SUI > /SV > /SVI We used to have separate helpers... at least for the modes that had been implemented at the time. The combinatorial explosion ugly though -- 4 different versions of add, sub, etc. I thought the partial inlining was a decent solution, as far as maintainability, but it's not unreasonable to disagree. > Another thing: shouldn't arithmetics on denorms without /S raise EXC_M_INV, > rather than EXC_M_UNF? No idea. Should they? r~