summaryrefslogtreecommitdiff
path: root/src/vm
diff options
context:
space:
mode:
authorBruce Forstall <brucefo@microsoft.com>2018-01-23 19:51:43 -0800
committerGitHub <noreply@github.com>2018-01-23 19:51:43 -0800
commitc2c36eca826aba5616110a2090d95a64ddca19cb (patch)
tree697ec9835e26edf5c5f5e8cec783c2b8316fa4e8 /src/vm
parentfacdc8b97f73973fb416ed13e4b9dd9a255864bf (diff)
parentca397e5f57a649ad3bcc621cbb02354670f87a08 (diff)
downloadcoreclr-c2c36eca826aba5616110a2090d95a64ddca19cb.tar.gz
coreclr-c2c36eca826aba5616110a2090d95a64ddca19cb.tar.bz2
coreclr-c2c36eca826aba5616110a2090d95a64ddca19cb.zip
Merge pull request #15949 from mikedn/shift-inconsistency
Fix 64 bit shift inconsistencies (on 32 bit targets)
Diffstat (limited to 'src/vm')
-rw-r--r--src/vm/i386/jithelp.asm4
-rw-r--r--src/vm/jithelpers.cpp4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/vm/i386/jithelp.asm b/src/vm/i386/jithelp.asm
index a4bbe1ccf7..27b866881a 100644
--- a/src/vm/i386/jithelp.asm
+++ b/src/vm/i386/jithelp.asm
@@ -520,6 +520,8 @@ JIT_LLsh ENDP
ALIGN 16
PUBLIC JIT_LRsh
JIT_LRsh PROC
+; Reduce shift amount mod 64
+ and ecx, 63
; Handle shifts of between bits 0 and 31
cmp ecx, 32
jae short LRshMORE32
@@ -554,6 +556,8 @@ JIT_LRsh ENDP
ALIGN 16
PUBLIC JIT_LRsz
JIT_LRsz PROC
+; Reduce shift amount mod 64
+ and ecx, 63
; Handle shifts of between bits 0 and 31
cmp ecx, 32
jae short LRszMORE32
diff --git a/src/vm/jithelpers.cpp b/src/vm/jithelpers.cpp
index 48b8b94808..48f5df9ff6 100644
--- a/src/vm/jithelpers.cpp
+++ b/src/vm/jithelpers.cpp
@@ -464,7 +464,7 @@ HCIMPLEND
HCIMPL2_VV(INT64, JIT_LRsh, INT64 num, int shift)
{
FCALL_CONTRACT;
- return num >> shift;
+ return num >> (shift & 0x3F);
}
HCIMPLEND
@@ -472,7 +472,7 @@ HCIMPLEND
HCIMPL2_VV(UINT64, JIT_LRsz, UINT64 num, int shift)
{
FCALL_CONTRACT;
- return num >> shift;
+ return num >> (shift & 0x3F);
}
HCIMPLEND
#endif // !BIT64 && !_TARGET_X86_