]> git.ipfire.org Git - thirdparty/gcc.git/commit
[APX EGPR] Map reg/mem constraints in inline asm to non-EGPR constraint.
authorKong Lingling <lingling.kong@intel.com>
Thu, 23 Mar 2023 06:25:50 +0000 (14:25 +0800)
committerHongyu Wang <hongyu.wang@intel.com>
Sat, 7 Oct 2023 08:34:30 +0000 (16:34 +0800)
commitccdc0f0fcf6f240d5c4f059e6f38547a0cca9723
tree1db898c940cdf4ac3098671f612bde8826f15b48
parent0793ee05b078b99c55170c14c4a32b94d3a54cab
[APX EGPR] Map reg/mem constraints in inline asm to non-EGPR constraint.

In inline asm, we do not know if the insn can use EGPR, so disable EGPR
usage by default via mapping the common reg/mem constraint to non-EGPR
constraints.

The full list of mapping goes like

  "g" -> "jrjmi"
  "r" -> "jr"
  "m" -> "jm"
  "<" -> "j<"
  ">" -> "j>"
  "o" -> "jo"
  "V" -> "jV"
  "p" -> "jp"
  "Bm" -> "ja

For memory constraints, we add an option -mapx-inline-asm-use-gpr32
to allow/disallow gpr32 usage in any memory related constraints, as
base_reg_class/index_reg_class cannot aware whether the asm insn
support gpr32 or not.

gcc/ChangeLog:

* config/i386/i386.cc (map_egpr_constraints): New funciton to
map common constraints to EGPR prohibited constraints.
(ix86_md_asm_adjust): Calls map_egpr_constraints.
* config/i386/i386.opt: Add option mapx-inline-asm-use-gpr32.

gcc/testsuite/ChangeLog:

* gcc.target/i386/apx-inline-gpr-norex2.c: New test.

Co-authored-by: Hongyu Wang <hongyu.wang@intel.com>
Co-authored-by: Hongtao Liu <hongtao.liu@intel.com>
gcc/config/i386/i386.cc
gcc/config/i386/i386.opt
gcc/testsuite/gcc.target/i386/apx-inline-gpr-norex2.c [new file with mode: 0644]