Bastiaan Braams via Gcc-bugs <gcc-bugs@gcc.gnu.org> writes:

> Dear bug-gcc Group,
>
> This concerns gcc (gfortran) 14.2.1 on an x86_64 Red Hat Linux
> system. I am using the ieee_next_after function from the (intrinsic)
> ieee_arithmetic module in an inner loop and I noticed that it takes
> very much CPU time. It seems unreasonable to me and so I am reporting
> it as a bug.

Please file a bug in https://gcc.gnu.org/bugzilla

Taking a look at your test case nearly all the time seems to be spent in
changing the FPU state through ieee_procedure_entry/exit.

The call to do unfortunately is not moved out of your loop.

The actual next_after function is fairly cheap (< 2%)

    30.04%  a.out    libgfortran.so.5.0.0  [.] 0x0000000000009623
                |
                            |--15.11%--_gfortran_ieee_procedure_entry@plt
                                        |          MAIN__
                                                    |
                                                                 
--14.93%--_gfortran_ieee_procedure_exit@plt
                                                                                
        MAIN__

    17.08%  a.out    libgfortran.so.5.0.0  [.] 0x0000000000009616
                |
                            |--8.76%--_gfortran_ieee_procedure_entry@plt
                                        |          MAIN__
                                                    |
                                                                 
--8.32%--_gfortran_ieee_procedure_exit@plt
                                                                                
        MAIN__

    13.92%  a.out    libgfortran.so.5.0.0  [.] 0x0000000000009764
                |
                            ---0x7f1929809760
                                           _gfortran_ieee_procedure_exit
                                                          MAIN__

     8.90%  a.out    libgfortran.so.5.0.0  [.] 0x0000000000009754
                 |
                             ---0x7f1929809750
                                            _gfortran_ieee_procedure_entry
                                                           MAIN__

     5.61%  a.out    libgfortran.so.5.0.0  [.] 0x0000000000009627
                 |
                             |--2.86%--_gfortran_ieee_procedure_exit@plt
                                         |          MAIN__
                                                     |
                                                                  
--2.75%--_gfortran_ieee_procedure_entry@plt
                                                                                
         MAIN__

...


   1.14%  a.out    libm.so.6             [.] nextafterf32x
               |
                           ---nextafter@plt
                                          MAIN__

-Andi

Reply via email to