public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/c++-modules] i386: Use code_for_ instead of gen_ for parameterized names more.
@ 2020-08-28 15:56 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-08-28 15:56 UTC (permalink / raw)
  To: gcc-cvs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 2793 bytes --]

https://gcc.gnu.org/g:4432066509441cb6ec3e6688a523f9946e7b5d21

commit 4432066509441cb6ec3e6688a523f9946e7b5d21
Author: Uros Bizjak <ubizjak@gmail.com>
Date:   Wed Aug 19 17:14:13 2020 +0200

    i386: Use code_for_ instead of gen_ for parameterized names more.
    
    Some builtins are better expanded to patterns with
    parametrized names via code_for_ than gen_ helpers.
    
    No functional changes.
    
    2020-08-19  Uroš Bizjak  <ubizjak@gmail.com>
    
    gcc/ChangeLog:
    
            * config/i386/i386-expand.c (ix86_expand_builtin)
            [case IX86_BUILTIN_ENQCMD, case IX86_BUILTIN_ENQCMDS]:
            Rewrite expansion to use code_for_enqcmd.
            [case IX86_BUILTIN_WRSSD, case IX86_BUILTIN_WRSSQ]:
            Rewrite expansion to use code_for_wrss.
            [case IX86_BUILTIN_WRUSSD, case IX86_BUILTIN_WRUSSD]:
            Rewrite expansion to use code_for_wrss.

Diff:
---
 gcc/config/i386/i386-expand.c | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
index 68fbe8385b3..61618636cff 100644
--- a/gcc/config/i386/i386-expand.c
+++ b/gcc/config/i386/i386-expand.c
@@ -11433,24 +11433,24 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
 	}
       else
 	{
-	  rtx pat;
+	  if (target == 0
+	      || !register_operand (target, SImode))
+	    target = gen_reg_rtx (SImode);
 
-	  target = gen_reg_rtx (SImode);
 	  emit_move_insn (target, const0_rtx);
 	  target = gen_rtx_SUBREG (QImode, target, 0);
 
-	  if (fcode == IX86_BUILTIN_ENQCMD)
-	    pat = gen_enqcmd (UNSPECV_ENQCMD, Pmode, op0, op1);
-	  else
-	    pat = gen_enqcmd (UNSPECV_ENQCMDS, Pmode, op0, op1);
-
-	  emit_insn (pat);
-
-	  emit_insn (gen_rtx_SET (gen_rtx_STRICT_LOW_PART (VOIDmode, target),
-				  gen_rtx_fmt_ee (EQ, QImode,
-						  SET_DEST (pat),
-						  const0_rtx)));
+	  int unspecv = (fcode == IX86_BUILTIN_ENQCMD
+			 ? UNSPECV_ENQCMD
+			 : UNSPECV_ENQCMDS);
+	  icode = code_for_enqcmd (unspecv, Pmode);
+	  emit_insn (GEN_FCN (icode) (op0, op1));
 
+	  emit_insn
+	    (gen_rtx_SET (gen_rtx_STRICT_LOW_PART (VOIDmode, target),
+			  gen_rtx_fmt_ee (EQ, QImode,
+					  gen_rtx_REG (CCZmode, FLAGS_REG),
+					  const0_rtx)));
 	  return SUBREG_REG (target);
 	}
 
@@ -12839,10 +12839,12 @@ rdseed_step:
 	}
       op1 = gen_rtx_MEM (mode, op1);
 
-      emit_insn ((fcode == IX86_BUILTIN_WRSSD
-		  || fcode == IX86_BUILTIN_WRSSQ)
-		 ? gen_wrss (mode, op0, op1)
-		 : gen_wruss (mode, op0, op1));
+      icode = ((fcode == IX86_BUILTIN_WRSSD
+		|| fcode == IX86_BUILTIN_WRSSQ)
+	       ? code_for_wrss (mode)
+	       : code_for_wruss (mode));
+      emit_insn (GEN_FCN (icode) (op0, op1));
+
       return 0;
 
     default:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-28 15:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28 15:56 [gcc/devel/c++-modules] i386: Use code_for_ instead of gen_ for parameterized names more Nathan Sidwell

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).