public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH] [X86] Delete Deadcode.
@ 2020-11-26  8:10 Uros Bizjak
  2020-11-26  8:40 ` Hongtao Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Uros Bizjak @ 2020-11-26  8:10 UTC (permalink / raw)
  To: gcc-patches

> Hi:
>  This patch is about to delete dead code in ix86_expand_special_args_builtin.
>
>   Bootstrap and regression test are ok.
>
> gcc/ChangeLog:
>         * config/i386/i386-expand.c
>         (ix86_expand_special_args_builtin): Delete last_arg_constant.

@@ -10824,48 +10823,37 @@ ix86_expand_special_args_builtin (const
struct builtin_description *d,
       op = expand_normal (arg);
       match = insn_p->operand[i + 1].predicate (op, mode);

-      if (last_arg_constant && (i + 1) == nargs)
+      if (i == memory)

Please also remove unused variable "match".

OK with the above addition.

Thanks,
Uros.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [X86] Delete Deadcode.
  2020-11-26  8:10 [PATCH] [X86] Delete Deadcode Uros Bizjak
@ 2020-11-26  8:40 ` Hongtao Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Hongtao Liu @ 2020-11-26  8:40 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches

On Thu, Nov 26, 2020 at 4:11 PM Uros Bizjak <ubizjak@gmail.com> wrote:
>
> > Hi:
> >  This patch is about to delete dead code in ix86_expand_special_args_builtin.
> >
> >   Bootstrap and regression test are ok.
> >
> > gcc/ChangeLog:
> >         * config/i386/i386-expand.c
> >         (ix86_expand_special_args_builtin): Delete last_arg_constant.
>
> @@ -10824,48 +10823,37 @@ ix86_expand_special_args_builtin (const
> struct builtin_description *d,
>        op = expand_normal (arg);
>        match = insn_p->operand[i + 1].predicate (op, mode);
>
> -      if (last_arg_constant && (i + 1) == nargs)
> +      if (i == memory)
>
> Please also remove unused variable "match".
>
> OK with the above addition.
>
> Thanks,
> Uros.

Yes, will run another round regression test and bootstrap, just to be
on the safe side

@@ -10818,54 +10817,41 @@ ix86_expand_special_args_builtin (const
struct builtin_description *d,
   for (i = 0; i < nargs; i++)
     {
       machine_mode mode = insn_p->operand[i + 1].mode;
-      bool match;

       arg = CALL_EXPR_ARG (exp, i + arg_adjust);
       op = expand_normal (arg);
-      match = insn_p->operand[i + 1].predicate (op, mode);

-- 
BR,
Hongtao

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [X86] Delete Deadcode.
  2020-11-26  4:50             ` [PATCH] [X86] Delete Deadcode Hongtao Liu
@ 2020-11-26  7:32               ` Jakub Jelinek
  0 siblings, 0 replies; 4+ messages in thread
From: Jakub Jelinek @ 2020-11-26  7:32 UTC (permalink / raw)
  To: Hongtao Liu; +Cc: Jeff Law, GCC Patches

On Thu, Nov 26, 2020 at 12:50:17PM +0800, Hongtao Liu wrote:
> Hi:
>   This patch is about to delete dead code in ix86_expand_special_args_builtin.
> 
>   Bootstrap and regression test are ok.
> 
> gcc/ChangeLog:
>         * config/i386/i386-expand.c
>         (ix86_expand_special_args_builtin): Delete last_arg_constant.

Ok for trunk.

	Jakub


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] [X86] Delete Deadcode.
  2020-11-26  4:47           ` Hongtao Liu
@ 2020-11-26  4:50             ` Hongtao Liu
  2020-11-26  7:32               ` Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Hongtao Liu @ 2020-11-26  4:50 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Jeff Law, GCC Patches

[-- Attachment #1: Type: text/plain, Size: 246 bytes --]

Hi:
  This patch is about to delete dead code in ix86_expand_special_args_builtin.

  Bootstrap and regression test are ok.

gcc/ChangeLog:
        * config/i386/i386-expand.c
        (ix86_expand_special_args_builtin): Delete last_arg_constant.

[-- Attachment #2: 0001-Delete-dead-code-in-ix86_expand_special_args_builtin.patch --]
[-- Type: text/x-patch, Size: 3622 bytes --]

From 948756dae8f67bf766714d9ecc064b4eea9952cd Mon Sep 17 00:00:00 2001
From: liuhongt <hongtao.liu@intel.com>
Date: Thu, 26 Nov 2020 09:49:18 +0800
Subject: [PATCH 1/2] Delete dead code in ix86_expand_special_args_builtin

gcc/ChangeLog:
	* config/i386/i386-expand.c
	(ix86_expand_special_args_builtin): Delete last_arg_constant.
---
 gcc/config/i386/i386-expand.c | 62 ++++++++++++++---------------------
 1 file changed, 25 insertions(+), 37 deletions(-)

diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
index 73e3358b290..e7768882158 100644
--- a/gcc/config/i386/i386-expand.c
+++ b/gcc/config/i386/i386-expand.c
@@ -10494,7 +10494,6 @@ ix86_expand_special_args_builtin (const struct builtin_description *d,
       machine_mode mode;
     } args[3];
   enum insn_code icode = d->icode;
-  bool last_arg_constant = false;
   const struct insn_data_d *insn_p = &insn_data[icode];
   machine_mode tmode = insn_p->operand[0].mode;
   enum { load, store } klass;
@@ -10824,48 +10823,37 @@ ix86_expand_special_args_builtin (const struct builtin_description *d,
       op = expand_normal (arg);
       match = insn_p->operand[i + 1].predicate (op, mode);
 
-      if (last_arg_constant && (i + 1) == nargs)
+      if (i == memory)
 	{
-	  if (!match)
-	    {
-	      error ("the last argument must be an 8-bit immediate");
-	      return const0_rtx;
-	    }
+	  /* This must be the memory operand.  */
+	  op = ix86_zero_extend_to_Pmode (op);
+	  op = gen_rtx_MEM (mode, op);
+	  /* op at this point has just BITS_PER_UNIT MEM_ALIGN
+	     on it.  Try to improve it using get_pointer_alignment,
+	     and if the special builtin is one that requires strict
+	     mode alignment, also from it's GET_MODE_ALIGNMENT.
+	     Failure to do so could lead to ix86_legitimate_combined_insn
+	     rejecting all changes to such insns.  */
+	  unsigned int align = get_pointer_alignment (arg);
+	  if (aligned_mem && align < GET_MODE_ALIGNMENT (mode))
+	    align = GET_MODE_ALIGNMENT (mode);
+	  if (MEM_ALIGN (op) < align)
+	    set_mem_align (op, align);
 	}
       else
 	{
-	  if (i == memory)
-	    {
-	      /* This must be the memory operand.  */
-	      op = ix86_zero_extend_to_Pmode (op);
-	      op = gen_rtx_MEM (mode, op);
-	      /* op at this point has just BITS_PER_UNIT MEM_ALIGN
-		 on it.  Try to improve it using get_pointer_alignment,
-		 and if the special builtin is one that requires strict
-		 mode alignment, also from it's GET_MODE_ALIGNMENT.
-		 Failure to do so could lead to ix86_legitimate_combined_insn
-		 rejecting all changes to such insns.  */
-	      unsigned int align = get_pointer_alignment (arg);
-	      if (aligned_mem && align < GET_MODE_ALIGNMENT (mode))
-		align = GET_MODE_ALIGNMENT (mode);
-	      if (MEM_ALIGN (op) < align)
-		set_mem_align (op, align);
-	    }
-	  else
-	    {
-	      /* This must be register.  */
-	      if (VECTOR_MODE_P (mode))
-		op = safe_vector_operand (op, mode);
+	  /* This must be register.  */
+	  if (VECTOR_MODE_P (mode))
+	    op = safe_vector_operand (op, mode);
 
-	      op = fixup_modeless_constant (op, mode);
+	  op = fixup_modeless_constant (op, mode);
 
-	      if (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode)
-		op = copy_to_mode_reg (mode, op);
-	      else
-	        {
-	          op = copy_to_reg (op);
-	          op = lowpart_subreg (mode, op, GET_MODE (op));
-	        }
+	  if (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode)
+	    op = copy_to_mode_reg (mode, op);
+	  else
+	    {
+	      op = copy_to_reg (op);
+	      op = lowpart_subreg (mode, op, GET_MODE (op));
 	    }
 	}
 
-- 
2.18.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-26  8:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26  8:10 [PATCH] [X86] Delete Deadcode Uros Bizjak
2020-11-26  8:40 ` Hongtao Liu
  -- strict thread matches above, loose matches on Subject: below --
2020-11-04  9:19 [PATCH][PR target/97642] Fix incorrect replacement of vmovdqu32 with vpblendd Hongtao Liu
2020-11-23 20:27 ` Jeff Law
2020-11-24  2:36   ` Hongtao Liu
2020-11-24 13:00     ` Jakub Jelinek
2020-11-25 11:32       ` Hongtao Liu
2020-11-25 11:37         ` Jakub Jelinek
2020-11-26  4:47           ` Hongtao Liu
2020-11-26  4:50             ` [PATCH] [X86] Delete Deadcode Hongtao Liu
2020-11-26  7:32               ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).