tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Request: __attribute__((vector_size))


From: Michael Matz
Subject: Re: [Tinycc-devel] Request: __attribute__((vector_size))
Date: Tue, 7 Jan 2020 01:33:10 +0100 (CET)
User-agent: Alpine 2.21 (LSU 202 2017-01-01)

Hi,

On Mon, 6 Jan 2020, ian wrote:

Did I miss something ?
It seemed to me that it was dealing with application side of things.

Sure, Rasmus asked to have this extension in TCC to be able to use it for writing libraries or apps; i.e. he asked if TCC could be extended to compile code like this:

---------------------
typedef int v4si __attribute__ ((vector_size (16)));
void foo (void) {
  v4si a = {1,2,3,4}, b = {5,6,7,8}, c;
  c = a + b;
  bar(c[0], c[1], c[2], c[3]);
}
---------------------

For that TCC would need to be extended somewhat, and I was alluding to the fact that this extension isn't totally trivial if it shouldn't generate very low quality code. If it's okay to generate low quality code and not adhere to the psABI for parameter passing of these types then it's not too much work.

If you were asking if such extension is really a must have in a compiler: no, otherwise it wouldn't be an extension. It's a nice to have, and I can see why Rasmus wants it, but it comes at a non-trivial cost to support it in a small compiler.


Ciao,
Michael.

Like, say, libraries. For the least, as long as compilers does not care
about maths or physics....

If I'm wrong, please, explain to me where...

ian

Le 06/01/2020 à 21:46, Michael Matz a écrit :
      Hi,

      On Mon, 6 Jan 2020, ian wrote:

            Is the support for data structures and calculations
            a real "need to" for a compiler ????


      Um, I don't know how to answer this.  As it seems the
      alternative to calculations is guessing, yes, I do think
      calculations and data structures are indeed necessary for a
      compiler, or any program whatsoever.


      Ciao,
      Michael.


            regards,

            ian

            Le 06/01/2020 à 20:36, Michael Matz a écrit :
                  Hello,

                  On Mon, 6 Jan 2020, Rasmus Riiner via
            Tinycc-devel wrote:

                        See here:
                       
            https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html

                        This is one of those things that doesn't
            come up in
                        a lot of types of programming, but is
            indispensable
                        in some, namely anything to do with 2D
            or 3D math.
                        The ability to just write `position +=
            velocity *
                        dt;` style statements might be one of
            the most
                        important reasons most game developers
            choose C++
                        over C. It's certainly the only thing
            keeping me
                        from using TCC in the development of my
            own project.

                        Actually emitting SSE instructions might
            be beyond
                        the scope of tcc (Tiny after all),
            supporting the
                        expressions though would be a huge help.


                  Without proper support in the backends for
            vector instructions
                  the generated code for this extension from TCC
            would be of
                  abysmal quality. Technically it wouldn't be
            too much work to
                  semantically support that, but the values
            would need to be
                  committed to memory (instead of vector
            registers) and regarded
                  as constant sized arrays (at which point the
            function call ABI
                  would be different from the respective native
            ABI, which, again,
                  would be hard to fix without proper support
            for vector insns in
                  the backends).

                  That extension really doesn't feel very well
            suited for a simple
                  compiler like TCC ;-)  But perhaps it can be
            done
                  non-intrusively enough.

                        I sat down yesterday in an attempt to do
            this
                        myself, but it turns out I'm not good
            enough for the
                        job. I couldn't make heads or tails of
            it. However,
                        this might be a breeze for someone that
            knows TCC
                        like the back of their hand.

                        So, any takers?



                  Ciao,
                  Michael.

                 
            _______________________________________________
                  Tinycc-devel mailing list
                  address@hidden
                 
            https://lists.nongnu.org/mailman/listinfo/tinycc-devel

            --
            -- address@hidden
            -- Développeur compulsif



_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

--
-- address@hidden
-- Développeur compulsif


reply via email to

[Prev in Thread] Current Thread [Next in Thread]