diff mbox

[RFC,v2,07/13] tcg/ppc: Add support for fence

Message ID 20160531183928.29406-8-bobby.prani@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Pranith Kumar May 31, 2016, 6:39 p.m. UTC
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 tcg/ppc/tcg-target.inc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Richard Henderson May 31, 2016, 8:41 p.m. UTC | #1
On 05/31/2016 11:39 AM, Pranith Kumar wrote:
> +#define HWSYNC XO31(598)
> +#define LWSYNC (HWSYNC | (1u << 21))
...
> +    case INDEX_op_mb:
> +        /* ??? Do we want SEQ_CST or ACQ_REL memory model.  */
> +        tcg_out32(s, HWSYNC);
> +        break;

With the flags argument, this needs to be

#define EIEIO  XO31(854)

	a0 = args[0];
	if (a0 == TCG_MB_WRITE) {
		tcg_out32(s, EIEIO);
	} else if (a1 == TCG_MB_READ) {
		tcg_out32(s, LWSYNC);
	} else {
		tcg_out32(s, HWSYNC);
	}


r~
diff mbox

Patch

diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c
index 1039407..45a667f 100644
--- a/tcg/ppc/tcg-target.inc.c
+++ b/tcg/ppc/tcg-target.inc.c
@@ -469,6 +469,9 @@  static int tcg_target_const_match(tcg_target_long val, TCGType type,
 #define STHX   XO31(407)
 #define STWX   XO31(151)
 
+#define HWSYNC XO31(598)
+#define LWSYNC (HWSYNC | (1u << 21))
+
 #define SPR(a, b) ((((a)<<5)|(b))<<11)
 #define LR     SPR(8, 0)
 #define CTR    SPR(9, 0)
@@ -2425,6 +2428,10 @@  static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
         tcg_out32(s, MULHD | TAB(args[0], args[1], args[2]));
         break;
 
+    case INDEX_op_mb:
+        /* ??? Do we want SEQ_CST or ACQ_REL memory model.  */
+        tcg_out32(s, HWSYNC);
+        break;
     case INDEX_op_mov_i32:   /* Always emitted via tcg_out_mov.  */
     case INDEX_op_mov_i64:
     case INDEX_op_movi_i32:  /* Always emitted via tcg_out_movi.  */
@@ -2572,6 +2579,7 @@  static const TCGTargetOpDef ppc_op_defs[] = {
     { INDEX_op_qemu_st_i64, { "S", "S", "S", "S" } },
 #endif
 
+    { INDEX_op_mb, { "r" } },
     { -1 },
 };