Questions tagged [zero-extension]

The tag has no usage guidance.

zero-extension
Filter by
Sorted by
Tagged with
0 votes
0 answers
326 views

random effects test in GLMM or zero-inflated mixed model

I`m considering several models such as GLM, GLMM, zero-inflated, and zero-inflated mixed in the count data. All my work was done in R. Prior studies confirmed that there is a problem of zero excess ...
나수빈's user avatar
5 votes
1 answer
2k views

What do the `uxtx` and `sxtx` extensions mean for 32-bit AArch64 `adds` instruction?

I'm looking at the following disassembled AArch64 instruction: 65 6E 20 2B adds w5, w19, w0, uxtx #3 According to the ARM manual, uxtx zero-extends w0 to an unsigned 64-bit value before adding it ...
John Källén's user avatar
0 votes
1 answer
731 views

From word to byte

What can I do to take only the right digits of the num ? I tried byte ptr but it changed the vale. Is it possible to delete the 2 left digits in a register? edit: the number is written within a ...
user17341742's user avatar
3 votes
1 answer
1k views

Adding a byte from memory to the AX register

I'm currently trying to figure out how to add the first byte in memory pointed to by the pointer register SI to the current contents of the AX register. So if SI holds some address, and the values in ...
CompSciStudent's user avatar
1 vote
1 answer
271 views

Assembly (AT&T) read memory to register?

In assembly I am trying to add 32 bits from memory to 64 registers, this will load 64 bits: add arr(,%rax,4), %rbx So I tried: add arr(,%rax,4), %rbx which didn't work. How can I solve this?
user avatar
1 vote
0 answers
57 views

Didn't understand the movzx command [duplicate]

I didn't understand what this command does, for example: 'movzx eax, byte [rax]' Before the command executed the value of rax was : '0x7ffff253c523' and after this line it became '0x00000070', why? I ...
roye1233's user avatar
  • 110
-2 votes
1 answer
495 views

Question regarding converting assembly to c -- specifically what the movzbl instruction does? [duplicate]

I am trying to figure out what this in assembly would mean in C: movq 16(%rdi), %rdx movq 16(%rsi), %rax movzbl (%rdx), %edx I am mostly confused about what the movzbl (%rdx), %edx will do. Thanks!
210312312's user avatar
0 votes
0 answers
2k views

x86 assembly - mov and movzx from dword to qword? [duplicate]

I'm testing the following code: .intel_syntax noprefix .data .Ltest_data: .byte 0xEF, 0xBE, 0xAD, 0xDE, 0xBE, 0xBA, 0xED, 0xFE .text ... movzx rax, BYTE PTR[.Ltest_data] # 0xEF movzx ...
Martin's user avatar
  • 970
0 votes
2 answers
1k views

Moving a value of a lesser size into a register

I have stored a one-byte value of 8 and I'd like to move that into the rax register. I'm currently doing this with movzx to zero-extend the byte: .globl main main: push %rbp mov %rsp, %rbp ...
samuelbrody1249's user avatar
0 votes
0 answers
245 views

when do use extension move instruction in assembly language

I saw movw %dx (%eax) on my textbook, and I'm wondering why use movw rather than movswl or movzwl here? I think that there are 2 bytes in %dx and 4 bytes in (%eax) (for a 32-bit machine), so it needs ...
MusicalChicken's user avatar
1 vote
1 answer
2k views

Problem to store value ​from register into memory, ARM 32 bit

I am new in ARM and assembler. I tried to write a simple program to store value from register to memory. string: .ascii "%d\012\000" .align 2 var1: .word 0 .align 4 ...
Encapsulation's user avatar
0 votes
1 answer
4k views

MOV 8 bit to 16 bit register (al to bx)

How can I fix the problem of moving 8 bit value to the BX register (16 bit)? mov al, 10h mov bx, al for this I get: operands do not match: 16 bit and 8 bit register
Slack Bot's user avatar
0 votes
1 answer
856 views

How to isolate byte and word array elements in a 64-bit register

I can tell this is a super simple problem but I have yet to figure it out. Basically, I just want to be able to take one element an array and add and subtract some numbers from it using registers and ...
Austin25's user avatar
5 votes
1 answer
2k views

Why movzbl is used in assembly when casting unsigned char to signed data types?

I'm learning data movement(MOV) in assembly. I tried to compile some code to see the assembly in a x86_64 Ubuntu 18.04 machine: typedef unsigned char src_t; typedef xxx dst_t; dst_t cast(src_t *sp, ...
Sean's user avatar
  • 1,115
0 votes
1 answer
1k views

shift right and shift left assembly language

If I want to say for example bx is a number: shl bx,1 shr bx,1 What will be the new bx value? Does it stay the same?
Amer Syouri's user avatar
0 votes
1 answer
1k views

How is MOVSX instruction sign extending input in this case?

I have the following disassembly: [dest] = d5 cd e8 ca 68 movzx eax, [ebp+dest] # value of edx at this point is: F7FBB898 movsx edx, al # value of edx after this is: FFFFFFD5 # [ebp+var_E] ...
Neon Flash's user avatar
  • 3,183
2 votes
3 answers
2k views

Zero/sign-extend are no-op, why then instructions for each size type?

For x86 and x64 compilers generate similar zero/sign extend MOVSX and MOVZX. The expansion itself is not free, but allows processors to perform out-of-order magic speed up. But on RISC-V: ...
yudre's user avatar
  • 21
2 votes
3 answers
13k views

andi vs. addi instruction in MIPS with negative immediate constant

Assume $t2=0x55555550, then executing the following instruction: andi $t2, $t2, -1 $t2 becomes 0x0005550 This is confirmed by the MIPS emulator1 However, it is not what I expected. I think the ...
Lin Yu Cheng's user avatar
1 vote
1 answer
95 views

Translate assembly instructions to c++

I am having trouble translating the below assembly in to c++ MOVZX EAX, DX Where EDX is a 32bit register. I need to get the lowest 16 bits(DX). I've tried the following: unsigned edx = 0x123ABCDE;...
1ntgr's user avatar
  • 126
5 votes
4 answers
8k views

MASM Assembly move 8 bit register to the 16 bit register (ie. mov cx, ch) [duplicate]

I decided to learn an assembly programming language. I am using this 8086 tutorial. At the bottom the exercise is to find an error in some instructions and one of them is mov cx, ch I found some ...
Bartłomiej Szałach's user avatar
5 votes
2 answers
9k views

In MIPS, when to use a signed-extend, when to use a zero-extend?

I am designing a MIPS processor as my individual project, by now I met a very confused question. I just can not summarize when to use signed-extend and when to use zero-extend in MIPS. I have ...
Shuaiyu Jiang's user avatar
96 votes
1 answer
72k views

x86_64 registers rax/eax/ax/al overwriting full register contents [duplicate]

As it is widely advertised, modern x86_64 processors have 64-bit registers that can be used in backward-compatible fashion as 32-bit registers, 16-bit registers and even 8-bit registers, for example: ...
GreyCat's user avatar
  • 16.9k
0 votes
0 answers
82 views

Does a 32bit move zero out higher bits in a 64bit register? [duplicate]

Possible Duplicate: Why do most x64 instructions zero the upper part of a 32 register If I do a movl something, %eax and rax contained something like 0x1234567812345678, will it automatically ...
tangrs's user avatar
  • 9,800
7 votes
1 answer
4k views

Can "mov eax, 0x1" always be used instead of "mov rax, 0x1"?

When assembling this code with nasm: BITS 64 mov eax, 0x1 mov rax, 0x1 I get this output: b8 01 00 00 00 b8 01 00 00 00 which is the opcode for mov eax, 0x1 repeated twice. Does this mean that ...
Tyilo's user avatar
  • 29.6k
179 votes
4 answers
49k views

Why do x86-64 instructions on 32-bit registers zero the upper part of the full 64-bit register?

In the x86-64 Tour of Intel Manuals, I read Perhaps the most surprising fact is that an instruction such as MOV EAX, EBX automatically zeroes upper 32 bits of RAX register. The Intel documentation (...
Nubok's user avatar
  • 3,612
49 votes
2 answers
95k views

What does the MOVZBL instruction do in IA-32 AT&T syntax?

What exactly does this instruction do? movzbl 0x01(%eax,%ecx), %eax
user avatar
5 votes
1 answer
8k views

Weird results with movzwl, %ax and negative values

Alright, so I am dealing with the following snippet of code: push %ebp mov %esp,%ebp push %ebx mov 0x8(%ebp),%eax movzwl %ax,%edx So this behaves as expected when dealing with positive ...
ebensing's user avatar
  • 6,589
15 votes
1 answer
29k views

Clarifications on signed/unsigned load and store instructions (MIPS)

I can't seem to grasp the concept on these stuff, even with the help of Google and a textbook in my hand. Following the format (opcode, rs, rt, offset)... Do you sign extend the offset before adding ...
Check's user avatar
  • 153