diff options
author | Chris Lattner <sabre@nondot.org> | 2007-08-23 15:22:07 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-08-23 15:22:07 +0000 |
commit | 9e43d6316f65360ad659da9e6a5c91d5a3e1c069 (patch) | |
tree | f9d5de80edaa340fc529d33083688428c9616d6e /lib/Target/X86/README.txt | |
parent | aabd0359a3441fc300834b13b1cd265f22d7d011 (diff) | |
download | external_llvm-9e43d6316f65360ad659da9e6a5c91d5a3e1c069.zip external_llvm-9e43d6316f65360ad659da9e6a5c91d5a3e1c069.tar.gz external_llvm-9e43d6316f65360ad659da9e6a5c91d5a3e1c069.tar.bz2 |
add some notes on really poor codegen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41319 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/README.txt')
-rw-r--r-- | lib/Target/X86/README.txt | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/Target/X86/README.txt b/lib/Target/X86/README.txt index 467e025..f3b091b 100644 --- a/lib/Target/X86/README.txt +++ b/lib/Target/X86/README.txt @@ -1134,3 +1134,47 @@ pop into a dummy register instead of using addl/subl of esp. Just don't pop into any return registers :) //===---------------------------------------------------------------------===// + +The X86 backend should fold (branch (or (setcc, setcc))) into multiple +branches. We generate really poor code for: + +double testf(double a) { + return a == 0.0 ? 0.0 : (a > 0.0 ? 1.0 : -1.0); +} + +For example, the entry BB is: + +_testf: + subl $20, %esp + pxor %xmm0, %xmm0 + movsd 24(%esp), %xmm1 + ucomisd %xmm0, %xmm1 + setnp %al + sete %cl + testb %cl, %al + jne LBB1_5 # UnifiedReturnBlock +LBB1_1: # cond_true + + +it would be better to replace the last four instructions with: + + jp LBB1_1 + je LBB1_5 +LBB1_1: + +We also codegen the inner ?: into a diamond: + + cvtss2sd LCPI1_0(%rip), %xmm2 + cvtss2sd LCPI1_1(%rip), %xmm3 + ucomisd %xmm1, %xmm0 + ja LBB1_3 # cond_true +LBB1_2: # cond_true + movapd %xmm3, %xmm2 +LBB1_3: # cond_true + movapd %xmm2, %xmm0 + ret + +We should sink the load into xmm3 into the LBB1_2 block. This should +be pretty easy, and will nuke all the copies. + +//===---------------------------------------------------------------------===// |