Fix inconsistent handling of zero extending casts
authorMike Danes <onemihaid@hotmail.com>
Sat, 27 Jan 2018 20:09:52 +0000 (22:09 +0200)
committerMike Danes <onemihaid@hotmail.com>
Mon, 12 Feb 2018 20:32:48 +0000 (22:32 +0200)
commit0880a64ed1f932f65e21618661baab3ce9c60162
tree9aa555288a24bb98ab929a36675bffc0a49baae7
parent1e9f9ab12d58d2cd465891be7524d3b132704d64
Fix inconsistent handling of zero extending casts

For casts that are supposed to zero extend the GTF_UNSIGNED must always be set (and obeyed).

Some code failed to set the flag (e.g. when importing add.ovf.un instructions having native int and int32 operands) and some other code failed to check the flag (e.g. x64 codegen, gtFoldExprConst) and instead decided to zero extend based on the cast destination type.

This resulted in discrepancies between ARM64 and x64 codegen and between constant folding performed by gtFoldExprConst and VN's EvalCastForConstantArgs.
16 files changed:
src/jit/codegenxarch.cpp
src/jit/compiler.h
src/jit/compiler.hpp
src/jit/decomposelongs.cpp
src/jit/flowgraph.cpp
src/jit/gentree.cpp
src/jit/gentree.h
src/jit/importer.cpp
src/jit/lower.cpp
src/jit/lowerarmarch.cpp
src/jit/lowerxarch.cpp
src/jit/morph.cpp
src/jit/optimizer.cpp
src/jit/simd.cpp
tests/src/JIT/Regression/JitBlue/GitHub_13501/GitHub_13501.il [new file with mode: 0644]
tests/src/JIT/Regression/JitBlue/GitHub_13501/GitHub_13501.ilproj [new file with mode: 0644]