[LLVMbugs] [Bug 16063] New: Multiplying vector type by a floating point constant results in an invalid result
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat May 18 06:49:43 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=16063
Bug ID: 16063
Summary: Multiplying vector type by a floating point constant
results in an invalid result
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: georgellvmb at oss3d.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Please check the code below. A float vector is multiplied by a double constant.
When the vector size is changed to 4, the code even fails to compile. However
for size 2 it compiles and gives the following wrong results.
>From my analysis of the code, a bitcast instruction is used in LLVM code
generator, which (I presume) simply reinterprets double constant instead of
converting it.
===== EXPECTED OUTPUT:
ORIGINAL: 1.00,1.00
MULTIPLIED: 0.50,0.50
===== ACTUAL OUTPUT:
ORIGINAL: 1.00,1.00
MULTIPLIED: 0.00,1.75
===== CODE:
#include <stdio.h>
#include <math.h>
typedef float tfloat __attribute__((ext_vector_type(2)))
__attribute__((aligned(8))) ;
int main()
{
tfloat orig=1.0;
printf("ORIGINAL: %.2lf,%.2lf\n",(double)orig[0],(double)orig[1]);
orig = orig*0.5;
printf("MULTIPLIED: %.2lf,%.2lf\n",(double)orig[0],(double)orig[1]);
return 0;
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130518/d16aa239/attachment.html>
More information about the llvm-bugs
mailing list