diff --git a/gcc/config/i386/bmiintrin.h b/gcc/config/i386/bmiintrin.h index 439d81cba113310b886d4116a3c1d904a5a6d8fc..92450a644ebc9c26852ba74c3ad76f945bb9451f 100644 --- a/gcc/config/i386/bmiintrin.h +++ b/gcc/config/i386/bmiintrin.h @@ -40,12 +40,24 @@ __tzcnt_u16 (unsigned short __X) return __builtin_ia32_tzcnt_u16 (__X); } +extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +_tzcnt_u16 (unsigned short __X) +{ + return __builtin_ia32_tzcnt_u16 (__X); +} + extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __andn_u32 (unsigned int __X, unsigned int __Y) { return ~__X & __Y; } +extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +_andn_u32 (unsigned int __X, unsigned int __Y) +{ + return __andn_u32 (__X, __Y); +} + extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __bextr_u32 (unsigned int __X, unsigned int __Y) { @@ -114,6 +126,12 @@ __andn_u64 (unsigned long long __X, unsigned long long __Y) return ~__X & __Y; } +extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +_andn_u64 (unsigned long long __X, unsigned long long __Y) +{ + return __andn_u64 (__X, __Y); +} + extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __bextr_u64 (unsigned long long __X, unsigned long long __Y) { diff --git a/gcc/testsuite/gcc.target/i386/bmi-1.c b/gcc/testsuite/gcc.target/i386/bmi-1.c index 738705e29d8d5abe34320ff105dca9289ae61e56..141adaac016476a5b30872b21962bb6e6d4429a5 100644 --- a/gcc/testsuite/gcc.target/i386/bmi-1.c +++ b/gcc/testsuite/gcc.target/i386/bmi-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fno-ipa-icf -mbmi " } */ -/* { dg-final { scan-assembler "andn\[^\\n]*eax" } } */ +/* { dg-final { scan-assembler-times "andn\[^\\n]*eax" 2 } } */ /* { dg-final { scan-assembler-times "bextr\[ \\t]+\[^\\n]*eax" 2 } } */ /* { dg-final { scan-assembler-times "blsi\[^\\n]*eax" 2 } } */ /* { dg-final { scan-assembler-times "blsmsk\[^\\n]*eax" 2 } } */ @@ -15,6 +15,12 @@ func_andn32 (unsigned int X, unsigned int Y) return __andn_u32(X, Y); } +unsigned int +func_andn32_2 (unsigned int X, unsigned int Y) +{ + return _andn_u32(X, Y); +} + unsigned int func_bextr32 (unsigned int X, unsigned int Y) { diff --git a/gcc/testsuite/gcc.target/i386/bmi-2.c b/gcc/testsuite/gcc.target/i386/bmi-2.c index 6b8595eb9e16baea4c31a489beda52688d7f1bf8..3f9052a499171f83c83b059c29029d8eecac6a64 100644 --- a/gcc/testsuite/gcc.target/i386/bmi-2.c +++ b/gcc/testsuite/gcc.target/i386/bmi-2.c @@ -1,6 +1,6 @@ /* { dg-do compile { target { ! ia32 } } } */ /* { dg-options "-O2 -fno-ipa-icf -mbmi " } */ -/* { dg-final { scan-assembler "andn\[^\\n]*rax" } } */ +/* { dg-final { scan-assembler-times "andn\[^\\n]*rax" 2 } } */ /* { dg-final { scan-assembler-times "bextr\[ \\t]+\[^\\n]*rax" 2 } } */ /* { dg-final { scan-assembler-times "blsi\[^\\n]*rax" 2 } } */ /* { dg-final { scan-assembler-times "blsmsk\[^\\n]*rax" 2 } } */ @@ -15,6 +15,12 @@ func_andn64 (unsigned long long X, unsigned long long Y) return __andn_u64 (X, Y); } +unsigned long long +func_andn64_2 (unsigned long long X, unsigned long long Y) +{ + return _andn_u64 (X, Y); +} + unsigned long long func_bextr64 (unsigned long long X, unsigned long long Y) { diff --git a/gcc/testsuite/gcc.target/i386/bmi-3.c b/gcc/testsuite/gcc.target/i386/bmi-3.c index ddc5e0f66e2abe642768b430f3598bac7539f565..0b91bc25bf8eeb367f0d30b0ebaf55a41184df23 100644 --- a/gcc/testsuite/gcc.target/i386/bmi-3.c +++ b/gcc/testsuite/gcc.target/i386/bmi-3.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mbmi " } */ -/* { dg-final { scan-assembler "tzcntw\[^\\n]*(%|)ax" } } */ +/* { dg-final { scan-assembler-times "tzcntw\[^\\n]*%?ax" 2 } } */ #include <x86intrin.h> @@ -9,3 +9,9 @@ func_tzcnt16 (unsigned short X) { return __tzcnt_u16(X); } + +unsigned short +func_tzcnt16_2 (unsigned short X) +{ + return _tzcnt_u16(X); +}