diff mbox

[v2,01/12] Introduce TCGOpcode for fence instruction

Message ID 1464310815-13554-2-git-send-email-rth@twiddle.net (mailing list archive)
State New, archived
Headers show

Commit Message

Richard Henderson May 27, 2016, 1 a.m. UTC
This commit introduces the TCGOpcode for fence instruction.

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
Message-Id: <20160524171856.1000-2-bobby.prani@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/tcg-op.c  | 6 ++++++
 tcg/tcg-op.h  | 2 ++
 tcg/tcg-opc.h | 2 ++
 3 files changed, 10 insertions(+)

Comments

Sergey Fedorov May 27, 2016, 10:08 a.m. UTC | #1
On 27/05/16 04:00, Richard Henderson wrote:
> diff --git a/tcg/tcg-opc.h b/tcg/tcg-opc.h
> index 6d0410c..b772d90 100644
> --- a/tcg/tcg-opc.h
> +++ b/tcg/tcg-opc.h
> @@ -42,6 +42,8 @@ DEF(br, 0, 0, 1, TCG_OPF_BB_END)
>  # define IMPL64  TCG_OPF_64BIT
>  #endif
>  
> +DEF(fence, 0, 0, 0, TCG_OPF_SIDE_EFFECTS)
> +

I still think this TCG op needs to have a constant argument of a barrier
type. So that we can distinguish between full, read and write memory
barriers.

Regards,
Sergey

>  DEF(mov_i32, 1, 1, 0, TCG_OPF_NOT_PRESENT)
>  DEF(movi_i32, 1, 0, 1, TCG_OPF_NOT_PRESENT)
>  DEF(setcond_i32, 1, 2, 1, 0)
Lluís Vilanova May 27, 2016, 10:56 a.m. UTC | #2
Richard Henderson writes:

> This commit introduces the TCGOpcode for fence instruction.
[...]

I think this patch sould also document the opcpde in "tcg/README".


Cheers,
  Lluis
Peter Maydell May 27, 2016, 11:05 a.m. UTC | #3
On 27 May 2016 at 11:56, Lluís Vilanova <vilanova@ac.upc.edu> wrote:
> Richard Henderson writes:
>
>> This commit introduces the TCGOpcode for fence instruction.
> [...]
>
> I think this patch sould also document the opcpde in "tcg/README".

Yes, please. I have no idea what this thing is for, and neither
this patch nor the readme give me any clue...

thanks
-- PMM
Pranith Kumar May 27, 2016, 2:16 p.m. UTC | #4
Sergey Fedorov writes:

> On 27/05/16 04:00, Richard Henderson wrote:
>> diff --git a/tcg/tcg-opc.h b/tcg/tcg-opc.h
>> index 6d0410c..b772d90 100644
>> --- a/tcg/tcg-opc.h
>> +++ b/tcg/tcg-opc.h
>> @@ -42,6 +42,8 @@ DEF(br, 0, 0, 1, TCG_OPF_BB_END)
>>  # define IMPL64  TCG_OPF_64BIT
>>  #endif
>>  
>> +DEF(fence, 0, 0, 0, TCG_OPF_SIDE_EFFECTS)
>> +
>
> I still think this TCG op needs to have a constant argument of a barrier
> type. So that we can distinguish between full, read and write memory
> barriers.
>

Yes, I have a version with this fixed. I will post my patches(v3) with this
changed.

Thanks,
diff mbox

Patch

diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index 54c0277..2a7af95 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -146,6 +146,12 @@  void tcg_gen_op6(TCGContext *ctx, TCGOpcode opc, TCGArg a1, TCGArg a2,
     tcg_emit_op(ctx, opc, pi);
 }
 
+void tcg_gen_fence(void)
+{
+    /* ??? Enable only when MTTCG is enabled.  */
+    tcg_gen_op1(&tcg_ctx, INDEX_op_fence, 0);
+}
+
 /* 32 bit ops */
 
 void tcg_gen_addi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2)
diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h
index f217e80..2293720 100644
--- a/tcg/tcg-op.h
+++ b/tcg/tcg-op.h
@@ -261,6 +261,8 @@  static inline void tcg_gen_br(TCGLabel *l)
     tcg_gen_op1(&tcg_ctx, INDEX_op_br, label_arg(l));
 }
 
+void tcg_gen_fence(void);
+
 /* Helper calls. */
 
 /* 32 bit ops */
diff --git a/tcg/tcg-opc.h b/tcg/tcg-opc.h
index 6d0410c..b772d90 100644
--- a/tcg/tcg-opc.h
+++ b/tcg/tcg-opc.h
@@ -42,6 +42,8 @@  DEF(br, 0, 0, 1, TCG_OPF_BB_END)
 # define IMPL64  TCG_OPF_64BIT
 #endif
 
+DEF(fence, 0, 0, 0, TCG_OPF_SIDE_EFFECTS)
+
 DEF(mov_i32, 1, 1, 0, TCG_OPF_NOT_PRESENT)
 DEF(movi_i32, 1, 0, 1, TCG_OPF_NOT_PRESENT)
 DEF(setcond_i32, 1, 2, 1, 0)