aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorAndrew Senkevich <andrew.senkevich@intel.com>2016-01-29 15:46:50 +0300
committerAndrew Senkevich <andrew.senkevich@intel.com>2016-01-29 15:46:50 +0300
commite4e00185b58fd15c74913f19f4d5fb311b239e21 (patch)
tree92754b63964dbcf1598666118acc3876c61c1382 /gas/testsuite
parentd64450d73aedfbd3521872e1ff7ec4f16ef0aae1 (diff)
downloadgdb-e4e00185b58fd15c74913f19f4d5fb311b239e21.zip
gdb-e4e00185b58fd15c74913f19f4d5fb311b239e21.tar.gz
gdb-e4e00185b58fd15c74913f19f4d5fb311b239e21.tar.bz2
Add option -mfence-as-lock-add=[no|yes].
With -mfence-as-lock-add=yes lfence, mfence and sfence will be encoded as lock addl $0x0, (%{r,e}sp). gas/: * config/tc-i386.c (avoid_fence): New. (output_insn): Encode as lock addl $0x0, (%{r,e}sp) if avoid_fence is true. (OPTION_FENCE_AS_LOCK_ADD): New. (md_longopts): Add -mfence-as-lock-add. (md_parse_option): Handle -mfence-as-lock-add. (md_show_usage): Add -mfence-as-lock-add=[no|yes]. * doc/c-i386.texi (-mfence-as-lock-add): Document. gas/testsuite/: * gas/i386/i386.exp: Run new tests. * gas/i386/fence-as-lock-add.s: New. * gas/i386/fence-as-lock-add-yes.d: Likewise. * gas/i386/fence-as-lock-add-no.d: Likewise. * gas/i386/x86-64-fence-as-lock-add-yes.d: Likewise. * gas/i386/x86-64-fence-as-lock-add-no.d: Likewise.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/i386/fence-as-lock-add-no.d14
-rw-r--r--gas/testsuite/gas/i386/fence-as-lock-add-yes.d14
-rw-r--r--gas/testsuite/gas/i386/fence-as-lock-add.s6
-rw-r--r--gas/testsuite/gas/i386/i386.exp4
-rw-r--r--gas/testsuite/gas/i386/x86-64-fence-as-lock-add-no.d14
-rw-r--r--gas/testsuite/gas/i386/x86-64-fence-as-lock-add-yes.d14
6 files changed, 66 insertions, 0 deletions
diff --git a/gas/testsuite/gas/i386/fence-as-lock-add-no.d b/gas/testsuite/gas/i386/fence-as-lock-add-no.d
new file mode 100644
index 0000000..2083066
--- /dev/null
+++ b/gas/testsuite/gas/i386/fence-as-lock-add-no.d
@@ -0,0 +1,14 @@
+#source: fence-as-lock-add.s
+#as: -mfence-as-lock-add=no
+#objdump: -dw
+#name: i386 fence as lock add = no
+
+.*: +file format .*i386.*
+
+Disassembly of section .text:
+
+0+ <main>:
+[ ]*[a-f0-9]+: 0f ae e8[ ]* lfence
+[ ]*[a-f0-9]+: 0f ae f0[ ]* mfence
+[ ]*[a-f0-9]+: 0f ae f8[ ]* sfence
+#pass
diff --git a/gas/testsuite/gas/i386/fence-as-lock-add-yes.d b/gas/testsuite/gas/i386/fence-as-lock-add-yes.d
new file mode 100644
index 0000000..4ee6300
--- /dev/null
+++ b/gas/testsuite/gas/i386/fence-as-lock-add-yes.d
@@ -0,0 +1,14 @@
+#source: fence-as-lock-add.s
+#as: -mfence-as-lock-add=yes
+#objdump: -dw
+#name: i386 fence as lock add = yes
+
+.*: +file format .*i386.*
+
+Disassembly of section .text:
+
+0+ <main>:
+[ ]*[a-f0-9]+: f0 83 04 24 00[ ]* lock addl \$0x0,\(%esp\)
+[ ]*[a-f0-9]+: f0 83 04 24 00[ ]* lock addl \$0x0,\(%esp\)
+[ ]*[a-f0-9]+: f0 83 04 24 00[ ]* lock addl \$0x0,\(%esp\)
+#pass
diff --git a/gas/testsuite/gas/i386/fence-as-lock-add.s b/gas/testsuite/gas/i386/fence-as-lock-add.s
new file mode 100644
index 0000000..5ecb1d9
--- /dev/null
+++ b/gas/testsuite/gas/i386/fence-as-lock-add.s
@@ -0,0 +1,6 @@
+ .text
+.globl main
+main:
+ lfence
+ mfence
+ sfence
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index e23a4e5..b9144c4 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -303,6 +303,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]]
run_dump_test "avx512dq_vl"
run_dump_test "omit-lock-yes"
run_dump_test "omit-lock-no"
+ run_dump_test "fence-as-lock-add-yes"
+ run_dump_test "fence-as-lock-add-no"
run_dump_test "avx512dq-rcigrd-intel"
run_dump_test "avx512dq-rcigrd"
run_dump_test "avx512dq-rcigrne-intel"
@@ -731,6 +733,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t
run_dump_test "x86-64-mwaitx-bdver4"
run_list_test "x86-64-mwaitx-reg"
run_dump_test "x86-64-ospke"
+ run_dump_test "x86-64-fence-as-lock-add-yes"
+ run_dump_test "x86-64-fence-as-lock-add-no"
if { ![istarget "*-*-aix*"]
&& ![istarget "*-*-beos*"]
diff --git a/gas/testsuite/gas/i386/x86-64-fence-as-lock-add-no.d b/gas/testsuite/gas/i386/x86-64-fence-as-lock-add-no.d
new file mode 100644
index 0000000..9277448
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-fence-as-lock-add-no.d
@@ -0,0 +1,14 @@
+#source: fence-as-lock-add.s
+#as: -mfence-as-lock-add=no
+#objdump: -dw
+#name: x86-64 fence as lock add = no
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <main>:
+[ ]*[a-f0-9]+: 0f ae e8[ ]* lfence
+[ ]*[a-f0-9]+: 0f ae f0[ ]* mfence
+[ ]*[a-f0-9]+: 0f ae f8[ ]* sfence
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-fence-as-lock-add-yes.d b/gas/testsuite/gas/i386/x86-64-fence-as-lock-add-yes.d
new file mode 100644
index 0000000..9451cd8
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-fence-as-lock-add-yes.d
@@ -0,0 +1,14 @@
+#source: fence-as-lock-add.s
+#as: -mfence-as-lock-add=yes
+#objdump: -dw
+#name: x86-64 fence as lock add = yes
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <main>:
+[ ]*[a-f0-9]+: f0 83 04 24 00[ ]* lock addl \$0x0,\(%rsp\)
+[ ]*[a-f0-9]+: f0 83 04 24 00[ ]* lock addl \$0x0,\(%rsp\)
+[ ]*[a-f0-9]+: f0 83 04 24 00[ ]* lock addl \$0x0,\(%rsp\)
+#pass