[PATCH] LoongArch: Add support for b ".L1" and beq "$t0", "$t1", ".L1"

Xi Ruoyao xry111@xry111.site
Wed Dec 6 06:35:11 GMT 2023


On Tue, 2023-12-05 at 22:14 -0800, Fangrui Song wrote:
> On Tue, Dec 5, 2023 at 8:55 PM Xi Ruoyao <xry111@xry111.site> wrote:
> > 
> > On Tue, 2023-12-05 at 19:45 -0800, Fangrui Song wrote:
> > > > > diff --git a/gas/testsuite/gas/loongarch/double_quotation_marks.s b/gas/testsuite/gas/loongarch/double_quotation_marks.s
> > > > > new file mode 100644
> > > > > index 00000000000..bb8acb99a40
> > > > > --- /dev/null
> > > > > +++ b/gas/testsuite/gas/loongarch/double_quotation_marks.s
> > > > > @@ -0,0 +1,2 @@
> > > > > +# Before only support beq $t0, $t1, .L1
> > > > > +beq "$t0", "$t1", ".L1"
> > > > May you provide some explanation as to this feature's intended use case?
> > > 
> > > Agree
> > > 
> > > > Because it seems pointless otherwise without some kind of scenario
> > > > that's both valuable to support and impossible to do so without this
> > > > feature...
> > > 
> > > I think it will be consistent (with other architectures) to support
> > > quoted symbols (".L1"), but it would be odd to support quoted
> > > registers.
> > 
> > Just curiously: why did the other architectures have to support quoted
> > symbols anyway?
> 
> gas allows you to define a symbol whose name contains a special character, e.g.
> 
> "a b":
> call "a b"
> 
> I am not familiar with gas code, but if the patch needs to parse
> quotes manually, it feels like a lack of needed abstraction.
> I am expecting some function like parseIdentifier to abstract out the logic.

And there are some caveats handling the quoted strings:  on x86_64

    call "\""

is explained as "call a function named <double-quote-mark>".  I'm not
sure if we want to support the same thing...

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University


More information about the Binutils mailing list