> I have run into a strange issue on alpha that I'm still tracking down. > I fear this has interrupted me too long to get 5.22 in for OpenBSD 5.9, > but maybe we can get ahead of the curve and be ready after unlock. > > Previously, NaN + 1 looked like this: > $ perl -we 'print "NaN" + 1' > -nan > > Due to improvements in the Inf/NaN code, 5.22 should get: > $ perl -we 'print "NaN" + 1' > NaN > > But for some reason on alpha NaN isn't special and we instead get: > $ ./perl -we 'print "NaN" + 1' > 1
You might want to try this compiler diff on alpha. When compiling with optimization enabled and ieee-style floating point, the compiler tries to insert asynchronous fpu trap synchronization barriers as late as possible. Unfortunately, the logic does not take into account the store of a floating-point result into memory as something requiring a barrier, which leads to incorrect behaviour on alpha processors without the ``precise arithmetic trap'' extension. Index: alpha.c =================================================================== RCS file: /OpenBSD/src/gnu/gcc/gcc/config/alpha/alpha.c,v retrieving revision 1.4 diff -u -p -r1.4 alpha.c --- alpha.c 20 Dec 2012 13:58:06 -0000 1.4 +++ alpha.c 17 Jan 2016 19:42:44 -0000 @@ -8721,11 +8721,15 @@ summarize_insn (rtx x, struct shadow_sum result of an instruction that might generate an UNPREDICTABLE result. - (c) Within the trap shadow, no register may be used more than once + (c) Within the trap shadow, the destination register of the potentially + trapping instruction may not be used as an input, for its value would be + UNPREDICTABLE. + + (d) Within the trap shadow, no register may be used more than once as a destination register. (This is to make life easier for the trap-handler.) - (d) The trap shadow may not include any branch instructions. */ + (e) The trap shadow may not include any branch instructions. */ static void alpha_handle_trap_shadows (void) @@ -8797,7 +8801,7 @@ alpha_handle_trap_shadows (void) if ((sum.defd.i & shadow.defd.i) || (sum.defd.fp & shadow.defd.fp)) { - /* (c) would be violated */ + /* (d) would be violated */ goto close_shadow; } @@ -8820,11 +8824,19 @@ alpha_handle_trap_shadows (void) goto close_shadow; } + + if ((sum.used.i & shadow.defd.i) + || (sum.used.fp & shadow.defd.fp)) + { + /* (c) would be violated */ + goto close_shadow; + } break; case JUMP_INSN: case CALL_INSN: case CODE_LABEL: + /* (e) would be violated */ goto close_shadow; default: