aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2017-07-04 22:46:38 +0200
committerUros Bizjak <uros@gcc.gnu.org>2017-07-04 22:46:38 +0200
commit1fcfac88dec24a5ae005a82b1aa85e0e4291a81e (patch)
tree991f689dd7afb95aab39937ce680608b512b9c06 /gcc
parent06a1b2334039de170886563546096fffa79c804d (diff)
downloadgcc-1fcfac88dec24a5ae005a82b1aa85e0e4291a81e.zip
gcc-1fcfac88dec24a5ae005a82b1aa85e0e4291a81e.tar.gz
gcc-1fcfac88dec24a5ae005a82b1aa85e0e4291a81e.tar.bz2
re PR target/81294 (_subborrow_u64 argument order inconsistent with intrinsic reference, icc)
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: PR target/81294 * 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. From-SVN: r249976
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/i386/adxintrin.h4
-rw-r--r--gcc/testsuite/ChangeLog10
-rw-r--r--gcc/testsuite/gcc.target/i386/adx-addcarryx32-2.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/adx-addcarryx64-2.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr81294-1.c29
-rw-r--r--gcc/testsuite/gcc.target/i386/pr81294-2.c28
7 files changed, 81 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d57f764..e09edc9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2017-07-04 Uros Bizjak <ubizjak@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.
+
2017-07-04 Jakub Jelinek <jakub@redhat.com>
PR debug/81278
diff --git a/gcc/config/i386/adxintrin.h b/gcc/config/i386/adxintrin.h
index 9c4152b..7acdaf4 100644
--- a/gcc/config/i386/adxintrin.h
+++ b/gcc/config/i386/adxintrin.h
@@ -33,7 +33,7 @@ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_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 @@ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_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
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f1fbe61..18ec214 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2017-07-04 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/81294
+ * 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.
+
2017-07-04 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* gcc.target/aarch64/simd/vminmaxnm_1.c: Fix strict aliasing issues.
diff --git a/gcc/testsuite/gcc.target/i386/adx-addcarryx32-2.c b/gcc/testsuite/gcc.target/i386/adx-addcarryx32-2.c
index b1da555..ddee754 100644
--- a/gcc/testsuite/gcc.target/i386/adx-addcarryx32-2.c
+++ b/gcc/testsuite/gcc.target/i386/adx-addcarryx32-2.c
@@ -44,9 +44,9 @@ adx_test (void)
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)
diff --git a/gcc/testsuite/gcc.target/i386/adx-addcarryx64-2.c b/gcc/testsuite/gcc.target/i386/adx-addcarryx64-2.c
index b326291..287e263 100644
--- a/gcc/testsuite/gcc.target/i386/adx-addcarryx64-2.c
+++ b/gcc/testsuite/gcc.target/i386/adx-addcarryx64-2.c
@@ -44,9 +44,9 @@ adx_test (void)
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)
diff --git a/gcc/testsuite/gcc.target/i386/pr81294-1.c b/gcc/testsuite/gcc.target/i386/pr81294-1.c
new file mode 100644
index 0000000..6a15ed0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr81294-1.c
@@ -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;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr81294-2.c b/gcc/testsuite/gcc.target/i386/pr81294-2.c
new file mode 100644
index 0000000..3e3bdb4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr81294-2.c
@@ -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;
+}