Patchwork [i386] : Vectorize BUILT_IN_{I,LL}RINT{,F} when appropriate

login
register
mail settings
Submitter Uros Bizjak
Date Nov. 7, 2011, 9:03 p.m.
Message ID <CAFULd4a2WprbgaSAMptpHVTQrA=Og7YUXBTCNOMywR_uDDEr8A@mail.gmail.com>
Download mbox | patch
Permalink /patch/124183/
State New
Headers show

Comments

Uros Bizjak - Nov. 7, 2011, 9:03 p.m.
Hello!

Attached patch fixes omission from "(int) rint ()" conversion to
__builtin_irint (). We can vectorize this function when out_mode is
SImode, no matter how the builtin is called. Throw in also
BUILT_IN_LLRINT, just for completion ...

2011-11-07  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/i386.c (ix86_builtin_vectorized_function): Handle
	BUILT_IN_IRINT, BUILT_IN_IRINTF, BUILT_IN_LLRINT and BUILT_IN_LLRINTF.

Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu
{,-m32}, committed to mainline SVN.

BTW: It would be nice if convert.c also converted "(int) lrint ()" to
__builtin_lrint (), but this is somehow beyond my middle-end skills...

Uros.

Patch

Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 181110)
+++ config/i386/i386.c	(working copy)
@@ -29268,13 +29268,17 @@  ix86_builtin_vectorized_function (tree fndecl, tre
 	}
       break;
 
+    case BUILT_IN_IRINT:
     case BUILT_IN_LRINT:
+    case BUILT_IN_LLRINT:
       if (out_mode == SImode && out_n == 4
 	  && in_mode == DFmode && in_n == 2)
 	return ix86_builtins[IX86_BUILTIN_VEC_PACK_SFIX];
       break;
 
+    case BUILT_IN_IRINTF:
     case BUILT_IN_LRINTF:
+    case BUILT_IN_LLRINTF:
       if (out_mode == SImode && in_mode == SFmode)
 	{
 	  if (out_n == 4 && in_n == 4)