diff options
author | Chris Lattner <sabre@nondot.org> | 2008-02-27 01:17:20 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-02-27 01:17:20 +0000 |
commit | ba309d43aae75d155a71de91c10afc9486bbbefa (patch) | |
tree | e7a9198ecbe02e0d25f52c9f17e771b17bcd5760 /lib/Target/X86/README-X86-64.txt | |
parent | 7b8d4a9eef4eb02e561227b50c9d119cea4e8860 (diff) | |
download | llvm-ba309d43aae75d155a71de91c10afc9486bbbefa.tar.gz llvm-ba309d43aae75d155a71de91c10afc9486bbbefa.tar.bz2 llvm-ba309d43aae75d155a71de91c10afc9486bbbefa.tar.xz |
add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47652 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/README-X86-64.txt')
-rw-r--r-- | lib/Target/X86/README-X86-64.txt | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/Target/X86/README-X86-64.txt b/lib/Target/X86/README-X86-64.txt index bc19986eba..bdff56d40b 100644 --- a/lib/Target/X86/README-X86-64.txt +++ b/lib/Target/X86/README-X86-64.txt @@ -234,3 +234,30 @@ down by 8 and truncate it. It's not pretty but it works. We need some register allocation magic to make the hack go away (e.g. putting additional constraints on the result of the movb). +//===---------------------------------------------------------------------===// + +This function: +double a(double b) {return (unsigned)b;} +compiles to this code: + +_a: + subq $8, %rsp + cvttsd2siq %xmm0, %rax + movl $4294967295, %ecx + andq %rcx, %rax + cvtsi2sdq %rax, %xmm0 + addq $8, %rsp + ret + +note the dead rsp adjustments. Also, there is surely a better/shorter way +to clear the top 32-bits of a 64-bit register than movl+andq. Testcase here: + +unsigned long long c(unsigned long long a) {return a&4294967295; } + +_c: + movl $4294967295, %ecx + movq %rdi, %rax + andq %rcx, %rax + ret + +//===---------------------------------------------------------------------===// |