[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #60316] New warnings, errors showing up during
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation |
Date: |
Fri, 2 Apr 2021 12:45:34 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36 |
Follow-up Comment #11, bug #60316 (project octave):
I admit I don't know what the driving motivation here is.
If it is to detect overflow, then generally the fastest way is going to be via
hardware. Do the calculation and then check the overflow flag from the CPU.
This is generally just one instruction since there is always a BRANCH-ON-FLAG
assembly instruction.
If the hardware does not support this (e.g., MIPS) then you need to resort to
software workarounds with gnulib bit-inspection functions being an example.
This thread is useful on the general topic:
https://stackoverflow.com/questions/199333/how-do-i-detect-unsigned-integer-multiply-overflow
Specifically, there are gcc/clang extensions such as
__builtin_umull_overflow(b, c, &c_test) which will perform the multiply and
overflow detection in the most expedient way possible (HW if available, SW if
not supported by target CPU).
It might be worth having #ifdef's in the code and having this HW fast path if
this is going to become a frequent need in Octave (for example, implementing
saturation semantics).
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?60316>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, Markus Mützel, 2021/04/01
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, Rik, 2021/04/01
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, Dmitri A. Sergatskov, 2021/04/01
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, Rik, 2021/04/01
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, John W. Eaton, 2021/04/01
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, Markus Mützel, 2021/04/02
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, Rik, 2021/04/02
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, John W. Eaton, 2021/04/02
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, John W. Eaton, 2021/04/02
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation,
Rik <=
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, Markus Mützel, 2021/04/02
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, John W. Eaton, 2021/04/02
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, Rik, 2021/04/02
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, Markus Mützel, 2021/04/03
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, Rik, 2021/04/05
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, Markus Mützel, 2021/04/05
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, Rik, 2021/04/05
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, Markus Mützel, 2021/04/06
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, Markus Mützel, 2021/04/06
- [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation, Kai Torben Ohlhus, 2021/04/06