[llvm-commits] [llvm] r55864 - in /llvm/trunk: lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/2008-09-05-sinttofp-2xi32.ll

Chris Lattner clattner at apple.com
Sun Sep 21 15:59:54 PDT 2008


On Sep 5, 2008, at 4:07 PM, Eli Friedman wrote:

> Author: efriedma
> Date: Fri Sep  5 18:07:03 2008
> New Revision: 55864
>
> URL: http://llvm.org/viewvc/llvm-project?rev=55864&view=rev
> Log:
> Fix for PR2687: Add patterns to match sint_to_fp and fp_to_sint for  
> <2 x
> i32>.  This is a little messy, but it works.
>
> We should really get rid of the intrinsics, though, since they map
> perfectly well to standard LLVM instructions.

I completely agree.  The rule has always been that the front-end  
should lower builtins/intrinsics into non-intrinsic LLVM IR whenever  
possible.  Are you interested in tackling this?  It would just require  
changing llvm-gcc, clang, and adding autoupgrade support for these.

-Chris

>
>
>
> Added:
>    llvm/trunk/test/CodeGen/X86/2008-09-05-sinttofp-2xi32.ll
> Modified:
>    llvm/trunk/lib/Target/X86/X86InstrSSE.td
>
> Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=55864&r1=55863&r2=55864&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original)
> +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Fri Sep  5 18:07:03 2008
> @@ -3080,6 +3080,10 @@
>           (Int_CVTDQ2PSrr VR128:$src)>, Requires<[HasSSE2]>;
> def : Pat<(v4i32 (fp_to_sint (v4f32 VR128:$src))),
>           (Int_CVTTPS2DQrr VR128:$src)>, Requires<[HasSSE2]>;
> +def : Pat<(v2f64 (sint_to_fp (v2i32 VR64:$src))),
> +          (Int_CVTPI2PDrr VR64:$src)>, Requires<[HasSSE2]>;
> +def : Pat<(v2i32 (fp_to_sint (v2f64 VR128:$src))),
> +          (Int_CVTTPD2PIrr VR128:$src)>, Requires<[HasSSE2]>;
>
> // Use movaps / movups for SSE integer load / store (one byte  
> shorter).
> def : Pat<(alignedloadv4i32 addr:$src),
>
> Added: llvm/trunk/test/CodeGen/X86/2008-09-05-sinttofp-2xi32.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-09-05-sinttofp-2xi32.ll?rev=55864&view=auto
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/test/CodeGen/X86/2008-09-05-sinttofp-2xi32.ll (added)
> +++ llvm/trunk/test/CodeGen/X86/2008-09-05-sinttofp-2xi32.ll Fri  
> Sep  5 18:07:03 2008
> @@ -0,0 +1,15 @@
> +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep cvttpd2pi  
> | count 1
> +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep cvtpi2pd |  
> count 1
> +; PR2687
> +
> +define <2 x double> @a(<2 x i32> %x) nounwind {
> +entry:
> +  %y = sitofp <2 x i32> %x to <2 x double>
> +  ret <2 x double> %y
> +}
> +
> +define <2 x i32> @b(<2 x double> %x) nounwind {
> +entry:
> +  %y = fptosi <2 x double> %x to <2 x i32>
> +  ret <2 x i32> %y
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list