public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* __builtin_addc support??
@ 2021-10-27 16:12 sotrdg sotrdg
  2021-10-27 16:36 ` Paul Koning
  2021-10-27 23:16 ` Segher Boessenkool
  0 siblings, 2 replies; 6+ messages in thread
From: sotrdg sotrdg @ 2021-10-27 16:12 UTC (permalink / raw)
  To: gcc, gcc-request, gcc-help

79173 – add-with-carry and subtract-with-borrow support (x86_64 and others) (gnu.org)<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79173>

What I find quite interesting is things like this.

Since llvm clang provides __builtin_addc __builtin_subc for all targets. Can we provide something similar? Since currently no solutions we can access carry flag besides x86

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: __builtin_addc support??
  2021-10-27 16:12 __builtin_addc support?? sotrdg sotrdg
@ 2021-10-27 16:36 ` Paul Koning
  2021-10-27 16:54   ` sotrdg sotrdg
  2021-10-27 23:16 ` Segher Boessenkool
  1 sibling, 1 reply; 6+ messages in thread
From: Paul Koning @ 2021-10-27 16:36 UTC (permalink / raw)
  To: sotrdg sotrdg; +Cc: GCC Development, gcc-request, gcc-help



> On Oct 27, 2021, at 12:12 PM, sotrdg sotrdg via Gcc <gcc@gcc.gnu.org> wrote:
> 
> 79173 – add-with-carry and subtract-with-borrow support (x86_64 and others) (gnu.org)<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79173>
> 
> What I find quite interesting is things like this.
> 
> Since llvm clang provides __builtin_addc __builtin_subc for all targets. Can we provide something similar? Since currently no solutions we can access carry flag besides x86

Certainly some other targets could do this.  The LLVM builtins explicitly expose carry, which isn't actually what you want (you'd want the carry flag in the condition code to be propagated).  Presumably optimization would eliminate those explicit arguments and reduce them to CC references.

	paul



^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: __builtin_addc support??
  2021-10-27 16:36 ` Paul Koning
@ 2021-10-27 16:54   ` sotrdg sotrdg
  0 siblings, 0 replies; 6+ messages in thread
From: sotrdg sotrdg @ 2021-10-27 16:54 UTC (permalink / raw)
  To: Paul Koning; +Cc: GCC Development, gcc-request, gcc-help

I just want a portable version of __builtin_addcarry and __builtin_subborrow. Of course if we have things __builtin_rcl and __builtin_rcr would be even better.

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows

From: Paul Koning<mailto:paulkoning@comcast.net>
Sent: Wednesday, October 27, 2021 12:36
To: sotrdg sotrdg<mailto:euloanty@live.com>
Cc: GCC Development<mailto:gcc@gcc.gnu.org>; gcc-request@gcc.gnu.org<mailto:gcc-request@gcc.gnu.org>; gcc-help@gcc.gnu.org<mailto:gcc-help@gcc.gnu.org>
Subject: Re: __builtin_addc support??



> On Oct 27, 2021, at 12:12 PM, sotrdg sotrdg via Gcc <gcc@gcc.gnu.org> wrote:
>
> 79173 – add-with-carry and subtract-with-borrow support (x86_64 and others) (gnu.org)<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79173>
>
> What I find quite interesting is things like this.
>
> Since llvm clang provides __builtin_addc __builtin_subc for all targets. Can we provide something similar? Since currently no solutions we can access carry flag besides x86

Certainly some other targets could do this.  The LLVM builtins explicitly expose carry, which isn't actually what you want (you'd want the carry flag in the condition code to be propagated).  Presumably optimization would eliminate those explicit arguments and reduce them to CC references.

        paul



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: __builtin_addc support??
  2021-10-27 16:12 __builtin_addc support?? sotrdg sotrdg
  2021-10-27 16:36 ` Paul Koning
@ 2021-10-27 23:16 ` Segher Boessenkool
  2021-10-27 23:22   ` sotrdg sotrdg
  2021-10-27 23:23   ` sotrdg sotrdg
  1 sibling, 2 replies; 6+ messages in thread
From: Segher Boessenkool @ 2021-10-27 23:16 UTC (permalink / raw)
  To: sotrdg sotrdg; +Cc: gcc, gcc-request, gcc-help

On Wed, Oct 27, 2021 at 04:12:27PM +0000, sotrdg sotrdg via Gcc-help wrote:
> 79173 – add-with-carry and subtract-with-borrow support (x86_64 and others) (gnu.org)<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79173>
> 
> What I find quite interesting is things like this.
> 
> Since llvm clang provides __builtin_addc __builtin_subc for all targets. Can we provide something similar? Since currently no solutions we can access carry flag besides x86

Why?  We have __builtin_add_overflow, which is a smaller factor, and
enough to build up any bigger factors with.  You can easily write the
same thing in standard C of course, which often is a better plan.

If you want exact machine insns as output, write those, i.e., write
assembler code, not C.  Builtins are not there to please the "C is a
portable assembler" crowd: they are there to expose functionality you
cannot (conveniently) get using just pure standard C.


Segher

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: __builtin_addc support??
  2021-10-27 23:16 ` Segher Boessenkool
@ 2021-10-27 23:22   ` sotrdg sotrdg
  2021-10-27 23:23   ` sotrdg sotrdg
  1 sibling, 0 replies; 6+ messages in thread
From: sotrdg sotrdg @ 2021-10-27 23:22 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: gcc, gcc-request, gcc-help

LOL

https://github.com/tearosccebe/fast_io/blob/4ca355fcbf31aa26a0259ad09671eaab899930fc/include/fast_io_core_impl/intrinsics.h#L366

You are wrong dude.
Give me solution for addcarry

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows

________________________________
From: Segher Boessenkool <segher@kernel.crashing.org>
Sent: Wednesday, October 27, 2021 7:16:41 PM
To: sotrdg sotrdg <euloanty@live.com>
Cc: gcc@gcc.gnu.org <gcc@gcc.gnu.org>; gcc-request@gcc.gnu.org <gcc-request@gcc.gnu.org>; gcc-help@gcc.gnu.org <gcc-help@gcc.gnu.org>
Subject: Re: __builtin_addc support??

On Wed, Oct 27, 2021 at 04:12:27PM +0000, sotrdg sotrdg via Gcc-help wrote:
> 79173 – add-with-carry and subtract-with-borrow support (x86_64 and others) (gnu.org)<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79173>
>
> What I find quite interesting is things like this.
>
> Since llvm clang provides __builtin_addc __builtin_subc for all targets. Can we provide something similar? Since currently no solutions we can access carry flag besides x86

Why?  We have __builtin_add_overflow, which is a smaller factor, and
enough to build up any bigger factors with.  You can easily write the
same thing in standard C of course, which often is a better plan.

If you want exact machine insns as output, write those, i.e., write
assembler code, not C.  Builtins are not there to please the "C is a
portable assembler" crowd: they are there to expose functionality you
cannot (conveniently) get using just pure standard C.


Segher

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: __builtin_addc support??
  2021-10-27 23:16 ` Segher Boessenkool
  2021-10-27 23:22   ` sotrdg sotrdg
@ 2021-10-27 23:23   ` sotrdg sotrdg
  1 sibling, 0 replies; 6+ messages in thread
From: sotrdg sotrdg @ 2021-10-27 23:23 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: gcc, gcc-request, gcc-help

HEY. ZERO COST ABSTRACTIONS lol

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows

From: Segher Boessenkool<mailto:segher@kernel.crashing.org>
Sent: Wednesday, October 27, 2021 19:17
To: sotrdg sotrdg<mailto:euloanty@live.com>
Cc: gcc@gcc.gnu.org<mailto:gcc@gcc.gnu.org>; gcc-request@gcc.gnu.org<mailto:gcc-request@gcc.gnu.org>; gcc-help@gcc.gnu.org<mailto:gcc-help@gcc.gnu.org>
Subject: Re: __builtin_addc support??

On Wed, Oct 27, 2021 at 04:12:27PM +0000, sotrdg sotrdg via Gcc-help wrote:
> 79173 – add-with-carry and subtract-with-borrow support (x86_64 and others) (gnu.org)<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79173>
>
> What I find quite interesting is things like this.
>
> Since llvm clang provides __builtin_addc __builtin_subc for all targets. Can we provide something similar? Since currently no solutions we can access carry flag besides x86

Why?  We have __builtin_add_overflow, which is a smaller factor, and
enough to build up any bigger factors with.  You can easily write the
same thing in standard C of course, which often is a better plan.

If you want exact machine insns as output, write those, i.e., write
assembler code, not C.  Builtins are not there to please the "C is a
portable assembler" crowd: they are there to expose functionality you
cannot (conveniently) get using just pure standard C.


Segher


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-10-27 23:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-27 16:12 __builtin_addc support?? sotrdg sotrdg
2021-10-27 16:36 ` Paul Koning
2021-10-27 16:54   ` sotrdg sotrdg
2021-10-27 23:16 ` Segher Boessenkool
2021-10-27 23:22   ` sotrdg sotrdg
2021-10-27 23:23   ` sotrdg sotrdg

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).