Improve -mlfence-after-load
authorliuhongt <hongtao.liu@intel.com>
Mon, 16 Mar 2020 03:03:12 +0000 (11:03 +0800)
committerliuhongt <hongtao.liu@intel.com>
Sun, 26 Apr 2020 06:26:24 +0000 (14:26 +0800)
commita09f656b267b9a684f038fba7cadfe98e2f18892
tree875224c50cb561179eb700b3a751a787ad9b87f8
parentec9c4d83220d0991c07a37116e27d4449061f2b8
Improve -mlfence-after-load

  1.Implict load for POP/POPF/POPA/XLATB, no load for Anysize insns
  2. Add -mlfence-before-ret=shl/yes, adjust operand size of
  or/not/shl according to ret's.
  3. Issue warning for REP CMPS/SCAS since they would affect control
  flow behavior.
  4. Adjust testcases and documents.

gas/Changelog:
* config/tc-i386.c (lfence_before_ret_shl): New member.
(load_insn_p): implict load for POP/POPA/POPF/XLATB, no load
for Anysize insns.
(insert_after_load): Issue warning for REP CMPS/SCAS.
(insert_before_before): Handle iret, Handle
-mlfence-before-ret=shl, Adjust operand size of or/not/shl to ret's,
(md_parse_option): Change -mlfence-before-ret=[none|not|or] to
-mlfence-before-ret=[none/not/or/shl/yes].
Enable -mlfence-before-ret=shl when
-mlfence-beofre-indirect-branch=all and no explict -mlfence-before-ret option.
(md_show_usage): Ditto.
* doc/c-i386.texi: Ditto.
* testsuite/gas/i386/i386.exp: Add new testcases.
* testsuite/gas/i386/lfence-load-b.d: New.
* testsuite/gas/i386/lfence-load-b.e: New.
* testsuite/gas/i386/lfence-load.d: Modified.
* testsuite/gas/i386/lfence-load.e: New.
* testsuite/gas/i386/lfence-load.s: Modified.
* testsuite/gas/i386/lfence-ret-a.d: Modified.
* testsuite/gas/i386/lfence-ret-b.d: Modified.
* testsuite/gas/i386/lfence-ret-c.d: New.
* testsuite/gas/i386/lfence-ret-d.d: New.
* testsuite/gas/i386/lfence-ret.s: Modified.
* testsuite/gas/i386/x86-64-lfence-load-b.d: New.
* testsuite/gas/i386/x86-64-lfence-load.d: Modified.
* testsuite/gas/i386/x86-64-lfence-load.s: Modified.
* testsuite/gas/i386/x86-64-lfence-ret-a.d: Modified.
* testsuite/gas/i386/x86-64-lfence-ret-b.d: Modified.
* testsuite/gas/i386/x86-64-lfence-ret-c.d: New.
* testsuite/gas/i386/x86-64-lfence-ret-d.d: New
* testsuite/gas/i386/x86-64-lfence-ret-e.d: New.
* testsuite/gas/i386/x86-64-lfence-ret.e: New.
* testsuite/gas/i386/x86-64-lfence-ret.s: New.
21 files changed:
gas/ChangeLog
gas/config/tc-i386.c
gas/doc/c-i386.texi
gas/testsuite/gas/i386/i386.exp
gas/testsuite/gas/i386/lfence-load.d
gas/testsuite/gas/i386/lfence-load.e [new file with mode: 0644]
gas/testsuite/gas/i386/lfence-load.s
gas/testsuite/gas/i386/lfence-ret-a.d
gas/testsuite/gas/i386/lfence-ret-b.d
gas/testsuite/gas/i386/lfence-ret-c.d [new file with mode: 0644]
gas/testsuite/gas/i386/lfence-ret-d.d [new file with mode: 0644]
gas/testsuite/gas/i386/lfence-ret.s
gas/testsuite/gas/i386/x86-64-lfence-load.d
gas/testsuite/gas/i386/x86-64-lfence-load.s
gas/testsuite/gas/i386/x86-64-lfence-ret-a.d
gas/testsuite/gas/i386/x86-64-lfence-ret-b.d
gas/testsuite/gas/i386/x86-64-lfence-ret-c.d [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-lfence-ret-d.d [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-lfence-ret-e.d [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-lfence-ret.e [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-lfence-ret.s [new file with mode: 0644]