)]}'
{
  "commit": "a91e5d88970c8d865a49f2a4ed4e17ee2c58b73f",
  "tree": "fd480fcd0696b3c68c8ac329d49fd95bf608ee1c",
  "parents": [
    "05fa0de35ec63db2c3aacd30cc34a7389b3c4e5d"
  ],
  "author": {
    "name": "Jakub Jelinek",
    "email": "jakub@redhat.com",
    "time": "Sat Feb 08 10:59:40 2020 +0100"
  },
  "committer": {
    "name": "Jakub Jelinek",
    "email": "jakub@redhat.com",
    "time": "Thu Feb 13 21:46:13 2020 +0100"
  },
  "message": "i386: Make xmm16-xmm31 call used even in ms ABI [PR65782]\n\nOn Tue, Feb 04, 2020 at 11:16:06AM +0100, Uros Bizjak wrote:\n\u003e I guess that Comment #9 patch form the PR should be trivially correct,\n\u003e but althouhg it looks obvious, I don\u0027t want to propose the patch since\n\u003e I have no means of testing it.\n\nI don\u0027t have means of testing it either.\nhttps://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view\u003dvs-2019\nis quite explicit that [xyz]mm16-31 are call clobbered and only xmm6-15 (low\n128-bits only) are call preserved.\n\nWe are talking e.g. about\n/* { dg-options \"-O2 -mabi\u003dms -mavx512vl\" } */\n\ntypedef double V __attribute__((vector_size (16)));\nvoid foo (void);\nV bar (void);\nvoid baz (V);\nvoid\nqux (void)\n{\n  V c;\n  {\n    register V a __asm (\"xmm18\");\n    V b \u003d bar ();\n    asm (\"\" : \"\u003dx\" (a) : \"0\" (b));\n    c \u003d a;\n  }\n  foo ();\n  {\n    register V d __asm (\"xmm18\");\n    V e;\n    d \u003d c;\n    asm (\"\" : \"\u003dx\" (e) : \"0\" (d));\n    baz (e);\n  }\n}\nwhere according to the MSDN doc gcc incorrectly holds the c value\nin xmm18 register across the foo call; if foo is compiled by some Microsoft\ncompiler (or LLVM), then it could clobber %xmm18.\nIf all xmm18 occurrences are changed to say xmm15, then it is valid to hold\nthe 128-bit value across the foo call (though, surprisingly, LLVM saves it\ninto stack anyway).\n\nThe other parts are I guess mainly about SEH.  Consider e.g.\nvoid\nfoo (void)\n{\n  register double x __asm (\"xmm14\");\n  register double y __asm (\"xmm18\");\n  asm (\"\" : \"\u003dx\" (x));\n  asm (\"\" : \"\u003dv\" (y));\n  x +\u003d y;\n  y +\u003d x;\n  asm (\"\" : : \"x\" (x));\n  asm (\"\" : : \"v\" (y));\n}\nlooking at cross-compiler output, with -O2 -mavx512f this emits\n\t.file\t\"abcdeq.c\"\n\t.text\n\t.align 16\n\t.globl\tfoo\n\t.def\tfoo;\t.scl\t2;\t.type\t32;\t.endef\n\t.seh_proc\tfoo\nfoo:\n\tsubq\t$40, %rsp\n\t.seh_stackalloc\t40\n\tvmovaps %xmm14,\t(%rsp)\n\t.seh_savexmm\t%xmm14, 0\n\tvmovaps %xmm18,\t16(%rsp)\n\t.seh_savexmm\t%xmm18, 16\n\t.seh_endprologue\n\tvaddsd\t%xmm18, %xmm14, %xmm14\n\tvaddsd\t%xmm18, %xmm14, %xmm18\n\tvmovaps\t(%rsp), %xmm14\n\tvmovaps\t16(%rsp), %xmm18\n\taddq\t$40, %rsp\n\tret\n\t.seh_endproc\n\t.ident\t\"GCC: (GNU) 10.0.1 20200207 (experimental)\"\nDoes whatever assembler mingw64 uses even assemble this (I mean the\n.seh_savexmm %xmm16, 16 could be problematic)?\nI can find e.g.\nhttps://stackoverflow.com/questions/43152633/invalid-register-for-seh-savexmm-in-cygwin/43210527\nwhich then links to\nhttps://gcc.gnu.org/PR65782\n\n2020-02-08  Uroš Bizjak  \u003cubizjak@gmail.com\u003e\n\t    Jakub Jelinek  \u003cjakub@redhat.com\u003e\n\n\tPR target/65782\n\t* config/i386/i386.h (CALL_USED_REGISTERS): Make\n\txmm16-xmm31 call-used even in 64-bit ms-abi.\n\n\t* gcc.target/i386/pr65782.c: New test.\n\nCo-authored-by: Uroš Bizjak \u003cubizjak@gmail.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "e9ce10c287060651790c8b5ecab59e3c30f9581d",
      "old_mode": 33188,
      "old_path": "gcc/ChangeLog",
      "new_id": "72c8ee6bd67744577a9d559ad12fcf6609334110",
      "new_mode": 33188,
      "new_path": "gcc/ChangeLog"
    },
    {
      "type": "modify",
      "old_id": "95e1733f12a4e0d5b08195a34e47fa3897b53c57",
      "old_mode": 33188,
      "old_path": "gcc/config/i386/i386.h",
      "new_id": "14e5a392f62c9be02a6f0e26a9060822aa3f1dc8",
      "new_mode": 33188,
      "new_path": "gcc/config/i386/i386.h"
    },
    {
      "type": "modify",
      "old_id": "2cfc06f5605e25ba979a798ec564eede95e583d2",
      "old_mode": 33188,
      "old_path": "gcc/testsuite/ChangeLog",
      "new_id": "c7b8e6a585ae01a409da7bddb128a1e2f7fa4753",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/ChangeLog"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "298dca1be97cef82d8d1350be8e25fff8ab7b0fd",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gcc.target/i386/pr65782.c"
    }
  ]
}
