From: Shiva Chen <shivac@marvell.com>
To: Richard Earnshaw <Richard.Earnshaw@foss.arm.com>,
Kyrill Tkachov <kyrylo.tkachov@arm.com>,
Shiva Chen <shiva0217@gmail.com>
Cc: Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>,
GCC Patches <gcc-patches@gcc.gnu.org>,
"nickc@redhat.com" <nickc@redhat.com>
Subject: RE: [GCC, ARM] armv8 linux toolchain asan testcase fail due to stl missing conditional code
Date: Thu, 04 Jun 2015 10:01:00 -0000 [thread overview]
Message-ID: <c0159834abd5499990a3ef6e77df96f0@SC-EXCH04.marvell.com> (raw)
In-Reply-To: <55700F63.2060700@foss.arm.com>
[-- Attachment #1: Type: text/plain, Size: 4859 bytes --]
Hi, Kyrill
Thanks for the tips of syntax.
It seems that correct syntax for
ldrb with condition code is ldreqb
ldab with condition code is ldabeq
So I modified the pattern as follow
{
enum memmodel model = (enum memmodel) INTVAL (operands[2]);
if (model == MEMMODEL_RELAXED
|| model == MEMMODEL_CONSUME
|| model == MEMMODEL_RELEASE)
return \"ldr%?<sync_sfx>\\t%0, %1\";
else
return \"lda<sync_sfx>%?\\t%0, %1\";
}
[(set_attr "predicable" "yes")
(set_attr "predicable_short_it" "no")])
It seems we don't have to worry about thumb mode,
Because we already set "predicable" "yes" and predicable_short_it" "no" for the pattern.
The new patch could build gcc and run gcc regression test successfully.
Please correct me if I still missing something.
Thanks,
Shiva
-----Original Message-----
From: Richard Earnshaw [mailto:Richard.Earnshaw@foss.arm.com]
Sent: Thursday, June 04, 2015 4:42 PM
To: Kyrill Tkachov; Shiva Chen
Cc: Ramana Radhakrishnan; GCC Patches; nickc@redhat.com; Shiva Chen
Subject: Re: [GCC, ARM] armv8 linux toolchain asan testcase fail due to stl missing conditional code
On 04/06/15 09:17, Kyrill Tkachov wrote:
> Hi Shiva,
>
> On 04/06/15 04:13, Shiva Chen wrote:
>> Hi, Ramana
>>
>> Currently, I work for Marvell and the company have copyright assignment on file.
>>
>> Hi, all
>>
>> After adding the attribute and rebuild gcc, I got the assembler error
>> message
>>
>> load_n.s:39: Error: bad instruction `ldrbeq r0,[r0]'
>>
>> When i look into armv8 ISA document, it seems ldrb Encoding A1 have
>> conditional code field.
>>
>> Does it mean we should also patch assembler or I just miss
>> understanding something ?
>>
>> Following command use to generate load_n.s:
>>
>> /home/shivac/build-system-trunk/Release/build/armv8-marvell-linux-gnu
>> eabihf-hard/gcc-final/./gcc/cc1 -fpreprocessed load_n.i -quiet
>> -dumpbase load_n.c -march=armv8-a -mfloat-abi=hard -mfpu=fp-armv8
>> -mtls-dialect=gnu -auxbase-strip .libs/load_1_.o -g3 -O2 -Wall
>> -Werror -version -fPIC -funwind-tables -o load_n.s
>>
>>
>> The test.c is a simple test case to reproduce missing conditional
>> code in mmap.c.
>>
>> Any suggestion ?
>
> I reproduced the assembler failure with your patch.
>
> The reason is that for arm mode we use divided syntax, where the
> condition field goes in a different place. So, while ldrbeq r0,[r0] is rejected, ldreqb r0, [r0] works.
> Since we always use divided syntax for arm mode, I think you'll need
> to put the condition field in the right place depending on arm or thumb mode.
> Ugh, this is becoming ugly :(
>
Use %(<suffix%) around the bit that changes for unified/divided syntax.
The compiler will then put the condition in the correct place.
So:
+ return \"str%(<sync_sfx>%)\t%1, %0\";
R.
> Kyrill
>
>>
>>
>> Shiva
>>
>> 2015-06-03 17:29 GMT+08:00 Shiva Chen <shiva0217@gmail.com>:
>>> Hi, Ramana
>>>
>>> I'm not sure what copyright assignment means ?
>>>
>>> Does it mean the patch have copyright assignment or not ?
>>>
>>> I update the patch to add "predicable" and "predicable_short_it"
>>> attribute as suggestion.
>>>
>>> However, I don't have svn write access yet.
>>>
>>> Shiva
>>>
>>> 2015-06-03 16:36 GMT+08:00 Kyrill Tkachov <kyrylo.tkachov@arm.com>:
>>>> On 03/06/15 09:32, Ramana Radhakrishnan wrote:
>>>>>> This pattern is not predicable though, i.e. it doesn't have the
>>>>>> "predicable" attribute set to "yes".
>>>>>> Therefore the compiler should be trying to branch around here
>>>>>> rather than try to do a cond_exec.
>>>>>> Why does the generated code above look like it's converted to
>>>>>> conditional execution?
>>>>>> Could you produce a self-contained reduced testcase for this?
>>>>> CCFSM state machine in ARM state.
>>>>>
>>>>> arm.c (final_prescan_insn).
>>>>
>>>> Ah ok.
>>>> This patch makes sense then.
>>>> As Ramana mentioned, please mark the pattern with "predicable" and
>>>> also set the "predicable_short_it" attribute to "no" so that it
>>>> will not be conditionalised in Thumb2 mode or when -mrestrict-it is enabled.
>>>>
>>>> Thanks,
>>>> Kyrill
>>>>
>>>>
>>>>
>>>>> Ramana
>>>>>
>>>>>> Thanks,
>>>>>> Kyrill
>>>>>>
>>>>>>> @@ -91,9 +91,9 @@
>>>>>>> {
>>>>>>> enum memmodel model = memmodel_from_int (INTVAL (operands[2]));
>>>>>>> if (is_mm_relaxed (model) || is_mm_consume (model) ||
>>>>>>> is_mm_acquire (model))
>>>>>>> - return \"str<sync_sfx>\t%1, %0\";
>>>>>>> + return \"str<sync_sfx>%?\t%1, %0\";
>>>>>>> else
>>>>>>> - return \"stl<sync_sfx>\t%1, %0\";
>>>>>>> + return \"stl<sync_sfx>%?\t%1, %0\";
>>>>>>> }
>>>>>>> )
>>>>>>>
>
[-- Attachment #2: Fix_slt_lda_missing_conditional_code.diff --]
[-- Type: application/octet-stream, Size: 1274 bytes --]
diff --git a/gcc/config/arm/sync.md b/gcc/config/arm/sync.md
index 44cda61..c89978a 100644
--- a/gcc/config/arm/sync.md
+++ b/gcc/config/arm/sync.md
@@ -75,11 +75,12 @@
{
enum memmodel model = memmodel_from_int (INTVAL (operands[2]));
if (is_mm_relaxed (model) || is_mm_consume (model) || is_mm_release (model))
- return \"ldr<sync_sfx>\\t%0, %1\";
+ return \"ldr%?<sync_sfx>\\t%0, %1\";
else
- return \"lda<sync_sfx>\\t%0, %1\";
+ return \"lda<sync_sfx>%?\\t%0, %1\";
}
-)
+ [(set_attr "predicable" "yes")
+ (set_attr "predicable_short_it" "no")])
(define_insn "atomic_store<mode>"
[(set (match_operand:QHSI 0 "memory_operand" "=Q")
@@ -91,11 +92,12 @@
{
enum memmodel model = memmodel_from_int (INTVAL (operands[2]));
if (is_mm_relaxed (model) || is_mm_consume (model) || is_mm_acquire (model))
- return \"str<sync_sfx>\t%1, %0\";
+ return \"str%?<sync_sfx>\t%1, %0\";
else
- return \"stl<sync_sfx>\t%1, %0\";
+ return \"stl<sync_sfx>%?\t%1, %0\";
}
-)
+ [(set_attr "predicable" "yes")
+ (set_attr "predicable_short_it" "no")])
;; Note that ldrd and vldr are *not* guaranteed to be single-copy atomic,
;; even for a 64-bit aligned address. Instead we use a ldrexd unparied
next prev parent reply other threads:[~2015-06-04 9:57 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-03 5:27 Shiva Chen
2015-06-03 8:31 ` Ramana Radhakrishnan
2015-06-03 8:36 ` Kyrill Tkachov
[not found] ` <556EBBAC.2020504@arm.com>
2015-06-03 8:53 ` Kyrill Tkachov
2015-06-03 9:33 ` Shiva Chen
2015-06-04 4:51 ` Shiva Chen
2015-06-04 8:24 ` Kyrill Tkachov
2015-06-04 8:42 ` Richard Earnshaw
2015-06-04 10:01 ` Shiva Chen [this message]
2015-06-04 10:04 ` Kyrill Tkachov
2015-06-05 8:34 ` Shiva Chen
2015-06-05 8:35 ` Kyrill Tkachov
2015-06-05 10:59 ` Shiva Chen
2015-06-05 13:11 ` Kyrill Tkachov
2015-06-05 13:14 ` Richard Earnshaw
2015-06-05 14:02 ` Kyrill Tkachov
2015-06-09 8:44 ` Kyrill Tkachov
2015-09-30 17:10 ` Kyrill Tkachov
2015-10-01 9:10 ` Kyrill Tkachov
2015-10-01 20:21 ` Christophe Lyon
2015-10-02 12:57 ` Kyrill Tkachov
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=c0159834abd5499990a3ef6e77df96f0@SC-EXCH04.marvell.com \
--to=shivac@marvell.com \
--cc=Ramana.Radhakrishnan@arm.com \
--cc=Richard.Earnshaw@foss.arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=kyrylo.tkachov@arm.com \
--cc=nickc@redhat.com \
--cc=shiva0217@gmail.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).