summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-28 09:02:46 +0000
committerkyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-28 09:02:46 +0000
commit556f149b243f5081a6278a9162d457e2149efcd6 (patch)
tree8927f2efac9e7afffc6ab91b5dcbb85b52659abe
parent2ec7ae7790f58b4d9232be16dc674c4aa13e9a7e (diff)
downloadgcc-556f149b243f5081a6278a9162d457e2149efcd6.tar.gz
ChangeLog:
* config/i386/bmiintrin.h (_bextr_u32): New. (_bextr_u64): Ditto. testsuite/ChangeLog: * gcc.target/i386/bmi-1.c: Extend with new instrinsic. Fix scan patterns. * gcc.target/i386/bmi-1.c: Ditto. * gcc.target/i386/bmi-bextr-4.c: New. * gcc.target/i386/bmi-bextr-5.c: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200505 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/i386/bmiintrin.h12
-rw-r--r--gcc/testsuite/ChangeLog14
-rw-r--r--gcc/testsuite/gcc.target/i386/bmi-1.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/bmi-2.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/bmi-bextr-4.c49
-rw-r--r--gcc/testsuite/gcc.target/i386/bmi-bextr-5.c48
7 files changed, 154 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 37eacf446b6..251de55c578 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2013-06-28 Kirill Yukhin <kirill.yukhin@intel.com>
+
+ * config/i386/bmiintrin.h (_bextr_u32): New.
+ (_bextr_u64): Ditto.
+
2013-06-27 Richard Sandiford <rdsandiford@googlemail.com>
* config.gcc (mips*-mti-elf*, mips*-sde-elf*, mips64r5900-*-elf*)
@@ -19,7 +24,7 @@
* config/mips/mips.h (BASE_DRIVER_SELF_SPECS): m14ke* implies
-mdspr2.
* doc/invoke.texi: Add -m14kc.
-
+
2013-06-27 Jakub Jelinek <jakub@redhat.com>
PR target/57623
diff --git a/gcc/config/i386/bmiintrin.h b/gcc/config/i386/bmiintrin.h
index cb6ffa556ff..281ebaaf4f2 100644
--- a/gcc/config/i386/bmiintrin.h
+++ b/gcc/config/i386/bmiintrin.h
@@ -54,6 +54,12 @@ __bextr_u32 (unsigned int __X, unsigned int __Y)
}
extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_bextr_u32 (unsigned int __X, unsigned int __Y, unsigned __Z)
+{
+ return __builtin_ia32_bextr_u32 (__X, ((__Y & 0xff) | ((__Z & 0xff) << 8)));
+}
+
+extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
__blsi_u32 (unsigned int __X)
{
return __X & -__X;
@@ -93,6 +99,12 @@ __bextr_u64 (unsigned long long __X, unsigned long long __Y)
}
extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_bextr_u64 (unsigned long long __X, unsigned int __Y, unsigned int __Z)
+{
+ return __builtin_ia32_bextr_u64 (__X, ((__Y & 0xff) | ((__Z & 0xff) << 8)));
+}
+
+extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
__blsi_u64 (unsigned long long __X)
{
return __X & -__X;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2c2443f6a1e..e810fbe4ab7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2013-06-28 Kirill Yukhin <kirill.yukhin@intel.com>
+
+ * gcc.target/i386/bmi-1.c: Extend with new instrinsic.
+ Fix scan patterns.
+ * gcc.target/i386/bmi-1.c: Ditto.
+ * gcc.target/i386/bmi-bextr-4.c: New.
+ * gcc.target/i386/bmi-bextr-5.c: Ditto.
+
2013-06-28 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57682
@@ -152,7 +160,7 @@
* g++.dg/cilk-plus/AN/postincr_test.cc: Likewise.
* g++.dg/cilk-plus/cilk-plus.exp: New script.
* gcc/testsuite/g++.dg/dg.exp: Included Cilk Plus C++ tests in the list.
-
+
2013-06-21 Joseph Myers <joseph@codesourcery.com>
PR other/53317
@@ -442,7 +450,7 @@
PR c/57563
* c-c++-common/cilk-plus/AN/builtin_fn_mutating.c (main): Fixed a bug
- in how we check __sec_reduce_mutating function's result.
+ in how we check __sec_reduce_mutating function's result.
2013-06-10 Michael Meissner <meissner@linux.vnet.ibm.com>
Pat Haugen <pthaugen@us.ibm.com>
@@ -810,7 +818,7 @@
* c-c++-common/cilk-plus/AN/if_test_errors.c (main): New testcase.
* c-c++-common/cilk-plus/AN/rank_mismatch.c: Added a '-w' option to
dg-option and an header comment.
-
+
2013-06-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57419
diff --git a/gcc/testsuite/gcc.target/i386/bmi-1.c b/gcc/testsuite/gcc.target/i386/bmi-1.c
index dc964ba3d92..a05cb275adc 100644
--- a/gcc/testsuite/gcc.target/i386/bmi-1.c
+++ b/gcc/testsuite/gcc.target/i386/bmi-1.c
@@ -1,11 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mbmi " } */
-/* { dg-final { scan-assembler "andn\[^\\n]*(%|)eax" } } */
-/* { dg-final { scan-assembler "bextr\[^\\n]*(%|)eax" } } */
-/* { dg-final { scan-assembler "blsi\[^\\n]*(%|)eax" } } */
-/* { dg-final { scan-assembler "blsmsk\[^\\n]*(%|)eax" } } */
-/* { dg-final { scan-assembler "blsr\[^\\n]*(%|)eax" } } */
-/* { dg-final { scan-assembler "tzcntl\[^\\n]*(%|)eax" } } */
+/* { dg-final { scan-assembler "andn\[^\\n]*eax" } } */
+/* { dg-final { scan-assembler-times "bextr\[ \\t]+\[^\\n]*eax" 2 } } */
+/* { dg-final { scan-assembler "blsi\[^\\n]*eax" } } */
+/* { dg-final { scan-assembler "blsmsk\[^\\n]*eax" } } */
+/* { dg-final { scan-assembler "blsr\[^\\n]*eax" } } */
+/* { dg-final { scan-assembler "tzcntl\[^\\n]*eax" } } */
#include <x86intrin.h>
@@ -22,6 +22,14 @@ func_bextr32 (unsigned int X, unsigned int Y)
}
unsigned int
+func_bextr32_3args (unsigned int X,
+ unsigned int Y,
+ unsigned int Z)
+{
+ return _bextr_u32(X, Y, Z);
+}
+
+unsigned int
func_blsi32 (unsigned int X)
{
return __blsi_u32(X);
diff --git a/gcc/testsuite/gcc.target/i386/bmi-2.c b/gcc/testsuite/gcc.target/i386/bmi-2.c
index 56f73876d0c..68d06a20540 100644
--- a/gcc/testsuite/gcc.target/i386/bmi-2.c
+++ b/gcc/testsuite/gcc.target/i386/bmi-2.c
@@ -1,11 +1,11 @@
/* { dg-do compile { target { ! { ia32 } } } } */
/* { dg-options "-O2 -mbmi " } */
-/* { dg-final { scan-assembler "andn\[^\\n]*(%|)rax" } } */
-/* { dg-final { scan-assembler "bextr\[^\\n]*(%|)rax" } } */
-/* { dg-final { scan-assembler "blsi\[^\\n]*(%|)rax" } } */
-/* { dg-final { scan-assembler "blsmsk\[^\\n]*(%|)rax" } } */
-/* { dg-final { scan-assembler "blsr\[^\\n]*(%|)rax" } } */
-/* { dg-final { scan-assembler "tzcntq\[^\\n]*(%|)rax" } } */
+/* { dg-final { scan-assembler "andn\[^\\n]*rax" } } */
+/* { dg-final { scan-assembler-times "bextr\[ \\t]+\[^\\n]*rax" 2 } } */
+/* { dg-final { scan-assembler "blsi\[^\\n]*rax" } } */
+/* { dg-final { scan-assembler "blsmsk\[^\\n]*rax" } } */
+/* { dg-final { scan-assembler "blsr\[^\\n]*rax" } } */
+/* { dg-final { scan-assembler "tzcntq\[^\\n]*rax" } } */
#include <x86intrin.h>
@@ -22,6 +22,14 @@ func_bextr64 (unsigned long long X, unsigned long long Y)
}
unsigned long long
+func_bextr64_3args (unsigned long long X,
+ unsigned long long Y,
+ unsigned long long Z)
+{
+ return _bextr_u64 (X, Y, Z);
+}
+
+unsigned long long
func_blsi64 (unsigned long long X)
{
return __blsi_u64 (X);
diff --git a/gcc/testsuite/gcc.target/i386/bmi-bextr-4.c b/gcc/testsuite/gcc.target/i386/bmi-bextr-4.c
new file mode 100644
index 00000000000..2318847ae33
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/bmi-bextr-4.c
@@ -0,0 +1,49 @@
+/* { dg-do run { target { bmi } } } */
+/* { dg-require-effective-target bmi } */
+/* { dg-options "-O2 -mbmi -fno-inline" } */
+
+#include <x86intrin.h>
+
+#include "bmi-check.h"
+
+unsigned calc_bextr_u32 (unsigned src1, unsigned src2)
+{
+ unsigned res = 0;
+ unsigned char start = (src2 & 0xff);
+ unsigned char len = (int) ((src2 >> 8) & 0xff);
+ if (start < 32) {
+ unsigned i;
+ unsigned last = (start+len) < 32 ? start+len : 32;
+
+ src1 >>= start;
+ for (i=start; i<last; ++i) {
+ res |= (src1 & 1) << (i-start);
+ src1 >>= 1;
+ }
+ }
+
+ return res;
+}
+
+static void
+bmi_test ()
+{
+ unsigned i;
+ unsigned char start, len;
+ unsigned src1 = 0xfacec0ff;
+ unsigned res, res_ref, src2;
+
+ for (i=0; i<5; ++i) {
+ start = i * 4;
+ len = i * 4;
+
+ src1 = src1 * 3;
+ src2 = (start & 0xff) | ((len & 0xff) << 8);
+
+ res_ref = calc_bextr_u32 (src1, src2);
+ res = _bextr_u32 (src1, start, len);
+
+ if (res != res_ref)
+ abort();
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/bmi-bextr-5.c b/gcc/testsuite/gcc.target/i386/bmi-bextr-5.c
new file mode 100644
index 00000000000..fd6e3620fab
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/bmi-bextr-5.c
@@ -0,0 +1,48 @@
+/* { dg-do run { target { bmi && { ! ia32 } } } } */
+/* { dg-options "-O2 -mbmi -fno-inline" } */
+
+#include <x86intrin.h>
+
+#include "bmi-check.h"
+
+long long calc_bextr_u64 (unsigned long long src1,
+ unsigned long long src2)
+{
+ long long res = 0;
+ unsigned char start = (src2 & 0xff);
+ unsigned char len = (int) ((src2 >> 8) & 0xff);
+ if (start < 64) {
+ unsigned i;
+ unsigned last = (start+len) < 64 ? start+len : 64;
+
+ src1 >>= start;
+ for (i=start; i<last; ++i) {
+ res |= (src1 & 1) << (i-start);
+ src1 >>= 1;
+ }
+ }
+
+ return res;
+}
+
+static void
+bmi_test ()
+{
+ unsigned i;
+ unsigned char start, len;
+ unsigned long long src1 = 0xfacec0ffeefacec0;
+ unsigned long long res, res_ref, src2;
+
+ for (i=0; i<5; ++i) {
+ start = i * 4;
+ len = i * 3;
+ src1 = src1 * 3;
+ src2 = (start & 0xff) | ((len & 0xff) << 8);
+
+ res_ref = calc_bextr_u64 (src1, src2);
+ res = _bextr_u64 (src1, start, len);
+
+ if (res != res_ref)
+ abort();
+ }
+}