<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - vector uitofp fails for 64-bit integers"
href="http://llvm.org/bugs/show_bug.cgi?id=15309">15309</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>vector uitofp fails for 64-bit integers
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>babslachem@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Let's consider following code to convert a 2 x i64 vector into a 2 x float
vector:
; ModuleID = 'opencl-kernel-2N45Jj-2-src-def.ll'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
target triple = "i386-pc-linux-gnu"
define void @test_convert_float2_ulong2(<2 x i64>* nocapture %src, <2 x float>*
nocapture %dest) noinline {
L.entry:
%0 = getelementptr <2 x i64>* %src, i32 10
%1 = load <2 x i64>* %0, align 16
%2 = uitofp <2 x i64> %1 to <2 x float>
%3 = getelementptr <2 x float>* %dest, i32 10
store <2 x float> %2, <2 x float>* %3, align 8
ret void
}
Using llc as follows:
llc -march=x86 uitofp.ll -o uitofp.s
We got following assembly generated:
.file "uitofp.ll"
.section .rodata.cst16,"aM",@progbits,16
.align 16
.LCPI0_0:
.quad 4841369599423283200 # double 4.503600e+15
.quad 4841369599423283200 # double 4.503600e+15
.text
.globl test_convert_float2_ulong2
.align 16, 0x90
.type test_convert_float2_ulong2,@function
test_convert_float2_ulong2: # @test_convert_float2_ulong2
.cfi_startproc
# BB#0: # %L.entry
movl 4(%esp), %eax
movapd .LCPI0_0, %xmm0
movapd 160(%eax), %xmm1
orpd %xmm0, %xmm1
subpd %xmm0, %xmm1
cvtpd2ps %xmm1, %xmm0
movl 8(%esp), %eax
extractps $1, %xmm0, 84(%eax)
movss %xmm0, 80(%eax)
ret
.Ltmp0:
.size test_convert_float2_ulong2, .Ltmp0-test_convert_float2_ulong2
.cfi_endproc
.section ".note.GNU-stack","",@progbits
If for instance we want to convert vector <0x0010000000000000,
0x0010000000000000> expected result is: <0x59800000, 0x59800000>.
With implemented algorithm we got:
orpd %xmm0, %xmm1 => xmm1 = <0x4330000000000000, 0x4330000000000000> |
<0x0010000000000000, 0x0010000000000000> = <0x4330000000000000,
0x4330000000000000>
subpd %xmm0, %xmm1 => xmm1 - xmm0 = <0x0000000000000000, 0x0000000000000000>
Thus final results is <0x00000000, 0x00000000> instead of <0x59800000,
0x59800000>.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>