[PATCH] rs6000: Add new __builtin_vsx_build_pair and __builtin_mma_build_acc built-ins

Segher Boessenkool segher@kernel.crashing.org
Thu Jun 10 20:40:57 GMT 2021


On Thu, Jun 10, 2021 at 10:43:05AM -0500, Peter Bergner wrote:
> On 6/9/21 4:38 PM, Segher Boessenkool wrote:
> > I think this reads simpler as
> >       /* The ASSEMBLE builtin source operands are reversed in little-endian
> > 	 mode, so reorder them.  */
> >       if (fcode == VSX_BUILTIN_ASSEMBLE_PAIR_INTERNAL && !WORDS_BIG_ENDIAN)
> > 	std::swap (op[1], op[2]);
> >       pat = GEN_FCN (icode) (op[0], op[1], op[2]);
> > do you agree?
> 
> Do I think C++ is simpler than plain C?  Is this a trick question? ;-)

I *like* std::swap.  It is one of the few C++ things that is clearly
nice: it gives nice, unsurprising semantics, for nice, unsurprising
syntax, and it does exactly what you expect, and this can be described
in a few words, without needing any special concepts.  It does something
that cannot be done easily some other way.  It is utterly local.

Yup, I like it.

I often do not like C++ because it *is* surprising, often has things
spread out over different parts of your program, and distracts from the
one kind of programming style that C++ is well suited for: imperative
programming.  That is also the style that most of most compilers are
written in, for good reasons.

The main consumers of programs are *humans*.  So programs have to be
clear to people.  Modern C style helps that a lot.  Most C++ is the
opposite.  Perhaps this is because C++ gives you so many ways to write
unclear programs, because it has so many features that can be overused,
I do not know what it is exactly.

</rant>

Either way, I asked if you like my suggestion, you do not have to take
it if you don't :-)

> >> +	      int index = WORDS_BIG_ENDIAN ? i: nvecs - 1 - i;
> > 
> > Space before colon.
> 
> Ah, thanks for catching that!

Yeah I do not miss the important problems!

> Ok, I'll retest with the above (but still removing the assemble
> built-in documentation) and push it if it's clean.  Thanks!

Great, thank you!


Segher


More information about the Gcc-patches mailing list