https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67723

            Bug ID: 67723
           Summary: [SH] fsrra/fsca not working with #pragma GCC optimize
                    ("fast-math")
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: olegendo at gcc dot gnu.org
  Target Milestone: ---
            Target: sh*-*-*

When the following code is compiled with "-m4-single -ml -O2 -mfsrra"

#pragma GCC push_options
#pragma GCC optimize("fast-math")

extern "C" float sqrtf (float);

float __attribute__((noinline)) test_00 (float x)
{
  return 1.0f / sqrtf (x);
}

#pragma GCC pop_options
// #pragma GCC reset_options
float __attribute__((noinline)) test_01 (float x)
{
  return 1.0f / sqrtf (x);
}


..the expected outcome is test_00 emitting an fsrra insn and test_01 not. 
However, this is not the case.  This is because fsrra (and fsca) are enabled in
sh_option_override.  Instead they should be enabled in
TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE

Other SH specific options should be checked for this, too.

Reply via email to