)]}'
{
  "commit": "c62176c0ea0d8139161ebb82fabfa0a02e493e2e",
  "tree": "7502e90bd420bf9f147d6cc804d912644b372389",
  "parents": [
    "e5912e7dc1e3edb72f43624355a7e363cd76f0b3"
  ],
  "author": {
    "name": "Kyrylo Tkachov",
    "email": "ktkachov@nvidia.com",
    "time": "Thu Jul 30 10:36:40 2026 -0700"
  },
  "committer": {
    "name": "Kyrylo Tkachov",
    "email": "ktkachov@nvidia.com",
    "time": "Tue Aug 04 10:29:02 2026 +0200"
  },
  "message": "aarch64: Add missing CC clobber to max/min-of-add/sub patterns [PR116815]\n\n*aarch64_plus_within_\u003coptab\u003e\u003cmode\u003e3_\u003covf_commutate\u003e and\n*aarch64_minus_within_\u003coptab\u003e\u003cmode\u003e3 split into a flag-setting ADDS or SUBS\nfollowed by a CSEL, but their insn patterns do not say that they write the\ncondition codes.\n\nFor\n\n  unsigned f (unsigned a, unsigned b, unsigned c, unsigned d)\n  {\n    unsigned s \u003d a + b;\n    unsigned m \u003d s \u003e a ? s : a;\n    return (c \u003c d \u0026\u0026 a \u003c b) ? m : d;\n  }\n\ncombine produces\n\n  (parallel [(set (reg:SI 0 x0)\n                  (umax:SI (plus:SI (reg:SI 107) (reg:SI 108))\n                           (reg:SI 107)))\n             (clobber (scratch:SI))])\n\nwhich claims to leave the flags alone.  The compare feeding the enclosing\nCCMP chain is therefore treated as still live and is removed, and split1\nthen emits an ADDS that overwrites the flags the outer CSEL reads:\n\n  adds  w1, w0, w1\n  csel  w1, w1, w0, cc\n  csel  w0, w1, w3, cc\n\nso f (5, 7, 9, 2) returns 12 rather than 2.\n\nAdd the (clobber (reg:CC CC_REGNUM)) that the neighbouring\n*aarch64_minmax_plus pattern already carries.  The comparison is then kept:\n\n  cmp   w2, w3\n  ccmp  w0, w1, 2, cc\n  bcs   .L2\n  adds  w1, w0, w1\n  csel  w3, w1, w0, cc\n\nBootstrapped and tested on aarch64-none-linux-gnu.\n\ngcc/ChangeLog:\n\n\tPR middle-end/116815\n\t* config/aarch64/aarch64.md\n\t(*aarch64_plus_within_\u003coptab\u003e\u003cmode\u003e3_\u003covf_commutate\u003e): Add a\n\tclobber of CC_REGNUM.\n\t(*aarch64_minus_within_\u003coptab\u003e\u003cmode\u003e3): Likewise.\n\ngcc/testsuite/ChangeLog:\n\n\tPR middle-end/116815\n\t* gcc.target/aarch64/pr116815-4.c: New test.\n\nSigned-off-by: Kyrylo Tkachov \u003cktkachov@nvidia.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "b2185c63819585a992c64da57107b60a79eeed09",
      "old_mode": 33188,
      "old_path": "gcc/config/aarch64/aarch64.md",
      "new_id": "59af2bd20882b3c11995acf4fcf978300ea308b6",
      "new_mode": 33188,
      "new_path": "gcc/config/aarch64/aarch64.md"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "6c640f58542513051b4cebb0fde39e714522eb21",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gcc.target/aarch64/pr116815-4.c"
    }
  ]
}
