diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2015-03-23 22:44:55 +0000 |
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2015-03-23 22:44:55 +0000 |
| commit | 481f4146cd70489a67e2f5aaa06982816ba3e4ba (patch) | |
| tree | 235871a8f3d3413ef5770c853225344b1e6bc35b /llvm/test/CodeGen/X86/x86-setcc-int-to-fp-combine.ll | |
| parent | 735e87ea758556b185c184933c4fe1024fe323a8 (diff) | |
| download | bcm5719-llvm-481f4146cd70489a67e2f5aaa06982816ba3e4ba.tar.gz bcm5719-llvm-481f4146cd70489a67e2f5aaa06982816ba3e4ba.zip | |
[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
llvm-svn: 233033
Diffstat (limited to 'llvm/test/CodeGen/X86/x86-setcc-int-to-fp-combine.ll')
| -rw-r--r-- | llvm/test/CodeGen/X86/x86-setcc-int-to-fp-combine.ll | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/x86-setcc-int-to-fp-combine.ll b/llvm/test/CodeGen/X86/x86-setcc-int-to-fp-combine.ll index 4317d8ab6a2..a2c5b3a6eed 100644 --- a/llvm/test/CodeGen/X86/x86-setcc-int-to-fp-combine.ll +++ b/llvm/test/CodeGen/X86/x86-setcc-int-to-fp-combine.ll @@ -72,3 +72,18 @@ define <4 x float> @foo3(<4 x float> %val, <4 x float> %test) nounwind { %result = sitofp <4 x i32> %and to <4 x float> ret <4 x float> %result } + +; Test the general purpose constant folding of uint->fp. +define void @foo4(<4 x float>* noalias %result) nounwind { +; CHECK-LABEL: LCPI4_0: +; CHECK-NEXT: .long 1065353216 ## float 1.000000e+00 +; CHECK-NEXT: .long 1123942400 ## float 1.270000e+02 +; CHECK-NEXT: .long 1124073472 ## float 1.280000e+02 +; CHECK-NEXT: .long 1132396544 ## float 2.550000e+02 +; CHECK-LABEL: foo4: +; CHECK: movaps LCPI4_0(%rip), %xmm0 + + %val = uitofp <4 x i8> <i8 1, i8 127, i8 -128, i8 -1> to <4 x float> + store <4 x float> %val, <4 x float>* %result + ret void +} |

