Posts

Project stage 2

Image
Task: Apply FMV cloning to functions automatically. Investigation My primary investigation started with locating the code to turn on the AFMV(Auto Function Multi Versioning) and the array list of architectures being passed. Following commands and keyword were used to locate the required code file: git log --oneline --grep="multiversioning" , gave me the git SHAW to investigate git show 8ec2f1922a1, where 8ec2f1922a1 is the git SHAW grep "target_clones" . , helped me to find the keyword target_clones Changes Finally I fond the file "gcc/gcc/multiple_target.cc" where the code was located, static bool expand_target_clones (struct cgraph_node *node, bool definition) { definition = true; . . . } The above function contains the primary logic for passing the target clones to the fmv.   const int num_attrs = 2;   char attrs2[num_attrs][5] = {"sve","sve2"};   for (i = 0; i < num_attrs; i++) {      char *attr = attrs2[i];      /* Create ne...

Project Stage 1 Inspection

Following is the list of command I used to build the gcc compiler on my aarch64 and x86 machine git clone https://gcc.gnu.org/git/gcc.git cd gcc ./configure --target=aarch64-linux-gnu --prefix=/path/to/installation/directory make -j It took hours before my computer shutdown on its own because of inactivity. Task 1: Apply FMV Cloning to Functions Automatically  Source Files and Line Numbers: - The relevant sections of the GCC code base can be found in the GCC source directory, particularly in the files related to function cloning and command-line option processing.  Description of Work: - Modify the GCC compiler to automatically clone all functions when specific command-line options are provided, simulating the behavior as if the `target_clone` attribute was specified.  Tools and Techniques: - C/C++ programming - Familiarity with GCC internals  Testing: - Unit tests to ensure that function cloning is performed correctly for various scenarios. - Integration tests with ...

AArch64 and x86_64 assembler code

Image
 AArch64  .text  .globl _start  min = 0                          /* starting value for the loop index; **note that this is a symbol (constant)**, not a variable */  max = 30                         /* loop exits when the index hits this number (loop condition is i<max) * _start:      mov     x19, min  loop:      /* Convert loop counter to char */      add        x15, x19, 0x30      adr        x14, msg+6      mov        x12, 10      udiv       x13, x19, x12      add        x16, x13, 0x30      cmp        x16, 0x30      b.eq       ones   ...

6502 Math and Strings Lab

Image
The 6502 processor, an 8-bit microprocessor prominent in early computing, adeptly performs basic arithmetic like addition and subtraction. However, its simplicity poses challenges for complex mathematical tasks, often requiring multiple instructions. In string manipulation, the absence of dedicated commands necessitates manual coding with load, store, and compare instructions. Programmers navigate character arrays for operations like concatenation, showcasing resource-conscious techniques in the absence of specialized string-handling instructions. Code for plotting a graph: ; ROM routines define SCINIT $ff81 ; initialize/clear screen define CHRIN $ffcf ; input character from keyboard define CHROUT $ffd2 ; output character to screen define SCREEN $ffed ; get screen size define PLOT $fff0 ; get/set cursor coordinates ; MEMORY LOCATION define INPUT_X $2000 define INPUT_Y $3000 ; Drawing X and Y axis units. LDA #$0E STA $0200 STA $0300 ST...

6502 Assembly Language Lab

Image
In the world of technology, there's a certain allure to exploring the origins of computing, and what better way to embark on this quest than through experimentation? Today, we dive headfirst into the heart of a vintage marvel – the 6502 processor. In this experiment, we are doing the performance tests of two bitmap code for 6502 processor. Both the test fill a 32*32 pixel screen with yellow color. Code1: 1. Load the immediate value 00 into the accumulator register (A register). 2. S tore the value from the accumulator register into the memory location $40. 3. L oad the immediate value 02 into the accumulator register. 4. S tore the value from the accumulator register into the memory location $41. 5. L oad the immediate value 7 into the accumulator register. 6. L oad the immediate value 0 into the Y register. 7. S tore the contents of the accumulator (which is 7) into the memory address specified by the 16-bit pointer formed by combining the values at memory locations $40 and $41,...