> 在 2016年12月22日,23:31,Richard Sandiford <rdsandif...@googlemail.com> 写道: > > Matthew Fortune <matthew.fort...@imgtec.com> writes: >> Sandra Loosemore <san...@codesourcery.com> writes: >>> On 12/21/2016 11:54 AM, Yunqiang Su wrote: >>>> By this patch, I add a build-time option ` --with-unfused-madd4=yes/no', >>>> and runtime option -m(no-)unfused-madd4, >>>> to disable generate madd.fmt instructions. >>> >>> Your patch also needs a documentation change so that the new >>> command-line option is listed in the GCC manual with other MIPS target >>> options. >> >> Any opinions on option names to control this? Is it best to target the >> specific >> feature that is non-compliant on loongson or apply a general -mfix-loongson >> type option? >> >> I'm not sure I have a strong opinion either way but there do seem to be >> multiple possible variants. > > Wasn't sure from this thread whether Loongson simply had a fused > implementation (without intermediate rounding) or whether the
I test some cases on Loongson 3A 1000 with glibc’s test: math/test-double. -march=mips64r2 1. set ISA_HAS_FUSED_MADD4 1 set ISA_HAS_UNFUSED_MADD4 0 56 errors occurred, which is the same with amd64 with avx2 enabled. 2. set ISA_HAS_FUSED_MADD4 0 set ISA_HAS_UNFUSED_MADD4 0 no error happens 3. set ISA_HAS_FUSED_MADD4 0 set ISA_HAS_UNFUSED_MADD4 1 816 errors occurred. So it seems Loongson’s madd.fmt is are fused. > instructions gave numerically incorrect results for some inputs. > It sounds from a later thread like it's generating incorrect results, > is that right? If so, then FWIW I agree an -mfix option would be more > consistent. E.g. one of the -mfix-vr4120 errata was an incorrect > integer division result and one of the -mfix-sb1 errata was an incorrect > single-precision float division result. The latter case could have been > handled by an option to disable DIV.S and DIV.PS, but the -mfix option > gave more control. > > If instead the problem is that the instructions are fused then that's > also what the original MIPS 4 parts did, so maybe an option to control > fusedness would make sense. Since for binary Linux distributions, like Debian, we need to generate generic output, we will need an option to disable madd.fmt at all. Besides this, should we have another options, like -mmadd-is-fused -mno-madd-is-fused ? Ohh, maybe we should have options like these? build-time —with-madd=fused/unfused/no runtime -mmadd=fused/unfused/no > > Thanks, > Richard