mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
add a note
llvm-svn: 47652
This commit is contained in:
parent
689d8cac04
commit
a81d716e0c
@ -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
|
||||
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
Loading…
Reference in New Issue
Block a user