Commit 5bfba2b5 by Jakub Jelinek Committed by Jakub Jelinek

re PR rtl-optimization/87817 (gcc.target/i386/bmi2-bzhi-2.c execution test)

	PR rtl-optimization/87817
	* config/i386/i386.c (ix86_fold_builtin): For _bzhi_u{32,64} if
	last argument has low 8 bits clear, fold to 0.

	* gcc.target/i386/bmi2-bzhi-3.c (main): Add a couple of new tests.

From-SVN: r266140
parent ff4d8480
2018-11-14 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/87817
* config/i386/i386.c (ix86_fold_builtin): For _bzhi_u{32,64} if
last argument has low 8 bits clear, fold to 0.
2018-11-14 Iain Sandoe <iain@sandoe.co.uk> 2018-11-14 Iain Sandoe <iain@sandoe.co.uk>
* tree-vect-data-refs.c (vect_can_force_dr_alignment_p): Cast * tree-vect-data-refs.c (vect_can_force_dr_alignment_p): Cast
...@@ -32671,6 +32671,8 @@ ix86_fold_builtin (tree fndecl, int n_args, ...@@ -32671,6 +32671,8 @@ ix86_fold_builtin (tree fndecl, int n_args,
unsigned int idx = tree_to_uhwi (args[1]) & 0xff; unsigned int idx = tree_to_uhwi (args[1]) & 0xff;
if (idx >= TYPE_PRECISION (TREE_TYPE (args[0]))) if (idx >= TYPE_PRECISION (TREE_TYPE (args[0])))
return args[0]; return args[0];
if (idx == 0)
return build_int_cst (TREE_TYPE (TREE_TYPE (fndecl)), 0);
if (!tree_fits_uhwi_p (args[0])) if (!tree_fits_uhwi_p (args[0]))
break; break;
unsigned HOST_WIDE_INT res = tree_to_uhwi (args[0]); unsigned HOST_WIDE_INT res = tree_to_uhwi (args[0]);
2018-11-14 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/87817
* gcc.target/i386/bmi2-bzhi-3.c (main): Add a couple of new tests.
2018-11-14 Wilco Dijkstra <wdijkstr@arm.com> 2018-11-14 Wilco Dijkstra <wdijkstr@arm.com>
* gcc.target/aarch64/pr62178.c: Relax scan-assembler checks. * gcc.target/aarch64/pr62178.c: Relax scan-assembler checks.
......
...@@ -58,7 +58,11 @@ main () ...@@ -58,7 +58,11 @@ main ()
link_error (); link_error ();
if (_bzhi_u32 (c, 32) != c if (_bzhi_u32 (c, 32) != c
|| _bzhi_u32 (c, 64) != c || _bzhi_u32 (c, 64) != c
|| _bzhi_u32 (c, 255) != c) || _bzhi_u32 (c, 255) != c
|| _bzhi_u32 (c, 544) != c
|| _bzhi_u32 (c, 0) != 0
|| _bzhi_u32 (c, 256) != 0
|| _bzhi_u32 (c, 1024) != 0)
link_error (); link_error ();
#ifdef __x86_64__ #ifdef __x86_64__
if (f21 () != 0 || f22 (-1ULL) != 0 if (f21 () != 0 || f22 (-1ULL) != 0
...@@ -70,7 +74,11 @@ main () ...@@ -70,7 +74,11 @@ main ()
|| f33 () != -1ULL || f34 (-1ULL) != -1ULL) || f33 () != -1ULL || f34 (-1ULL) != -1ULL)
link_error (); link_error ();
if (_bzhi_u64 (d, 64) != d if (_bzhi_u64 (d, 64) != d
|| _bzhi_u64 (d, 255) != d) || _bzhi_u64 (d, 255) != d
|| _bzhi_u64 (d, 576) != d
|| _bzhi_u64 (d, 0) != 0
|| _bzhi_u64 (d, 256) != 0
|| _bzhi_u64 (d, 512) != 0)
link_error (); link_error ();
#endif #endif
return 0; return 0;
......
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