Hello! Apparently, Intel changed operand order with the new intrinsic reference release version. Attached patch updates gcc intrinsic headers accordingly.
2017-07-04 Uros Bizjak <ubiz...@gmail.com> PR target/81294 * config/i386/adxintrin.h (_subborrow_u32): Swap _X and _Y arguments in the call to __builtin_ia32_sbb_u32. (_subborrow_u64): Swap _X and _Y arguments in the call to __builtin_ia32_sbb_u64. testsuite/ChangeLog: 2017-07-04 Uros Bizjak <ubiz...@gmail.com> PR target/81249 * gcc.target/i386/adx_addcarryx32-2.c (adx_test): Swap x and y arguments in the call to _subborrow_u32. * gcc.target/i386/adx_addcarryx64-2.c (adx_test): Swap x and y arguments in the call to _subborrow_u64. * gcc.target/i386/pr81294-1.c: New test. * gcc.target/i386/pr81294-2.c: Ditto. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Committed to mainline SVN, willbe backported to release branches. Uros.
Index: config/i386/adxintrin.h =================================================================== --- config/i386/adxintrin.h (revision 249971) +++ config/i386/adxintrin.h (working copy) @@ -33,7 +33,7 @@ _subborrow_u32 (unsigned char __CF, unsigned int __X, unsigned int __Y, unsigned int *__P) { - return __builtin_ia32_sbb_u32 (__CF, __Y, __X, __P); + return __builtin_ia32_sbb_u32 (__CF, __X, __Y, __P); } extern __inline unsigned char @@ -58,7 +58,7 @@ _subborrow_u64 (unsigned char __CF, unsigned long long __X, unsigned long long __Y, unsigned long long *__P) { - return __builtin_ia32_sbb_u64 (__CF, __Y, __X, __P); + return __builtin_ia32_sbb_u64 (__CF, __X, __Y, __P); } extern __inline unsigned char Index: testsuite/gcc.target/i386/adx-addcarryx32-2.c =================================================================== --- testsuite/gcc.target/i386/adx-addcarryx32-2.c (revision 249971) +++ testsuite/gcc.target/i386/adx-addcarryx32-2.c (working copy) @@ -44,9 +44,9 @@ sum_ref = 0x0; /* X = 0x00000001, Y = 0x00000000, C = 0. */ - c = _subborrow_u32 (c, x, y, &x); + c = _subborrow_u32 (c, y, x, &x); /* X = 0xFFFFFFFF, Y = 0x00000000, C = 1. */ - c = _subborrow_u32 (c, x, y, &x); + c = _subborrow_u32 (c, y, x, &x); /* X = 0xFFFFFFFF, Y = 0xFFFFFFFF, C = 1. */ if (x != sum_ref) Index: testsuite/gcc.target/i386/adx-addcarryx64-2.c =================================================================== --- testsuite/gcc.target/i386/adx-addcarryx64-2.c (revision 249971) +++ testsuite/gcc.target/i386/adx-addcarryx64-2.c (working copy) @@ -44,9 +44,9 @@ sum_ref = 0x0LL; /* X = 0x0000000000000001, Y = 0x0000000000000000, C = 0. */ - c = _subborrow_u64 (c, x, y, &x); + c = _subborrow_u64 (c, y, x, &x); /* X = 0xFFFFFFFFFFFFFFFF, Y = 0x0000000000000000, C = 1. */ - c = _subborrow_u64 (c, x, y, &x); + c = _subborrow_u64 (c, y, x, &x); /* X = 0x0000000000000000, Y = 0x0000000000000000, C = 1. */ if (x != sum_ref) Index: testsuite/gcc.target/i386/pr81294-1.c =================================================================== --- testsuite/gcc.target/i386/pr81294-1.c (nonexistent) +++ testsuite/gcc.target/i386/pr81294-1.c (working copy) @@ -0,0 +1,29 @@ +/* PR target/81294 */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +#include <x86intrin.h> + +int +main () +{ + volatile unsigned char c; + unsigned int x; + volatile unsigned int y, sum_ref; + + c = 0; + x = 1; + y = 0; + sum_ref = 0x0; + + /* X = 0x00000001, Y = 0x00000000, C = 0. */ + c = _subborrow_u32 (c, y, x, &x); + /* X = 0xFFFFFFFF, Y = 0x00000000, C = 1. */ + c = _subborrow_u32 (c, y, x, &x); + /* X = 0xFFFFFFFF, Y = 0xFFFFFFFF, C = 1. */ + + if (x != sum_ref) + __builtin_abort (); + + return 0; +} Index: testsuite/gcc.target/i386/pr81294-2.c =================================================================== --- testsuite/gcc.target/i386/pr81294-2.c (nonexistent) +++ testsuite/gcc.target/i386/pr81294-2.c (working copy) @@ -0,0 +1,28 @@ +/* PR target/81294 */ +/* { dg-do run { target { ! ia32 } } } */ +/* { dg-options "-O2" } */ + +#include <x86intrin.h> + +int main () +{ + volatile unsigned char c; + unsigned long long x; + volatile unsigned long long y, sum_ref; + + c = 0; + x = 1LL; + y = 0LL; + sum_ref = 0x0LL; + + /* X = 0x0000000000000001, Y = 0x0000000000000000, C = 0. */ + c = _subborrow_u64 (c, y, x, &x); + /* X = 0xFFFFFFFFFFFFFFFF, Y = 0x0000000000000000, C = 1. */ + c = _subborrow_u64 (c, y, x, &x); + /* X = 0x0000000000000000, Y = 0x0000000000000000, C = 1. */ + + if (x != sum_ref) + __builtin_abort (); + + return 0; +}