Skip to content

Commit

Permalink
Create CommutativeOrAssociative.asm
Browse files Browse the repository at this point in the history
  • Loading branch information
NaC-L committed Nov 14, 2024
1 parent d521709 commit dff2cab
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions testcases/CommutativeOrAssociative.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
section .text


; The idea is taking
; %0 = add 10, %a
; %1 = add 5, %0
; and transforming to
; %0 = add %a, 10
; %1 = add %0, 5
; now we can check if RHS is a constant, and fold the instruction
; %0 = add %a, 15

global main
main:
mov rax, 10
add rax, rcx
sub rax, rcx
ret

0 comments on commit dff2cab

Please sign in to comment.