Commit 5bac1edb by Jakub Jelinek Committed by Jakub Jelinek

re PR target/83252 (Wrong code with "-march=skylake-avx512 -O3")

	PR target/83252
	* gcc.target/i386/i386.exp (check_effective_target_bmi2): Moved to ...
	* lib/target-supports.exp (check_effective_target_bmi2): ... here.  Guard with
	i?86-*-* x86_64-*-*.
	* g++.dg/opt/pr83252.C: New test.

From-SVN: r255487
parent 7f5aed1e
2017-12-08 Jakub Jelinek <jakub@redhat.com> 2017-12-08 Jakub Jelinek <jakub@redhat.com>
PR target/83252
* gcc.target/i386/i386.exp (check_effective_target_bmi2): Moved to ...
* lib/target-supports.exp (check_effective_target_bmi2): ... here. Guard with
i?86-*-* x86_64-*-*.
* g++.dg/opt/pr83252.C: New test.
PR target/81906 PR target/81906
* gcc.target/i386/pr81906.c: New test. * gcc.target/i386/pr81906.c: New test.
......
// PR target/83252
// { dg-do run }
// { dg-options "-O3" }
// { dg-additional-options "-mbmi2 -mtune=intel" { target bmi2 } }
#if __SIZEOF_INT__ == 4 && __SIZEOF_LONG_LONG__ == 8 && __CHAR_BIT__ == 8
#ifdef __BMI2__
#include "../../gcc.target/i386/bmi2-check.h"
#endif
long long h = 707493562598231894LL, i, n, x3, x5;
long long j, l = -2228108721620697360LL, o, y9;
int k, p, r, s, t = 2, u, w, z8, x7, y4, y5, y6, y7, y8, x1, x2, x4, x6, d;
unsigned v, x = 751359462, z = 1, y3 = 60;
unsigned *y = &x, *z2 = &z, *z3 = &v;
unsigned long long z1 = 2;
unsigned long long *z4 = &z1;
long long *z7;
unsigned long long z9 = 7091529791657LL;
void
foo ()
{
if ((-2783342978U * (int) l || z) && z2 && h && z1 && z9 & ~-(-2783342978U * (int) l))
{
i = 3060393125LL < n;
y7 = o >> *y - 751359400;
*z3 = x7;
long a = (o >> *y - 751359400 >> ~-(-2783342978U * (int) l) - 88480234) - (-2783342978U * (int) l);
y6 = a;
if (~0 % *z4 % 5)
y8 = -3 * (l - 4 ? : 407228174574);
if (y3 < 1)
{
long long *b = &y9;
z3 = 0;
int c = *z2;
*z7 = 0;
x1 = ~(-((unsigned) (-2783342978U * (unsigned long long) l)));
p = *b & j;
x2 = c;
}
else
{
j = 0;
int e = !0 % (7 % *z4);
r = ((s || !k) && t) - -(-2783342978U * (unsigned long long) l);
x3 = o >> *y - 751359400;
y9 = z9;
long f = o >> *y - 751359400 >> ~-(-2783342978U * (int) l) - 88480234;
x4 = z1;
u = n * f * e * y4;
}
if (8ULL * -(-(-2783342978U * (int) l)))
;
else
{
*z3 = 0;
int g = 3 & y5;
x5 = (unsigned) (~o + 9223372036854775807 >> l);
z8 = g + y9;
v = j || ~0 + 9223372036854775807 >> ~-(-2783342978U * (int) l);
x6 = o >> (8 * l);
w = *y ? -2783342978U * l : 0;
}
}
}
#ifdef __BMI2__
void
bmi2_test (void)
{
foo ();
if (r != 88480289)
__builtin_abort ();
}
#else
int
main ()
{
foo ();
if (r != 88480289)
__builtin_abort ();
}
#endif
#else
int
main ()
{
}
#endif
...@@ -207,17 +207,6 @@ proc check_effective_target_bmi { } { ...@@ -207,17 +207,6 @@ proc check_effective_target_bmi { } {
} "-mbmi" ] } "-mbmi" ]
} }
# Return 1 if bmi2 instructions can be compiled.
proc check_effective_target_bmi2 { } {
return [check_no_compiler_messages bmi2 object {
unsigned int
_bzhi_u32 (unsigned int __X, unsigned int __Y)
{
return __builtin_ia32_bzhi_si (__X, __Y);
}
} "-mbmi2" ]
}
# Return 1 if ADX instructions can be compiled. # Return 1 if ADX instructions can be compiled.
proc check_effective_target_adx { } { proc check_effective_target_adx { } {
return [check_no_compiler_messages adx object { return [check_no_compiler_messages adx object {
......
...@@ -1856,6 +1856,20 @@ proc check_effective_target_avx512f_runtime { } { ...@@ -1856,6 +1856,20 @@ proc check_effective_target_avx512f_runtime { } {
return 0 return 0
} }
# Return 1 if bmi2 instructions can be compiled.
proc check_effective_target_bmi2 { } {
if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
return 0
}
return [check_no_compiler_messages bmi2 object {
unsigned int
_bzhi_u32 (unsigned int __X, unsigned int __Y)
{
return __builtin_ia32_bzhi_si (__X, __Y);
}
} "-mbmi2" ]
}
# Return 1 if the target supports executing MIPS Paired-Single instructions, # Return 1 if the target supports executing MIPS Paired-Single instructions,
# 0 otherwise. Cache the result. # 0 otherwise. Cache the result.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment