Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std::remainder(x,y) and std::remquo(x, y, z) are not optimized at the compilation time when (x, y) is constant #99497

Closed
k-arrows opened this issue Jul 18, 2024 · 0 comments · Fixed by #99647

Comments

@k-arrows
Copy link

Consider the following example.
https://godbolt.org/z/94qo7q4vd

#include <cmath>

double f1() 
{
  return std::fmod(-5.0, 3.0);
}

double f2() 
{
  return std::remainder(-5.0, 3.0);
}

double f3()
{
  int quo;
  return std::remquo(-5.0, 3.0, &quo);
}

The above f2() is optimized when -ffast-math is enabled.

@dtcxzyw dtcxzyw self-assigned this Jul 18, 2024
dtcxzyw added a commit that referenced this issue Jul 18, 2024
dtcxzyw added a commit that referenced this issue Jul 19, 2024
This patch adds basic support for `remquo`. Constant folding support
will be submitted in a subsequent patch.

Related issue: #99497
Harini0924 pushed a commit to Harini0924/llvm-project that referenced this issue Jul 22, 2024
sgundapa pushed a commit to sgundapa/upstream_effort that referenced this issue Jul 23, 2024
sgundapa pushed a commit to sgundapa/upstream_effort that referenced this issue Jul 23, 2024
This patch adds basic support for `remquo`. Constant folding support
will be submitted in a subsequent patch.

Related issue: llvm#99497
yuxuanchen1997 pushed a commit that referenced this issue Jul 25, 2024
Summary:
Fixes one of the issues in
#99497.

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60250797
yuxuanchen1997 pushed a commit that referenced this issue Jul 25, 2024
Summary:
This patch adds basic support for `remquo`. Constant folding support
will be submitted in a subsequent patch.

Related issue: #99497

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60251721
yuxuanchen1997 pushed a commit that referenced this issue Jul 25, 2024
Summary:
This patch adds constant folding support for `remquo`.
Reference: https://en.cppreference.com/w/cpp/numeric/math/remquo

Closes #99497.

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60250753
Harini0924 pushed a commit to Harini0924/llvm-project that referenced this issue Aug 1, 2024
This patch adds constant folding support for `remquo`.
Reference: https://en.cppreference.com/w/cpp/numeric/math/remquo

Closes llvm#99497.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants