[llvm-commits] [llvm] r47652 - /llvm/trunk/lib/Target/X86/README-X86-64.txt
Chris Lattner
sabre at nondot.org
Tue Feb 26 17:17:20 PST 2008
Author: lattner
Date: Tue Feb 26 19:17:20 2008
New Revision: 47652
URL: http://llvm.org/viewvc/llvm-project?rev=47652&view=rev
Log:
add a note
Modified:
llvm/trunk/lib/Target/X86/README-X86-64.txt
Modified: llvm/trunk/lib/Target/X86/README-X86-64.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-X86-64.txt?rev=47652&r1=47651&r2=47652&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/README-X86-64.txt (original)
+++ llvm/trunk/lib/Target/X86/README-X86-64.txt Tue Feb 26 19:17:20 2008
@@ -234,3 +234,30 @@
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
+
+//===---------------------------------------------------------------------===//
More information about the llvm-commits
mailing list