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

[InstCombine] Commuted pattern is not handled #121786

Open
dtcxzyw opened this issue Jan 6, 2025 · 0 comments · May be fixed by #121958
Open

[InstCombine] Commuted pattern is not handled #121786

dtcxzyw opened this issue Jan 6, 2025 · 0 comments · May be fixed by #121958

Comments

@dtcxzyw
Copy link
Member

dtcxzyw commented Jan 6, 2025

https://godbolt.org/z/Wfqeo3rhK

define double @t1(i32 %x) {
  %cmp = icmp sgt i32 %x, 2
  %cst = sitofp i32 %x to double
  %sel = select i1 %cmp, double %cst, double 2.000000e+00
  ret double %sel
}

define double @t2(i32 %x) {
  %cmp = icmp sle i32 %x, 2
  %cst = sitofp i32 %x to double
  %sel = select i1 %cmp, double 2.000000e+00, double %cst
  ret double %sel
}
define double @t1(i32 %x) {
  %sel1 = call i32 @llvm.smax.i32(i32 %x, i32 2)
  %sel = uitofp nneg i32 %sel1 to double
  ret double %sel
}

define double @t2(i32 %x) {
  %cmp = icmp slt i32 %x, 3
  %cst = sitofp i32 %x to double
  %sel = select i1 %cmp, double 2.000000e+00, double %cst
  ret double %sel
}
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.

1 participant