Hi! On Mon, Sep 06, 2021 at 04:59:27PM +0800, Xionghu Luo wrote: > On 2021/9/4 05:44, Segher Boessenkool wrote: > >>+/* { dg-final { scan-assembler-not {\mbl fmod\M} } } */ > >>+/* { dg-final { scan-assembler-not {\mbl fmodf\M} } } */ > >>+/* { dg-final { scan-assembler-not {\mbl remainder\M} } } */ > >>+/* { dg-final { scan-assembler-not {\mbl remainderf\M} } } */ > > > >These are negative tests, so won't spuriously fail, but this does not > >test for the function prefixes we can have. See > >gcc.target/powerpc/builtins-1.c for example. > > Thanks. Verified that different calls are generated on different platforms > without this patch. > > P8BE-64: bl __fmodf_finite > P8BE-32: b __fmodf_finite > P8LE-64: bl fmodf
Ah, it won't use the "dot-names" here, okay. I think for Darwin you need to allow a single underscore, but you'll find out (or Iain will, most likely ;-) ) > "l", "__" and "_finite" are optional, so is it OK to check them with below > patterns? > > +/* { dg-final { scan-assembler-not {\mbl? (__)?fmod(_finite)?\M} } } */ > +/* { dg-final { scan-assembler-not {\mbl? (__)?fmodf(_finite)?\M} } } */ > +/* { dg-final { scan-assembler-not {\mbl? (__)?remainder(_finite)?\M} } } > */ > +/* { dg-final { scan-assembler-not {\mbl? (__)?remainderf(_finite)?\M} } } > */ You could even do /* { dg-final { scan-assembler-not {(?n)\mb.*fmod} } } */ /* { dg-final { scan-assembler-not {(?n)\mb.*remainder} } } */ or even /* { dg-final { scan-assembler-not {fmod} } } */ /* { dg-final { scan-assembler-not {remainder} } } */ (and the testcase name will not accidentally match either of those REs either, I checked :-) ) And yeah, on some subtargets the calls will be tail-optimised, good find. You can get around that (in general, on any target) by doing float test1 (float x, float y) { float z = fmodf (x, y); asm (""); // to prevent tail calls return z; } but what you do is fine as well, and much more elegant. Please pick (and test ;-) ) whichever option you like best. Thanks! Segher