)]}'
{
  "commit": "48c2ea1750efe48723dbb04a77d0deb3e242f35f",
  "tree": "cd9cec8412930da8d513c6c05f164f1c578ed0d3",
  "parents": [
    "9e427f335b73112b0de19b116de97a6b7d563c45"
  ],
  "author": {
    "name": "Roger Sayle",
    "email": "roger@nextmovesoftware.com",
    "time": "Wed Apr 01 23:52:26 2026 +0100"
  },
  "committer": {
    "name": "Roger Sayle",
    "email": "roger@nextmovesoftware.com",
    "time": "Wed Apr 01 23:52:26 2026 +0100"
  },
  "message": "PR target/123238: VCOND_MASK regression on x86_64.\n\nThis patch is my revised fix for (the regression aspects of) PR123238,\na code quality regression on x86_64 triggered by the generation of\nVCOND_MASK.  The regression is actually just bad luck.  From gimple,\nVCOND_MASK(a\u003d\u003db,c,d) is equivalent to VCOND_MASK(a!\u003db,d,c), and which\nform gets generated was previously arbitrary.  This is reasonable for\nmany (most?) targets, but on x86_64 there\u0027s an asymmetry, equality\ncan be performed in 1 instruction, but inequality requires three.\n\nTeaching the middle-end\u0027s expand pass which form is preferred could\nin theory be done with a new (very specific) target hook, that would\nrequire documentation, but a more generic solution is for expand\u0027s\nexpand_vec_cond_mask_optab_fn to make use of rtx_costs, and reverse\nthe sense of VCOND_MASK if that would be an improvement.  This has\nthe convenient property that the default rtx_costs of all comparison\noperators is the same, resulting in no change unless explicitly\nspecified by the backend.\n\nThis revision incorporates the feedback from both Andrew Pinksi and\nRichard Biener, using get_gimple_for_ssa_name instead of\nSSA_NAME_DEF_STMT, and Andrew\u0027s suggestion to log expand\u0027s\ndecision to the dump file, which now contains lines such as:\n\n;; swapping operands of .VCOND_MASK\n;; cost of original ne: 8\n;; cost of replacement eq: 4\n\nor (for failure)\n\n;; not swapping operands of .VCOND_MASK\n;; cost of original eq: 4\n;; cost of replacement ne: 8\n\nThanks to Richard and Hongtao for approvals.\n\n2026-04-01  Roger Sayle  \u003croger@nextmovesoftware.com\u003e\n\ngcc/ChangeLog\n\tPR target/123238\n\t* expr.cc (convert_tree_comp_to_rtx): Make global.\n\t* expr.h (convert_tree_comp_to_rtx): Prototype here.\n\t* internal-fn.cc (expand_vec_cond_mask_optab_fn): Use rtx_costs\n\tto determine whether swapping operands would result in better\n\tcode.\n\n\t* config/i386/i386-expand.cc (ix86_expand_int_vec_cmp): On\n\tAVX512 targets use a ternlog instead of a comparison to negate\n\tthe mask (requires one instruction instead of two).\n\t* config/i386/i386.cc (ix86_rtx_costs): Refactor code for UNSPEC.\n\tProvide costs for UNSPEC_BLENDV and  UNSPEC_MOVMSK.  Provide\n\tcosts for comparison operators of integer vector modes.\n\ngcc/testsuite/ChangeLog\n\tPR target/123238\n\t* gcc.target/i386/pr123238.c: Likewise.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "a82bb4399c9bc2c920c9a0724ea965fd0cd4a2c1",
      "old_mode": 33188,
      "old_path": "gcc/config/i386/i386-expand.cc",
      "new_id": "366ad513da961e986adfb06e415b6da21a93c5ea",
      "new_mode": 33188,
      "new_path": "gcc/config/i386/i386-expand.cc"
    },
    {
      "type": "modify",
      "old_id": "588e7c9d81d8041bf74df09c085922571935a1e2",
      "old_mode": 33188,
      "old_path": "gcc/config/i386/i386.cc",
      "new_id": "39136ce5042dedf6e72a4517d4ec47ed9bbb7e53",
      "new_mode": 33188,
      "new_path": "gcc/config/i386/i386.cc"
    },
    {
      "type": "modify",
      "old_id": "ba00226c4e764139b0ed08958d66ffd78c5f6ee7",
      "old_mode": 33188,
      "old_path": "gcc/expr.cc",
      "new_id": "7ca5dd84ce92b59b41beedc78dfee1f165a91012",
      "new_mode": 33188,
      "new_path": "gcc/expr.cc"
    },
    {
      "type": "modify",
      "old_id": "ddd47cb4ecc317d84383061d01d04f63369b6e3d",
      "old_mode": 33188,
      "old_path": "gcc/expr.h",
      "new_id": "1e89a142d8cde66a72e220e2c57703abc8b547b7",
      "new_mode": 33188,
      "new_path": "gcc/expr.h"
    },
    {
      "type": "modify",
      "old_id": "d879568c6e3e10a4e567dd5e76e4ffcfe9fca1f2",
      "old_mode": 33188,
      "old_path": "gcc/internal-fn.cc",
      "new_id": "65be5aed35caf9c1fd05c20b756f65da5d794577",
      "new_mode": 33188,
      "new_path": "gcc/internal-fn.cc"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "63906ae0fb46506dbf7512be46c5eb1f6b31bcfb",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gcc.target/i386/pr123238.c"
    }
  ]
}
