Page MenuHomePhabricator

[X86][AMX] Avoid AMX register clobber with "amxpreserve" attribute.
Needs ReviewPublic

Authored by LuoYuanke on Dec 6 2021, 4:19 PM.

Details

Summary
Use 'amxpreserve' attribute to indicate that the specified function has no
caller-saved AMX registers. Compiler doesn't save and restore any
AMX register across function call. It is user's responsibility that
ensure there is no AMX register clobber in the function with 'amxpreserve'
attribute.

Like 'no_caller_saved_registers', 'amxpreserve' attribute is not a
calling convention. In fact, it only overrides the decision of which
AMX registers should be saved by the caller.

For example:

.. code-block:: c

  __attribute__ ((amxpreserve ))
  void f () {
    ...
  }

  void bar () {
    ...
    f();
    ...
  }
In this case compiler doesn't save and restore AMX registers across the
call of f().

This patch append the AMX register mask to the static register mask of
specific calling convention in DAG ISel. For fast ISel, it just return
false so that it fallback to DAG ISel.

Diff Detail

Event Timeline

LuoYuanke created this revision.Dec 6 2021, 4:19 PM
LuoYuanke requested review of this revision.Dec 6 2021, 4:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2021, 4:19 PM
LuoYuanke retitled this revision from [X86][AMX] Avoid AMX register clobber with "amxpreserve" attribute. to [WIP][X86][AMX] Avoid AMX register clobber with "amxpreserve" attribute..Dec 7 2021, 4:14 AM
LuoYuanke updated this revision to Diff 393032.Dec 8 2021, 10:32 PM

Update test case and commit message.

LuoYuanke retitled this revision from [WIP][X86][AMX] Avoid AMX register clobber with "amxpreserve" attribute. to [X86][AMX] Avoid AMX register clobber with "amxpreserve" attribute..Dec 8 2021, 10:34 PM
LuoYuanke edited the summary of this revision. (Show Details)