On Tue, 30 Apr 2024 08:52:36 -0700 Richard Henderson 
<richard.hender...@linaro.org> wrote:
>
> On 4/30/24 07:25, Matheus Tavares Bernardino wrote:
> > +void test_multi_cof(void)
> > +{
> > +    asm volatile(
> > +        "p0 = cmp.eq(r0, r0)\n"
> > +        "{\n"
> > +        "    if (p0) jump test_multi_cof_unaligned\n"
> > +        "    jump 1f\n"
> > +        "}\n"
> > +        "1: nop\n"
> > +        : : : "p0");
> > +}
> 
> I will say you could just add the label to the end of the asm here, like
> 
>       .byte 0
> test_multi_cof_unaligned:
> 
> rather than use a separate source file.
>

That would be nice, but unfortunately that doesn't work because the label gets
aligned by the assembler :( 

diff --git a/tests/tcg/hexagon/unaligned_pc.c b/tests/tcg/hexagon/unaligned_pc.c
index 1add2d0d99..3772947a86 100644
--- a/tests/tcg/hexagon/unaligned_pc.c
+++ b/tests/tcg/hexagon/unaligned_pc.c
@@ -33,10 +33,12 @@ void test_multi_cof(void)
     asm volatile(
         "p0 = cmp.eq(r0, r0)\n"
         "{\n"
-        "    if (p0) jump test_multi_cof_unaligned\n"
+        "    if (p0) jump 2f\n"
         "    jump 1f\n"
         "}\n"
         "1: nop\n"
+        ".byte 0\n"
+        "2: nop\n"
         : : : "p0");
 }

Ends up producing:

00020dc0 <test_multi_cof>:
   20dc0:       00 c0 9d a0     a09dc000 {      allocframe(#0x0) }
   20dc4:       00 c0 00 f2     f200c000 {      p0 = cmp.eq(r0,r0) }
   20dc8:       06 40 00 5c     5c004006 {      if (p0) jump:nt 0x20dd4 
<test_multi_cof+0x14>
   20dcc:       04 c0 00 58     5800c004        jump 0x20dd0 
<test_multi_cof+0x10> }
   20dd0:       00 c0 00 7f     7f00c000 {      nop }
   20dd4:       00 00 c0 00 <unknown>

Reply via email to