-
-
Save redknightlois/e7b9934b6cd2af2aca96 to your computer and use it in GitHub Desktop.
RotateBits repro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Assembly listing for method ConsoleApp1.Program:Main(ref) | |
; Emitting BLENDED_CODE for X64 CPU with SSE2 | |
; optimized code | |
; rsp based frame | |
; partially interruptible | |
; Final local variable assignments | |
; | |
;* V00 arg0 [V00 ] ( 0, 0 ) ref -> zero ref | |
; V01 tmp0 [V01,T01] ( 2, 4 ) long -> rcx | |
; V02 tmp1 [V02,T02] ( 2, 4 ) long -> rcx | |
; V03 OutArgs [V03 ] ( 1, 1 ) lclBlk (32) [rsp+0x00] | |
; V04 cse0 [V04,T03] ( 3, 3 ) long -> rcx | |
; V05 cse1 [V05,T04] ( 3, 3 ) long -> rcx | |
; V06 cse2 [V06,T05] ( 3, 3 ) long -> rdx | |
; V07 cse3 [V07,T06] ( 3, 3 ) long -> rdx | |
; V08 cse4 [V08,T07] ( 3, 3 ) long -> rdx | |
; V09 cse5 [V09,T08] ( 3, 3 ) long -> rdx | |
; V10 cse6 [V10,T00] ( 7, 7 ) long -> rax | |
; | |
; Lcl frame size = 40 | |
G_M26896_IG01: | |
4883EC28 sub rsp, 40 | |
G_M26896_IG02: | |
48B968303CA98C000000 mov rcx, 0x8CA93C3068 | |
488B09 mov rcx, gword ptr [rcx] | |
E85A24385E call System.Console:WriteLine(ref) | |
48B9C851F790FF7F0000 mov rcx, 0x7FFF90F751C8 | |
BA01000000 mov edx, 1 | |
E876C23D5F call CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE | |
488B0D4F4DEAFF mov rcx, qword ptr [classVar[0x90f75540]] | |
488BD1 mov rdx, rcx | |
48C1E210 shl rdx, 16 | |
48C1F930 sar rcx, 48 | |
480BCA or rcx, rdx | |
48890D3A4DEAFF mov qword ptr [classVar[0x90f75540]], rcx | |
488B153B4DEAFF mov rdx, qword ptr [classVar[0x90f75560]] | |
488BC2 mov rax, rdx | |
48C1E818 shr rax, 24 | |
48C1E228 shl rdx, 40 | |
480BC2 or rax, rdx | |
48A30852F790FF7F0000 mov qword ptr [classVar[0x90f75560]], rax | |
488B15244DEAFF mov rdx, qword ptr [classVar[0x90f75580]] | |
488BC2 mov rax, rdx | |
48C1E020 shl rax, 32 | |
48C1FA20 sar rdx, 32 | |
480BC2 or rax, rdx | |
48A31052F790FF7F0000 mov qword ptr [classVar[0x90f75580]], rax | |
488B150D4DEAFF mov rdx, qword ptr [classVar[0x90f755a0]] | |
488BC2 mov rax, rdx | |
48C1F830 sar rax, 48 | |
48C1E210 shl rdx, 16 | |
480BC2 or rax, rdx | |
48A31852F790FF7F0000 mov qword ptr [classVar[0x90f755a0]], rax | |
488B15F64CEAFF mov rdx, qword ptr [classVar[0x90f755c0]] | |
488BC2 mov rax, rdx | |
48C1E810 shr rax, 16 | |
48C1E230 shl rdx, 48 | |
480BC2 or rax, rdx | |
48A32052F790FF7F0000 mov qword ptr [classVar[0x90f755c0]], rax | |
BA10000000 mov edx, 16 | |
E834FBFFFF call ConsoleApp1.Program:RotateRight64(long,int):long | |
488B0DAD4CEAFF mov rcx, qword ptr [classVar[0x90f75540]] | |
BA10000000 mov edx, 16 | |
E82BFBFFFF call ConsoleApp1.Program:RotateRight64(long,int):long | |
48B970303CA98C000000 mov rcx, 0x8CA93C3070 | |
488B09 mov rcx, gword ptr [rcx] | |
E88123385E call System.Console:WriteLine(ref) | |
90 nop | |
G_M26896_IG03: | |
4883C428 add rsp, 40 | |
C3 ret | |
; Total bytes of code 245, prolog size 4 for method ConsoleApp1.Program:Main(ref) | |
; ============================================================ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Runtime.CompilerServices; | |
using System.Threading.Tasks; | |
namespace ConsoleApp1 | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
Console.WriteLine("Starting"); | |
a = (a << 16) | (a >> (64 - 16)); | |
b = (b >> 24) | (b << (64 - 24)); | |
c = (c << 32) | (c >> (64 - 32)); | |
d = (d >> 48) | (d << (64 - 48)); | |
e = (e >> 16) | (e << 48); | |
RotateRight64(a, 16); | |
RotateRight64((ulong)a, 16); | |
Console.WriteLine("Ending"); | |
} | |
private static long a = 2340988; | |
private static ulong b = 123444; | |
private static long c = 1; | |
private static long d = 23444111111; | |
private static ulong e = 23444111111; | |
[MethodImpl(MethodImplOptions.NoInlining)] | |
public static long RotateRight64(long value, int count) | |
{ | |
return (value >> count) | (value << (64 - count)); | |
} | |
[MethodImpl(MethodImplOptions.NoInlining)] | |
public static ulong RotateRight64(ulong value, int count) | |
{ | |
return (value >> count) | (value << (64 - count)); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Assembly listing for method ConsoleApp1.Program:RotateRight64(long,int):long | |
; Emitting BLENDED_CODE for X64 CPU with SSE2 | |
; optimized code | |
; rsp based frame | |
; partially interruptible | |
; Final local variable assignments | |
; | |
; V00 arg0 [V00,T00] ( 4, 4 ) long -> rax | |
; V01 arg1 [V01,T01] ( 4, 4 ) int -> rdx | |
;# V02 OutArgs [V02 ] ( 1, 1 ) lclBlk ( 0) [rsp+0x00] | |
; | |
; Lcl frame size = 0 | |
G_M62624_IG01: | |
488BC1 mov rax, rcx | |
G_M62624_IG02: | |
8BCA mov ecx, edx | |
83E13F and ecx, 63 | |
4C8BC0 mov r8, rax | |
49D3F8 sar r8, cl | |
8BCA mov ecx, edx | |
F7D9 neg ecx | |
83C140 add ecx, 64 | |
83E13F and ecx, 63 | |
48D3E0 shl rax, cl | |
490BC0 or rax, r8 | |
G_M62624_IG03: | |
C3 ret | |
; Total bytes of code 31, prolog size 0 for method ConsoleApp1.Program:RotateRight64(long,int):long | |
; ============================================================ | |
; Assembly listing for method ConsoleApp1.Program:RotateRight64(long,int):long | |
; Emitting BLENDED_CODE for X64 CPU with SSE2 | |
; optimized code | |
; rsp based frame | |
; partially interruptible | |
; Final local variable assignments | |
; | |
; V00 arg0 [V00,T00] ( 3, 3 ) long -> rax | |
; V01 arg1 [V01,T01] ( 3, 3 ) int -> rdx | |
;# V02 OutArgs [V02 ] ( 1, 1 ) lclBlk ( 0) [rsp+0x00] | |
; | |
; Lcl frame size = 0 | |
G_M62624_IG01: | |
488BC1 mov rax, rcx | |
G_M62624_IG02: | |
8BCA mov ecx, edx | |
48D3C8 ror rax, cl | |
G_M62624_IG03: | |
C3 ret | |
; Total bytes of code 9, prolog size 0 for method ConsoleApp1.Program:RotateRight64(long,int):long | |
; ============================================================ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment