https://gcc.gnu.org/g:d8824c3e727cc5b95a2002a40b69e889a899f8e9

commit r17-5383-gd8824c3e727cc5b95a2002a40b69e889a899f8e9
Author: Max Filippov <[email protected]>
Date:   Mon Oct 19 16:17:16 2026 -0700

    xtensa: fix ICE when using double FP constants with -mauto-litpools
    
    The commit r17-5310-g3c12f578a930 used condition
    
      FP_REG_P (REGNO (operands[0])) || CONSTANT_P (operands[1])
    
    to select subset of alternatives that don't need splitting, specifically
    targeting `[D, Gz]` and `[a, Gz]`. Unfortunately it also matches
    `[a, Y]` when -mauto-litpools is used, resulting in the following kind
    of ICE:
    
    internal compiler error: output_operand: floating constant misused
        6 | }
          | ^
    0x2116a1c internal_error(char const*, ...)
            gcc/diagnostic-global-context.cc:787
    0xc15633 output_operand_lossage(char const*, ...)
            gcc/final.cc:3191
    0xc157c1 output_operand(rtx_def*, int)
            gcc/final.cc:3648
    0xc162f8 output_asm_insn(char const*, rtx_def**)
            gcc/final.cc:3560
    0xc197e8 output_asm_insn(char const*, rtx_def**)
            gcc/final.cc:3426
    0xc197e8 final_scan_insn_1
            gcc/final.cc:2848
    0xc19b3b final_scan_insn(rtx_insn*, _IO_FILE*, int, int, int*)
            gcc/final.cc:2894
    0xc19d67 final_1
            gcc/final.cc:1976
    0xc1a854 rest_of_handle_final
            gcc/final.cc:4257
    0xc1a854 execute
            gcc/final.cc:4335
    
    Fix that by using `satisfies_constraint_Gz (operands[1])` instead of
    `CONSTANT_P (operands[1])` in the above condition.
    
    gcc/
            * config/xtensa/xtensa.md (movdf_internal): Fix condition when
            splitting is not performed.  Replace output patterns for
            alternatives that must be split with '#' for better diagnostic.

Diff:
---
 gcc/config/xtensa/xtensa.md | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
index af71c929d0e7..ad1b8d89a127 100644
--- a/gcc/config/xtensa/xtensa.md
+++ b/gcc/config/xtensa/xtensa.md
@@ -1663,18 +1663,19 @@
      [f,  f; farith, 3] mov.d\t%0, %1
      [f,  U; fload , 3] %v1ldi\t%0, %1
      [U,  f; fstore, 3] %v0sdi\t%1, %0
-     [a,  r; move  , 6] df-move-a-from-r\t%0, %1
-     [a,  Y; load  , 6] df-load-a-from-Y\t%0, %1
-     [a,  T; load  , 6] df-load-a-from-T\t%0, %1
-     [a,  U; load  , 6] df-load-a-from-U\t%0, %1
-     [U,  r; store , 6] df-store-r-to-U\t%0, %1
+     [a,  r; move  , 6] #
+     [a,  Y; load  , 6] ^
+     [a,  T; load  , 6] ^
+     [a,  U; load  , 6] ^
+     [U,  r; store , 6] ^
   }
   "&& reload_completed"
   [(set (match_dup 0) (match_dup 2))
    (set (match_dup 1) (match_dup 3))]
 {
   if ((register_operand (operands[0], DFmode)
-       && (FP_REG_P (REGNO (operands[0])) || CONSTANT_P (operands[1])))
+       && (FP_REG_P (REGNO (operands[0]))
+          || satisfies_constraint_Gz (operands[1])))
       || (register_operand (operands[1], DFmode)
          && FP_REG_P (REGNO (operands[1]))))
     FAIL;

Reply via email to