https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97387
Bug ID: 97387
Summary: we are near 2021, add carry intrinsic still does the
wrong thing and generates silly code.
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: euloanty at live dot com
Target Milestone: ---
#include <stdint.h>
#include <x86intrin.h>
void add256(uint64_t a[4], uint64_t b[4]){
uint8_t carry = 0;
for (int i = 0; i < 4; ++i)
carry = _addcarry_u64(carry, a[i], b[i], &a[i]);
}
People have reported the issue for many many times but the carry is still
buggy.
https://gcc.godbolt.org/z/TnM8cv