LLVM backend for 6502
Go to file
Evan Cheng ba05f728b5 Revamp build_vector lowering to take advantage of movss and movd instructions.
movd always clear the top 96 bits and movss does so when it's loading the
value from memory.
The net result is codegen for 4-wide shuffles is much improved. It is near
optimal if one or more elements is a zero. e.g.

__m128i test(int a, int b) {
  return _mm_set_epi32(0, 0, b, a);
}

compiles to

_test:
	movd 8(%esp), %xmm1
	movd 4(%esp), %xmm0
	punpckldq %xmm1, %xmm0
	ret

compare to gcc:

_test:
	subl	$12, %esp
	movd	20(%esp), %xmm0
	movd	16(%esp), %xmm1
	punpckldq	%xmm0, %xmm1
	movq	%xmm1, %xmm0
	movhps	LC0, %xmm0
	addl	$12, %esp
	ret

or icc:

_test:
        movd      4(%esp), %xmm0                                #5.10
        movd      8(%esp), %xmm3                                #5.10
        xorl      %eax, %eax                                    #5.10
        movd      %eax, %xmm1                                   #5.10
        punpckldq %xmm1, %xmm0                                  #5.10
        movd      %eax, %xmm2                                   #5.10
        punpckldq %xmm2, %xmm3                                  #5.10
        punpckldq %xmm3, %xmm0                                  #5.10
        ret                                                     #5.10

There are still room for improvement, for example the FP variant of the above example:

__m128 test(float a, float b) {
  return _mm_set_ps(0.0, 0.0, b, a);
}

_test:
	movss 8(%esp), %xmm1
	movss 4(%esp), %xmm0
	unpcklps %xmm1, %xmm0
	xorps %xmm1, %xmm1
	movlhps %xmm1, %xmm0
	ret

The xorps and movlhps are unnecessary. This will require post legalizer optimization to handle.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27939 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-21 23:03:30 +00:00
autoconf Configure llvm-config in tools, not utils. 2006-04-20 22:15:30 +00:00
docs typo 2006-04-21 21:37:40 +00:00
examples Minor corrections. 2006-03-24 03:11:31 +00:00
include/llvm Remove a bunch of dead stuff, shrinkifying TargetInstrDescriptor significantly. 2006-04-20 18:32:02 +00:00
lib Revamp build_vector lowering to take advantage of movss and movd instructions. 2006-04-21 23:03:30 +00:00
projects Have the AutoRegen.sh script prompt the user for the LLVM src and obj 2006-04-18 06:27:47 +00:00
runtime Invert the tests on LLVMGCC_MAJVERS to check for value 4 instead of value 2006-04-07 21:45:23 +00:00
test movddup is a SSE3 instruction. 2006-04-21 16:42:47 +00:00
tools Okay, llvm-config is good to go now. 2006-04-20 21:14:39 +00:00
utils Remove the extraneous --defined-only option to nm. This is the default and 2006-04-21 05:29:25 +00:00
win32 Keep Visual Studio informed. 2006-04-20 22:19:06 +00:00
Xcode Misc. project changes. html + build config changes supplied by Devang. 2006-04-08 06:04:56 +00:00
.cvsignore Ignore stuff built by "make dist". 2006-04-07 15:55:18 +00:00
configure Configure llvm-config in tools, not utils. 2006-04-20 22:15:30 +00:00
CREDITS.TXT quick update 2006-04-13 02:05:30 +00:00
LICENSE.TXT Changing domain name 2006-04-20 05:51:53 +00:00
llvm.spec For PR723: 2006-04-07 16:07:37 +00:00
llvm.spec.in For PR723: 2006-04-07 16:07:37 +00:00
Makefile Include the win32 and Xcode directories in the distribution. 2006-04-12 20:53:14 +00:00
Makefile.common Update comments to reflect new variable names. Patch contributed by 2005-02-14 16:02:19 +00:00
Makefile.config.in Fix a comment. 2006-04-09 23:39:43 +00:00
Makefile.rules Remove traces of Burg utility now that its gone and not needed. 2006-04-20 18:42:24 +00:00
README.txt Make the text of this file a little more useful. 2004-09-02 22:49:27 +00:00

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for the Low Level 
Virtual Machine, a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments. 

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the HTML documentation provided in docs/index.html for further
assistance with LLVM.