about summary refs log tree commit diff stats
path: root/032operands.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-07-14 22:41:22 -0700
committerKartik Agaram <vc@akkartik.com>2020-07-14 22:53:56 -0700
commit8cc1ed72c3d1dbe318f57ca5ec33a18cdcd7fcf3 (patch)
tree0516a82a33d8cb2fd18b43be41fd3df17c665da1 /032operands.cc
parentfd100782cb99371e0836de603ba9552a5c8f389c (diff)
downloadmu-8cc1ed72c3d1dbe318f57ca5ec33a18cdcd7fcf3.tar.gz
6650 - bit-shift operations really working
test input:

  fn foo {
    var y/edx: int <- copy 0
    y <- shift-left 2
    y <- shift-right 2
    y <- shift-right-signed 2
    var x: int
    shift-left x, 2
    shift-right x, 2
    shift-right-signed x, 2
  }

output:

  foo:
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    {
  $foo:0x00000001:loop:
      ff 6/subop/push %edx
      ba/copy-to-edx 0/imm32
      c1/shift 4/subop/left %edx 2/imm8
      c1/shift 5/subop/right-padding-zeroes %edx 2/imm8
      c1/shift 7/subop/right-preserving-sign %edx 2/imm8
      68/push 0/imm32
      c1/shift 4/subop/left *(ebp+0xfffffff8) 2/imm8
      c1/shift 5/subop/right-padding-zeroes *(ebp+0xfffffff8) 2/imm8
      c1/shift 7/subop/right-preserving-sign *(ebp+0xfffffff8) 2/imm8
      81 0/subop/add %esp 0x00000004/imm32
      8f 0/subop/pop %edx
    }
  $foo:0x00000001:break:
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

test input 2:

  $ cat x.mu
  fn main -> o/ebx: int {
    o <- copy 3
    o <- shift-left 2
  }

output 2:

  $ ./translate_mu x.mu
  $ ./a.elf
  $ echo $?
  12
Diffstat (limited to '032operands.cc')
0 files changed, 0 insertions, 0 deletions