[llvm] [InstCombine] Fix FMF propagation in `copysign Mag, (copysign ?, X) -> copysign Mag, X` (PR #121574)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 4 03:37:06 PST 2025
================
@@ -82,14 +82,24 @@ define float @not_known_positive_sign_arg(float %x, float %y) {
define float @copysign_sign_arg(float %x, float %y, float %z) {
; CHECK-LABEL: @copysign_sign_arg(
-; CHECK-NEXT: [[R:%.*]] = call ninf float @llvm.copysign.f32(float [[X:%.*]], float [[Z:%.*]])
+; CHECK-NEXT: [[R:%.*]] = call float @llvm.copysign.f32(float [[X:%.*]], float [[Z:%.*]])
; CHECK-NEXT: ret float [[R]]
;
%s = call reassoc float @llvm.copysign.f32(float %y, float %z)
%r = call ninf float @llvm.copysign.f32(float %x, float %s)
ret float %r
}
+define float @copysign_sign_arg_nnan(float %x, float %y, float %z) {
+; CHECK-LABEL: @copysign_sign_arg_nnan(
+; CHECK-NEXT: [[R:%.*]] = call nnan float @llvm.copysign.f32(float [[X:%.*]], float [[Z:%.*]])
+; CHECK-NEXT: ret float [[R]]
+;
+ %s = call nnan float @llvm.copysign.f32(float %y, float %z)
+ %r = call nnan float @llvm.copysign.f32(float %x, float %s)
+ ret float %r
+}
+
----------------
arsenm wrote:
nsz is probably fine as an or but that's maybe overcomplicating it
https://github.com/llvm/llvm-project/pull/121574
More information about the llvm-commits
mailing list