OSDN Git Service

[SelectionDAG] Fixed issue with uitofp vector constant folding being treated as sitofp
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 23 Mar 2015 22:44:55 +0000 (22:44 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 23 Mar 2015 22:44:55 +0000 (22:44 +0000)
commitfa17ce8b6e73f845604ca15f12dbeea92f14e37a
treebfae630e8af5aebea642895a3ed68e2ed1815a37
parent9e6a05f57235775839ebd55d9af1c71a8b80b16b
[SelectionDAG] Fixed issue with uitofp vector constant folding being treated as sitofp

While the uitofp scalar constant folding treats an integer as an unsigned value (from lang ref):

%X = sitofp i8 -1 to double ; yields double:-1.0
%Y = uitofp i8 -1 to double ; yields double:255.0

The vector constant folding was always using sitofp:

%X = sitofp <2 x i8> <i8 -1, i8 -1> to <2 x double> ; yields <double -1.0, double -1.0>
%Y = uitofp <2 x i8> <i8 -1, i8 -1> to <2 x double> ; yields <double -1.0, double -1.0>

This patch fixes this so that the correct opcode is used for sitofp and uitofp.

%X = sitofp <2 x i8> <i8 -1, i8 -1> to <2 x double> ; yields <double -1.0, double -1.0>
%Y = uitofp <2 x i8> <i8 -1, i8 -1> to <2 x double> ; yields <double 255.0, double 255.0>

Differential Revision: http://reviews.llvm.org/D8560

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233033 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
test/CodeGen/X86/x86-setcc-int-to-fp-combine.ll