On 11/14/24 4:34 AM, Alex Coplan wrote:
On 12/11/2024 10:56, Jeff Law wrote:


On 11/12/24 4:46 AM, Alex Coplan wrote:
Hi Alexey,

On 12/11/2024 08:18, Alexey Merzlyakov wrote:
gcc/ChangeLog:

        * simplify-rtx.cc (simplify_context::simplify_unary_operation_1):
        Fix subreg mode check during zero_extend(not) -> xor optimization.

gcc/testsuite/ChangeLog:

        * gcc.dg/pr117476.c: New test.

Signed-off-by: Alexey Merzlyakov <alexey.merzlya...@samsung.com>
---
   gcc/simplify-rtx.cc             |  2 +-
   gcc/testsuite/gcc.dg/pr117476.c | 12 ++++++++++++
   2 files changed, 13 insertions(+), 1 deletion(-)
   create mode 100644 gcc/testsuite/gcc.dg/pr117476.c

diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc
index d05efac20dc..2a9cabaad09 100644
--- a/gcc/simplify-rtx.cc
+++ b/gcc/simplify-rtx.cc
@@ -1856,7 +1856,7 @@ simplify_context::simplify_unary_operation_1 (rtx_code 
code, machine_mode mode,
          && subreg_lowpart_p (op)
          && GET_MODE_SIZE (GET_MODE (op)).is_constant ()
          && (nonzero_bits (XEXP (XEXP (op, 0), 0), mode)
-             & ~GET_MODE_MASK (mode)) == 0)
+             & ~GET_MODE_MASK (GET_MODE (op))) == 0)
         {
        const uint64_t mask = GET_MODE_MASK (GET_MODE (op));
        return simplify_gen_binary (XOR, mode,
diff --git a/gcc/testsuite/gcc.dg/pr117476.c b/gcc/testsuite/gcc.dg/pr117476.c
new file mode 100644
index 00000000000..b8f51e697bf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr117476.c

I think it might be better to put the test in gcc.c-torture/execute,
then it will automatically get run with the various torture options
and you should be able to drop both the dejagnu directives.
Actually, gcc.dg/torture is better.

Oh, why's that (just so I know for next time)..?
The dg-torture is considered a more modern framework, c-torture is legacy.
jeff

Reply via email to