[PATCH, i386]: Use indirect functions some more

Uros Bizjak ubizjak@gmail.com
Fri Mar 18 20:40:00 GMT 2011


Hello!

Just a trivial cleanup, no functional changes.

2011-03-18  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/i386.md (float<SSEMODEI24:mode><X87MODEF:mode>2):
	Rewrite using indirect functions.
	(lwp_slwpcb): Ditto.
	(avx_vextractf128<mode>): Ditto.
	(avx_vinsertf128<mode>): Ditto.

Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN.

Uros.
-------------- next part --------------
Index: i386.md
===================================================================
--- i386.md	(revision 171163)
+++ i386.md	(working copy)
@@ -4959,18 +4959,18 @@
       && !X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, <SSEMODEI24:MODE>mode))
     {
       rtx reg = gen_reg_rtx (XFmode);
-      rtx insn;
+      rtx (*insn)(rtx, rtx);
 
       emit_insn (gen_float<SSEMODEI24:mode>xf2 (reg, operands[1]));
 
       if (<X87MODEF:MODE>mode == SFmode)
-	insn = gen_truncxfsf2 (operands[0], reg);
+	insn = gen_truncxfsf2;
       else if (<X87MODEF:MODE>mode == DFmode)
-	insn = gen_truncxfdf2 (operands[0], reg);
+	insn = gen_truncxfdf2;
       else
 	gcc_unreachable ();
 
-      emit_insn (insn);
+      emit_insn (insn (operands[0], reg));
       DONE;
     }
 })
@@ -18216,10 +18216,13 @@
 	(unspec_volatile [(const_int 0)] UNSPECV_SLWP_INTRINSIC))]
   "TARGET_LWP"
 {
-  if (TARGET_64BIT)
-    emit_insn (gen_lwp_slwpcbdi (operands[0]));
-  else
-    emit_insn (gen_lwp_slwpcbsi (operands[0]));
+  rtx (*insn)(rtx);
+
+  insn = (TARGET_64BIT
+	  ? gen_lwp_slwpcbdi
+	  : gen_lwp_slwpcbsi);
+
+  emit_insn (insn (operands[0]));
   DONE;
 })
 
Index: sse.md
===================================================================
--- sse.md	(revision 171163)
+++ sse.md	(working copy)
@@ -4122,17 +4122,21 @@
    (match_operand:SI 2 "const_0_to_1_operand" "")]
   "TARGET_AVX"
 {
+  rtx (*insn)(rtx, rtx);
+
   switch (INTVAL (operands[2]))
     {
     case 0:
-      emit_insn (gen_vec_extract_lo_<mode> (operands[0], operands[1]));
+      insn = gen_vec_extract_lo_<mode>;
       break;
     case 1:
-      emit_insn (gen_vec_extract_hi_<mode> (operands[0], operands[1]));
+      insn = gen_vec_extract_hi_<mode>;
       break;
     default:
       gcc_unreachable ();
     }
+
+  emit_insn (insn (operands[0], operands[1]));
   DONE;
 })
 
@@ -11776,19 +11780,21 @@
    (match_operand:SI 3 "const_0_to_1_operand" "")]
   "TARGET_AVX"
 {
+  rtx (*insn)(rtx, rtx, rtx);
+
   switch (INTVAL (operands[3]))
     {
     case 0:
-      emit_insn (gen_vec_set_lo_<mode> (operands[0], operands[1],
-					operands[2]));
+      insn = gen_vec_set_lo_<mode>;
       break;
     case 1:
-      emit_insn (gen_vec_set_hi_<mode> (operands[0], operands[1],
-					operands[2]));
+      insn = gen_vec_set_hi_<mode>;
       break;
     default:
       gcc_unreachable ();
     }
+
+  emit_insn (insn (operands[0], operands[1], operands[2]));
   DONE;
 })
 


More information about the Gcc-patches mailing list