)]}'
{
  "commit": "d6b210bc7f9f13be241cf6e16bc39e4885c45a2e",
  "tree": "9538a5f425351057938fe0cb93a47435171ad3af",
  "parents": [
    "9c049f4eb807b46397e6f33b0a7fd8a06b5e2e54"
  ],
  "author": {
    "name": "Jakub Jelinek",
    "email": "jakub@redhat.com",
    "time": "Thu Dec 04 12:17:45 2025 +0100"
  },
  "committer": {
    "name": "Jakub Jelinek",
    "email": "jakub@gcc.gnu.org",
    "time": "Mon Dec 08 08:07:49 2025 +0100"
  },
  "message": "i386: Fix crc_rev\u003cSWI124:mode\u003esi4 expander [PR122991]\n\nThe following testcase ICEs on x86_64, because the crc_rev_optab expander\nassumes the last operand will be a CONST_INT.  That assumption comes from\nit being created with\n  rtx polynomial;\n  if (TREE_CODE (rhs3) !\u003d INTEGER_CST)\n    {\n      error (\"third argument to %\u003ccrc%\u003e builtins must be a constant\");\n      polynomial \u003d const0_rtx;\n    }\n  else\n    polynomial \u003d convert_to_mode (TYPE_MODE (result_type), expand_normal (rhs3), 0);\nand so it doesn\u0027t bother adding a predicate for it.\nExcept that maybe_legitimize_operands which expand_insn calls has:\n         This avoids duplicate rtl and ensures that tied operands\n         remain tied.\n\n         This search is linear, but NOPS is bounded at compile time\n         to a small number (current a single digit).  */\n      unsigned int j \u003d 0;\n      for (; j \u003c i; ++j)\n        if (can_reuse_operands_p (icode, opno + j, opno + i, \u0026ops[j], \u0026ops[i])\n            \u0026\u0026 rtx_equal_p (orig_values[j], orig_values[i])\n            \u0026\u0026 ops[j].value\n            \u0026\u0026 insn_operand_matches (icode, opno + i, ops[j].value))\n          {\n            ops[i].value \u003d copy_rtx (ops[j].value);\n            break;\n          }\nin it, so if one of the earlier operands has equal original value to the\npolynomial argument, but has a predicate like register_operand or\nnonimmediate_operand, the earlier iteration forced that value into a pseudo\nand when the last operand doesn\u0027t have a predicate, this happily reuses that\npseudo as the last operand.  And then it either with RTL checking fails on\nINTVAL use on that operand, or without rtl checking ICEs during expansion of\nthe insn e.g. using table lookup.\n\nThe following patch fixes it by using const_int_operand predicate for it.\nThat is what loongarch and riscv backends use for it too.  Aarch64 doesn\u0027t\nand I\u0027ll send a fix for that once tested on aarch64-linux.\n\n2025-12-04  Jakub Jelinek  \u003cjakub@redhat.com\u003e\n\n\tPR target/122991\n\t* gcc.dg/pr122991.c: New test.\n\n(cherry picked from commit 37062ea54ad571a4ea1be0d9d65d0ddd4008e118)\n",
  "tree_diff": [
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "6b27a2dbebcc00196858d837248e02c20acab1a6",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gcc.dg/pr122991.c"
    }
  ]
}
