MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / MoveWidePreferred

Function MoveWidePreferred

arch/arm64/disassembler/pcode.c:96–123  ·  view source on GitHub ↗

idea to abandon pseudocode and compute+compare actual bitmask is from NetBSD sys/arch/aarch64/aarch64/disasm.c */

Source from the content-addressed store, hash-verified

94/* idea to abandon pseudocode and compute+compare actual bitmask
95 is from NetBSD sys/arch/aarch64/aarch64/disasm.c */
96bool MoveWidePreferred(uint32_t sf, uint32_t immN, uint32_t immS, uint32_t immR)
97{
98 uint32_t splat = (immN << 6) | immS;
99 if (sf == 1 && !((splat & 0x40) == 0x40))
100 return false;
101 if (sf == 0 && !((splat & 0x60) == 0x00))
102 return false;
103
104 DecodeBitMasks_ReturnType dbmrt = DecodeBitMasks(sf, immS, immR);
105 uint64_t imm = dbmrt.wmask;
106
107 /* MOVZ check, at most 16 zeroes not across halfword (16-bit) boundary */
108 if (sf == 0)
109 imm &= 0xffffffff;
110 if (((imm & 0xffffffffffff0000) == 0) || ((imm & 0xffffffff0000ffff) == 0) ||
111 ((imm & 0xffff0000ffffffff) == 0) || ((imm & 0x0000ffffffffffff) == 0))
112 return true;
113
114 /* MOVN check, at most 16 ones not across halfword (16-bit) boundary */
115 imm = ~imm;
116 if (sf == 0)
117 imm &= 0xffffffff;
118 if (((imm & 0xffffffffffff0000) == 0) || ((imm & 0xffffffff0000ffff) == 0) ||
119 ((imm & 0xffff0000ffffffff) == 0) || ((imm & 0x0000ffffffffffff) == 0))
120 return true;
121
122 return false;
123}
124
125int HighestSetBit(uint64_t x)
126{

Callers 1

ORR_log_immFunction · 0.85

Calls 1

DecodeBitMasksFunction · 0.85

Tested by

no test coverage detected