Fix typo in r12-5486.

Message ID 20211125075932.72179-1-hongtao.liu@intel.com
State New
Headers show
Series
  • Fix typo in r12-5486.
Related show

Commit Message

Marek Polacek via Gcc-patches Nov. 25, 2021, 7:59 a.m.
TYPE_PRECISION (type) <  TYPE_PRECISION (TREE_TYPE (@2)) supposed to check
integer type but not pointer type, so use second parameter instead.

i.e. first parameter is VPTR, second parameter is I4.

582DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_OR_4,
583                  "__atomic_fetch_or_4",
584                  BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROWCALL_LEAF_LIST)


Bootstrapped and regtested on x86_64-linux-gnu{-m32,}.
Failed testcases in PR are verified.
Ok for trunk?

gcc/ChangeLog:

	PR middle-end/103419
	* match.pd: Fix typo, use the type of second parameter, not
	first one.
---
 gcc/match.pd | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

-- 
2.18.1

Comments

Marek Polacek via Gcc-patches Nov. 25, 2021, 10:38 a.m. | #1
On Thu, Nov 25, 2021 at 9:00 AM liuhongt via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>

> TYPE_PRECISION (type) <  TYPE_PRECISION (TREE_TYPE (@2)) supposed to check

> integer type but not pointer type, so use second parameter instead.

>

> i.e. first parameter is VPTR, second parameter is I4.

>

> 582DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_OR_4,

> 583                  "__atomic_fetch_or_4",

> 584                  BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROWCALL_LEAF_LIST)

>

>

> Bootstrapped and regtested on x86_64-linux-gnu{-m32,}.

> Failed testcases in PR are verified.

> Ok for trunk?


OK.

> gcc/ChangeLog:

>

>         PR middle-end/103419

>         * match.pd: Fix typo, use the type of second parameter, not

>         first one.

> ---

>  gcc/match.pd | 16 ++++++++--------

>  1 file changed, 8 insertions(+), 8 deletions(-)

>

> diff --git a/gcc/match.pd b/gcc/match.pd

> index 5adcd6bd02c..09c7ce749dc 100644

> --- a/gcc/match.pd

> +++ b/gcc/match.pd

> @@ -4053,7 +4053,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)

>         }

>    (if (ibit == ibit2

>        && ibit >= 0

> -      && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@2))))))

> +      && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@0))))))

>

>  (match (nop_atomic_bit_test_and_p @0 @1 @3)

>   (bit_and (convert?@3 (SYNC_FETCH_OR_XOR_N @2 INTEGER_CST@0))

> @@ -4064,21 +4064,21 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)

>         }

>    (if (ibit == ibit2

>        && ibit >= 0

> -      && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@2))))))

> +      && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@0))))))

>

>  (match (nop_atomic_bit_test_and_p @0 @0 @4)

>   (bit_and:c

>    (convert1?@4

>     (ATOMIC_FETCH_OR_XOR_N @2 (nop_convert? (lshift@0 integer_onep@5 @6)) @3))

>    (convert2? @0))

> - (if (TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@2)))))

> + (if (TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@0)))))

>

>  (match (nop_atomic_bit_test_and_p @0 @0 @4)

>   (bit_and:c

>    (convert1?@4

>     (SYNC_FETCH_OR_XOR_N @2 (nop_convert? (lshift@0 integer_onep@3 @5))))

>    (convert2? @0))

> - (if (TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@2)))))

> + (if (TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@0)))))

>

>  (match (nop_atomic_bit_test_and_p @0 @1 @3)

>   (bit_and@4 (convert?@3 (ATOMIC_FETCH_AND_N @2 INTEGER_CST@0 @5))

> @@ -4090,7 +4090,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)

>         }

>    (if (ibit == ibit2

>        && ibit >= 0

> -      && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@2))))))

> +      && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@0))))))

>

>  (match (nop_atomic_bit_test_and_p @0 @1 @3)

>   (bit_and@4

> @@ -4103,21 +4103,21 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)

>         }

>    (if (ibit == ibit2

>        && ibit >= 0

> -      && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@2))))))

> +      && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@0))))))

>

>  (match (nop_atomic_bit_test_and_p @4 @0 @3)

>   (bit_and:c

>    (convert1?@3

>     (ATOMIC_FETCH_AND_N @2 (nop_convert?@4 (bit_not (lshift@0 integer_onep@6 @7))) @5))

>    (convert2? @0))

> - (if (TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@2)))))

> + (if (TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@4)))))

>

>  (match (nop_atomic_bit_test_and_p @4 @0 @3)

>   (bit_and:c

>    (convert1?@3

>     (SYNC_FETCH_AND_AND_N @2 (nop_convert?@4 (bit_not (lshift@0 integer_onep@6 @7)))))

>    (convert2? @0))

> -  (if (TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@2)))))

> +  (if (TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@4)))))

>

>  #endif

>

> --

> 2.18.1

>

Patch

diff --git a/gcc/match.pd b/gcc/match.pd
index 5adcd6bd02c..09c7ce749dc 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -4053,7 +4053,7 @@  DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
        }
   (if (ibit == ibit2
       && ibit >= 0
-      && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@2))))))
+      && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@0))))))
 
 (match (nop_atomic_bit_test_and_p @0 @1 @3)
  (bit_and (convert?@3 (SYNC_FETCH_OR_XOR_N @2 INTEGER_CST@0))
@@ -4064,21 +4064,21 @@  DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
        }
   (if (ibit == ibit2
       && ibit >= 0
-      && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@2))))))
+      && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@0))))))
 
 (match (nop_atomic_bit_test_and_p @0 @0 @4)
  (bit_and:c
   (convert1?@4
    (ATOMIC_FETCH_OR_XOR_N @2 (nop_convert? (lshift@0 integer_onep@5 @6)) @3))
   (convert2? @0))
- (if (TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@2)))))
+ (if (TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@0)))))
 
 (match (nop_atomic_bit_test_and_p @0 @0 @4)
  (bit_and:c
   (convert1?@4
    (SYNC_FETCH_OR_XOR_N @2 (nop_convert? (lshift@0 integer_onep@3 @5))))
   (convert2? @0))
- (if (TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@2)))))
+ (if (TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@0)))))
 
 (match (nop_atomic_bit_test_and_p @0 @1 @3)
  (bit_and@4 (convert?@3 (ATOMIC_FETCH_AND_N @2 INTEGER_CST@0 @5))
@@ -4090,7 +4090,7 @@  DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
        }
   (if (ibit == ibit2
       && ibit >= 0
-      && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@2))))))
+      && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@0))))))
 
 (match (nop_atomic_bit_test_and_p @0 @1 @3)
  (bit_and@4
@@ -4103,21 +4103,21 @@  DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
        }
   (if (ibit == ibit2
       && ibit >= 0
-      && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@2))))))
+      && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@0))))))
 
 (match (nop_atomic_bit_test_and_p @4 @0 @3)
  (bit_and:c
   (convert1?@3
    (ATOMIC_FETCH_AND_N @2 (nop_convert?@4 (bit_not (lshift@0 integer_onep@6 @7))) @5))
   (convert2? @0))
- (if (TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@2)))))
+ (if (TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@4)))))
 
 (match (nop_atomic_bit_test_and_p @4 @0 @3)
  (bit_and:c
   (convert1?@3
    (SYNC_FETCH_AND_AND_N @2 (nop_convert?@4 (bit_not (lshift@0 integer_onep@6 @7)))))
   (convert2? @0))
-  (if (TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@2)))))
+  (if (TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@4)))))
 
 #endif