From: Laurent Vivier <laurent@vivier.eu>
To: Paolo Bonzini <pbonzini@redhat.com>,
Aurelien Jarno <aurelien@aurel32.net>,
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Richard Henderson <rth@twiddle.net>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas
Date: Thu, 3 Nov 2016 17:51:38 +0100 [thread overview]
Message-ID: <f2e48ea9-3d16-03d6-e076-6f60838408a8@vivier.eu> (raw)
In-Reply-To: <bc07c5c4-c410-8046-9cb3-29f11fde8ecb@vivier.eu>
Le 03/11/2016 à 17:21, Laurent Vivier a écrit :
> Le 03/11/2016 à 17:18, Paolo Bonzini a écrit :
>>
>>
>> On 03/11/2016 16:35, Laurent Vivier wrote:
>>> Le 03/11/2016 à 16:32, Paolo Bonzini a écrit :
>>>>
>>>>
>>>> On 03/11/2016 15:07, Laurent Vivier wrote:
>>>>> Implement real atomic tas:
>>>>>
>>>>> When (Rn) = 0, 1 -> T
>>>>> Otherwise, 0 -> T
>>>>> In both cases, 1 -> MSB of (Rn)
>>>>>
>>>>> using atomic_fetch_or_i32() and setcondi_i32().
>>>>>
>>>>> Tested with image from:
>>>>> http://wiki.qemu.org/download/sh-test-0.2.tar.bz2
>>>>>
>>>>> This image contains a "tas_test" that runs without
>>>>> error with this change.
>>>>>
>>>>> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
>>>>> ---
>>>>> v2:
>>>>> - don't use helper but atomic_fetch_or_i32
>>>>> Thank you Paolo!
>>>>>
>>>>> target-sh4/translate.c | 19 ++++++++-----------
>>>>> 1 file changed, 8 insertions(+), 11 deletions(-)
>>>>>
>>>>> diff --git a/target-sh4/translate.c b/target-sh4/translate.c
>>>>> index c89a147..1b83d59 100644
>>>>> --- a/target-sh4/translate.c
>>>>> +++ b/target-sh4/translate.c
>>>>> @@ -1640,18 +1640,15 @@ static void _decode_opc(DisasContext * ctx)
>>>>> tcg_gen_shri_i32(REG(B11_8), REG(B11_8), 16);
>>>>> return;
>>>>> case 0x401b: /* tas.b @Rn */
>>>>> - {
>>>>> - TCGv addr, val;
>>>>> - addr = tcg_temp_local_new();
>>>>> - tcg_gen_mov_i32(addr, REG(B11_8));
>>>>> - val = tcg_temp_local_new();
>>>>> - tcg_gen_qemu_ld_i32(val, addr, ctx->memidx, MO_UB);
>>>>> + {
>>>>> + TCGv val = tcg_temp_new();
>>>>> + TCGv msb = tcg_const_i32(0x80);
>>>>> + tcg_gen_atomic_fetch_or_i32(val, REG(B11_8), msb,
>>>>> + ctx->memidx, MO_UB);
>>>>> + tcg_temp_free(msb);
>>>>> tcg_gen_setcondi_i32(TCG_COND_EQ, cpu_sr_t, val, 0);
>>>>> - tcg_gen_ori_i32(val, val, 0x80);
>>>>> - tcg_gen_qemu_st_i32(val, addr, ctx->memidx, MO_UB);
>>>>> - tcg_temp_free(val);
>>>>> - tcg_temp_free(addr);
>>>>> - }
>>>>> + tcg_temp_free(val);
>>>>> + }
>>>>> return;
>>>>> case 0xf00d: /* fsts FPUL,FRn - FPSCR: Nothing */
>>>>> CHECK_FPU_ENABLED
>>>>>
>>>>
>>>> For 2.8?
>>>
>>> Is it possible?
>>
>> Well, tas_test "runs without error with this change", I suppose it fails
>> before?
I need to add:
It doesn't fail before. The problem is only with qemu-sh4.
Laurent
next prev parent reply other threads:[~2016-11-03 16:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-03 14:07 [Qemu-devel] [PATCH v2] target-sh4: add atomic tas Laurent Vivier
2016-11-03 14:53 ` Richard Henderson
2016-11-03 15:32 ` Paolo Bonzini
2016-11-03 15:35 ` Laurent Vivier
2016-11-03 16:18 ` Paolo Bonzini
2016-11-03 16:21 ` Laurent Vivier
2016-11-03 16:51 ` Laurent Vivier [this message]
2016-11-03 16:51 ` Richard Henderson
2016-11-03 17:52 ` Paolo Bonzini
2016-11-03 19:15 ` Richard Henderson
2016-11-04 9:23 ` John Paul Adrian Glaubitz
2016-11-04 9:43 ` John Paul Adrian Glaubitz
2016-11-04 9:53 ` Laurent Vivier
2016-11-04 10:00 ` John Paul Adrian Glaubitz
2016-11-04 10:13 ` Paolo Bonzini
2016-11-04 10:16 ` John Paul Adrian Glaubitz
2016-11-04 10:52 ` Paolo Bonzini
2016-11-04 0:02 ` Aurelien Jarno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f2e48ea9-3d16-03d6-e076-6f60838408a8@vivier.eu \
--to=laurent@vivier.eu \
--cc=aurelien@aurel32.net \
--cc=glaubitz@physik.fu-berlin.de \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).