Skip to content

clang is suboptimal for x / sqrt(y / z) with fast-math #76605

@k-arrows

Description

@k-arrows

Test case:
https://godbolt.org/z/joGE9G4KM

#include<math.h>

double test_sqrt1(double x, double y, double z) { 
  return x / sqrt(y / z); 
}

double test_sqrt2(double x, double y, double z) { 
  return x * sqrt(z / y); 
}

My expectation is that the output of test_sqrt1 will be the same as test_sqrt2. The same transformatin is true not only for sqrt but also for cbrt.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions