diff options
author | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-11-25 00:12:15 +0000 |
---|---|---|
committer | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-11-25 00:12:15 +0000 |
commit | dee3b5eda1948b47fc50e8fb66c39170e79f58f5 (patch) | |
tree | 8e07a39330d1ebe644c0770206cc9d3a6ccc8002 /gcc/config/i386/sync.md | |
parent | 9319f8948021258e406f72c174922f9350fa40bf (diff) | |
download | gcc-dee3b5eda1948b47fc50e8fb66c39170e79f58f5.tar.gz |
PR target/38256
* config/i386/sync.md (memory_barrier_nosse): New insn
(memory_barrier): Generate memory_barrier_nosse insn for !TARGET_SSE2.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142177 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/i386/sync.md')
-rw-r--r-- | gcc/config/i386/sync.md | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/gcc/config/i386/sync.md b/gcc/config/i386/sync.md index e090ea74da1..8aad0c47217 100644 --- a/gcc/config/i386/sync.md +++ b/gcc/config/i386/sync.md @@ -36,19 +36,30 @@ (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))] "" { + operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode)); + MEM_VOLATILE_P (operands[0]) = 1; + if (!TARGET_SSE2) { - /* Emit a locked no-operation when SSE2 is not available. */ - int slot = virtuals_instantiated ? SLOT_TEMP : SLOT_VIRTUAL; - rtx temp = assign_386_stack_local (QImode, slot); - emit_insn (gen_sync_iorqi (temp, CONST0_RTX (QImode))); + emit_insn (gen_memory_barrier_nosse (operands[0])); DONE; } - - operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode)); - MEM_VOLATILE_P (operands[0]) = 1; }) +(define_insn "memory_barrier_nosse" + [(set (match_operand:BLK 0 "" "") + (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE)) + (clobber (reg:CC FLAGS_REG))] + + "!TARGET_SSE2" +{ + if (TARGET_64BIT) + return "lock{%;| }or{q}\t{$0, (%%rsp)|QWORD PTR [rsp], 0}"; + else + return "lock{%;| }or{l}\t{$0, (%%esp)|DWORD PTR [esp], 0}"; +} + [(set_attr "memory" "unknown")]) + ;; ??? It would be possible to use cmpxchg8b on pentium for DImode ;; changes. It's complicated because the insn uses ecx:ebx as the ;; new value; note that the registers are reversed from the order |