On x86-64 a bitcast from long to double or double to long results triggers an llc abort. Among other things, this comes up in the expansion of copysign. long %p(double %t) { %u = bitcast double %t to long ret long %u } double %q(long %t) { %u = bitcast long %t to double ret double %u } With llc -march=x86-64, this gets Cannot yet select: 0x8813318: f64 = bit_convert 0x88135c8
Mine.
I think this is a codegen bug Reid, -Chris
This one looks like yours Evan. It seems the TD for x86-64 isn't handling bit casts of 64-bit things. The test case for it has already been committed to Regression/CodeGen/X86. Reid.
The preferred fix for this is to expand it into movd/movq. However, Evan is busy with other things, so this won't happen in the near term. In the short-term, this patch gets us correct, but suboptimal (goes through memory) code: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20061204/040803.html Testcase here: CodeGen/X86/bitcast.ll -Chris _test1: subq $8, %rsp movsd %xmm0, (%rsp) movq (%rsp), %rax addq $8, %rsp ret _test2: subq $8, %rsp movq %rdi, (%rsp) movsd (%rsp), %xmm0 addq $8, %rsp ret
Actually, MOVQ apparently doesn't do 64-bit GPR to SSE reg. I implemented the movd case, compiling bitcast.ll::test3/test4 to: _test3: movd %xmm0, %eax ret _test4: movd %edi, %xmm0 ret Patch here: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20061204/040806.html