]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Use ix86_fp_comparison_operator in cbranchbf4 to avoid ICE.
authorliuhongt <hongtao.liu@intel.com>
Tue, 18 Mar 2025 05:47:11 +0000 (22:47 -0700)
committerliuhongt <hongtao.liu@intel.com>
Thu, 20 Mar 2025 06:33:34 +0000 (23:33 -0700)
*jcc only supports ix86_fp_comparison_operator for CCFP, when
comparison code is LT, there's an ICE. W/o AVX10.2, it's ok since
do_compare_rtx_and_jump will transform LT to GT, but w/ AVX10.2 it
goes directly into ix86_expand_branch which doesn't handle it.

Use ix86_fp_comparison_operator in cbranchbf4.

gcc/ChangeLog:

PR target/117452
* config/i386/i386.md (cbranchbf4): Use
ix86_fp_comparison_operator instead of comparison_operator.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr117452.c: New test.

gcc/config/i386/i386.md
gcc/testsuite/gcc.target/i386/pr117452.c [new file with mode: 0644]

index b1cd52382a80f487f1faaac49f822c133c923521..8c7beafd758e87f3928e4ab59958eb06d821be50 100644 (file)
        (compare:CC (match_operand:BF 1 "cmp_fp_expander_operand")
                    (match_operand:BF 2 "cmp_fp_expander_operand")))
    (set (pc) (if_then_else
-             (match_operator 0 "comparison_operator"
+             (match_operator 0 "ix86_fp_comparison_operator"
               [(reg:CC FLAGS_REG)
                (const_int 0)])
              (label_ref (match_operand 3))
diff --git a/gcc/testsuite/gcc.target/i386/pr117452.c b/gcc/testsuite/gcc.target/i386/pr117452.c
new file mode 100644 (file)
index 0000000..4042b4f
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-march=x86-64-v3 -mavx10.2 -Ofast" } */
+
+__bf16 b;
+int x;
+
+void
+foo ()
+{
+  if (x < b)
+    x = 0;
+}