Community
cancel
Showing results for 
Search instead for 
Did you mean: 
olzhas_r_
New Contributor I
142 Views

Missing GCC 5 builtin intrinsics for math with carry

Jump to solution
0 Kudos
1 Solution
Varsha_M_Intel
Employee
142 Views

I was able to reproduce the issue and have escalated to the engineer.

View solution in original post

9 Replies
Varsha_M_Intel
Employee
142 Views

Hi ,
Could you provide us a sample code snippet to reproduce this issue?

Thanks,
Varsha

olzhas_r_
New Contributor I
142 Views
Varsha_M_Intel
Employee
143 Views

I was able to reproduce the issue and have escalated to the engineer.

View solution in original post

nemequ
New Contributor I
142 Views

This should be fixed (assuming __GNUC__ >= 5), but if you need something portable in the meantime see https://github.com/nemequ/safe-math (it assumes those builtins are available if __GNUC__ >= 5, but it would be trivial to add an exception for ICC, or you could just define SAFE_FORCE_PORTABLE before including the header).

olzhas_r_
New Contributor I
142 Views

Hi Evan, nice to see you here! I posted your solution and this forum into gnome issue.

THIAGO_M_Intel1
Employee
142 Views

Note that ICC does have intrinsics that are much older than GCC's and Clang's. They are the same as MSVC's: _addcarry_u32 and _addcarry_u64 (see https://software.intel.com/en-us/node/523867), as I noted in the bug report.

nemequ
New Contributor I
142 Views

THIAGO M. (Intel) wrote:
Note that ICC does have intrinsics that are much older than GCC's and Clang's. They are the same as MSVC's: _addcarry_u32 and _addcarry_u64 (see https://software.intel.com/en-us/node/523867), as I noted in the bug report.

That's useful (and I'll add those to my safe math header as soon as I have time), but I think the point is that if ICC is going to masquerade as a version of GCC it should support all the builtins, attributes, etc., that that version of GCC supports.  If that's not possible, it should stick to masquerading as an older version of GCC (clang 3.8 masquerades as GCC 4.2.1), but add support for clang's __has_{attribute,warning,feature,builtin} macros for more advanced functionality.

Also, note that GCC's intrinsics support addition, subtraction, and multiplication, whereas ICC (AFAICT) only supports addition.

Finally, GCC has type-generic versions (__builtin_{add,sub,mul}_overflow).

olzhas_r_
New Contributor I
142 Views

Still missing in the new icc 17.

olzhas_r_
New Contributor I
142 Views

Looks fixed in icc 17.0.1.

Thanks!

Reply