Commit 27d229f7 by Richard Sandiford Committed by Richard Sandiford

Fix multiple_p for two non-poly_ints

Fix a stupid inversion.  This function is very rarely used and was
mostly to help split patches up, which is why it didn't get picked
up during initial testing.

2017-12-20  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	* poly-int.h (multiple_p): Fix handling of two non-poly_ints.

gcc/testsuite/
	* gcc.dg/plugin/poly-int-tests.h (test_nonpoly_multiple_p): New
	function.
	(test_nonpoly_type): Call it.

From-SVN: r255860
parent f4dd468f
2017-12-20 Richard Sandiford <richard.sandiford@linaro.org>
* poly-int.h (multiple_p): Fix handling of two non-poly_ints.
2017-12-20 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2017-12-20 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* doc/invoke.texi (ARM Options): Document accepted extension options * doc/invoke.texi (ARM Options): Document accepted extension options
...@@ -2027,7 +2027,7 @@ template<typename Ca, typename Cb> ...@@ -2027,7 +2027,7 @@ template<typename Ca, typename Cb>
inline typename if_nonpoly2<Ca, Cb, bool>::type inline typename if_nonpoly2<Ca, Cb, bool>::type
multiple_p (Ca a, Cb b) multiple_p (Ca a, Cb b)
{ {
return a % b != 0; return a % b == 0;
} }
/* Return true if A is a (polynomial) multiple of B. */ /* Return true if A is a (polynomial) multiple of B. */
......
2017-12-20 Richard Sandiford <richard.sandiford@linaro.org>
* gcc.dg/plugin/poly-int-tests.h (test_nonpoly_multiple_p): New
function.
(test_nonpoly_type): Call it.
2017-12-20 Jakub Jelinek <jakub@redhat.com> 2017-12-20 Jakub Jelinek <jakub@redhat.com>
PR c++/83490 PR c++/83490
......
...@@ -4505,6 +4505,19 @@ test_uhwi () ...@@ -4505,6 +4505,19 @@ test_uhwi ()
wi::uhwi (210, 16))); wi::uhwi (210, 16)));
} }
/* Test multiple_p for non-polynomial T. */
template<typename T>
static void
test_nonpoly_multiple_p ()
{
ASSERT_TRUE (multiple_p (T (6), T (2)));
ASSERT_TRUE (multiple_p (T (6), T (3)));
ASSERT_FALSE (multiple_p (T (6), T (4)));
ASSERT_FALSE (multiple_p (T (7), T (4)));
ASSERT_TRUE (multiple_p (T (8), T (4)));
}
/* Test known_size_p for non-polynomial T. */ /* Test known_size_p for non-polynomial T. */
template<typename T> template<typename T>
...@@ -4523,6 +4536,7 @@ template<typename T> ...@@ -4523,6 +4536,7 @@ template<typename T>
static void static void
test_nonpoly_type () test_nonpoly_type ()
{ {
test_nonpoly_multiple_p<T> ();
test_nonpoly_known_size_p<T> (); test_nonpoly_known_size_p<T> ();
} }
......
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