[llvm] [InstCombine] Generalize fold of `fcmp + copysign` (PR #86387)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 11 06:48:03 PDT 2024


================
@@ -596,8 +596,8 @@ define i1 @is_signbit_set(double %x) {
 
 define i1 @is_signbit_set_1(double %x) {
 ; CHECK-LABEL: @is_signbit_set_1(
-; CHECK-NEXT:    [[S:%.*]] = call double @llvm.copysign.f64(double 1.000000e+00, double [[X:%.*]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp ult double [[S]], 0.000000e+00
+; CHECK-NEXT:    [[TMP1:%.*]] = bitcast double [[X:%.*]] to i64
+; CHECK-NEXT:    [[R:%.*]] = icmp slt i64 [[TMP1]], 0
----------------
dtcxzyw wrote:

Should we introduce a new intrinsic `i1 @llvm.signbit`?


https://github.com/llvm/llvm-project/pull/86387


More information about the llvm-commits mailing list