Category "assembly"

Is a mov to a segmentation register slower than a mov to a general purpose register?

Specifically is: mov %eax, %ds Slower than mov %eax, %ebx Or are they the same speed. I've researched online, but have been unable to find a definitive an

Writing a putchar in Assembly for x86_64 with 64 bit Linux?

I am trying to use the write syscall in order to reproduce the putchar function behavior which prints a single character. My code is as follows, asm_putchar:

Understand EQU and >> operators on them in RISC-V assembly, with LUI and ADDI

my prof posted this as one of the answers to a homework problem. Can anyone break this down for me? I don't understand what he is doing with CON1 - CON4 and wha

Finding the minimum value on a list Assembly Language GAS

I'm trying to find the minimum value of a list using assembly language. I'm trying to use -1 to compare all the other values to. my current code is data_items:

Finding the minimum value on a list Assembly Language GAS

I'm trying to find the minimum value of a list using assembly language. I'm trying to use -1 to compare all the other values to. my current code is data_items:

Find out higher bit with assembly language

I am new to assembly language. Please help me how to find the higher bits after these instruction MOV AX,08H MOV BX, 07H ADD AX,BX I know a little bit shiftin

Program in assembly x86 [closed]

I recently made a program with C++ and ASM. Can anyone help me make this code a more efficient one , in the ASM part or both. I would really a

Optimize a loop for static predict-not-taken? Which prediction problems exist for that in a normal loop?

Which problems arise in the following assembly loop, if Predict Not Taken is chosen by default? Optimize the example to Predict not Taken. addi $s1, $zero, 1024

Array addressing in AT&T GAS assembly. Register offset from RIP doesn't work

I'm trying to work with arrays in GNU assembly. In my opinion the following code must exit with value 3. But it exits with 13. .section __DATA,__data inArr:

Can modern x86 hardware not store a single byte to memory?

Speaking of the memory model of C++ for concurrency, Stroustrup's C++ Programming Language, 4th ed., sect. 41.2.1, says: ... (like most modern hardware) the

How to load an immediate number to a register in RV32I Base Instruction Set?

Recently, I am working on RV32I base instruction set, and I did not find any instruction looks like LD r1, imm. Thus, I am wondering how assembly programer load

How can I get a string returned from a function executed from a byte array?

I have a working C program that has the simple function that returns a d character encoded in a byte array. char foo() { return 'd'; } char byte_array[] = {0

How can I get a string returned from a function executed from a byte array?

I have a working C program that has the simple function that returns a d character encoded in a byte array. char foo() { return 'd'; } char byte_array[] = {0

MASM SHA256 running from C#

I received a task in college to compare execution time for calculating SHA256 in C# and assembly. It is supposed to be a simple WPF app with file input and 2 bu

Why don't compilers optimize trivial wrapper function pointers?

Consider the following code snippet #include <vector> #include <cstdlib> void __attribute__ ((noinline)) calculate1(double& a, int x) { a += x

Can compilers break control dependencies used for LoadStore memory ordering or similar, in any real use-cases?

I'm reading the mail list about LKMM: Add volatile_if(). The control dependency is somewhat subtle since it is easily forgotten by us developers. So I wonder i

Total Average Grade Calculator emu8086

I'm new to this assembly language emo8086 and I just wanna ask if there's something wrong about this code because I want to display the average grade, but the o

MOVZBQ equivalent in NASM

Background: I have been learning x86_64 assembly using NASM on a Linux system and was writing a subroutine for strlen(const char *str) I wanted to copy one byte

Load only first byte into a register, from a string at a label

I am trying to load only the first byte in a register after data is passed into it for example if I have the following ASM code global _start section .data stri

Why didn't x86 implement direct core-to-core messaging assembly/cpu instructions?

After serious development, CPUs gained many cores, gained distributed blocks of cores on multiple chiplets, numa systems, etc but still a piece of data has to p