From 0d754bd6d90c1c662b2282d36d30d654142f20dc Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Thu, 20 Feb 2020 11:56:50 -0800 Subject: 6031 - bugfix in selecting codegen pattern --- apps/mu | Bin 147384 -> 147461 bytes apps/mu.subx | 29 +++++++++++++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/apps/mu b/apps/mu index aa1dd742..97a85f1b 100755 Binary files a/apps/mu and b/apps/mu differ diff --git a/apps/mu.subx b/apps/mu.subx index 30b9db93..6f63b8f7 100644 --- a/apps/mu.subx +++ b/apps/mu.subx @@ -6178,8 +6178,20 @@ _Primitive-compare-eax-with-literal: 2/imm32/imm32-is-second-inout 0/imm32/no-disp32 0/imm32/output-is-write-only - _Primitive-compare-regmem-with-literal/imm32/next -_Primitive-compare-regmem-with-literal: + _Primitive-compare-reg-with-literal/imm32/next +_Primitive-compare-reg-with-literal: + # compare var1/reg n => 81 7/subop/compare %reg n/imm32 + "compare"/imm32/name + Int-var-in-register-and-literal/imm32/inouts + 0/imm32/outputs + "81 7/subop/compare"/imm32/subx-name + 1/imm32/rm32-is-first-inout + 0/imm32/no-r32 + 2/imm32/imm32-is-second-inout + 0/imm32/no-disp32 + 0/imm32/output-is-write-only + _Primitive-compare-mem-with-literal/imm32/next +_Primitive-compare-mem-with-literal: # compare var1 n => 81 7/subop/compare *(ebp+___) n/imm32 "compare"/imm32/name Int-var-and-literal/imm32/inouts @@ -6718,6 +6730,10 @@ Int-var-and-literal: Int-var-on-stack/imm32 Single-lit-var/imm32/next +Int-var-in-register-and-literal: + Int-var-in-some-register/imm32 + Single-lit-var/imm32/next + Single-int-var-in-some-register: Int-var-in-some-register/imm32 0/imm32/next @@ -7419,7 +7435,8 @@ operand-matches-primitive?: # var: (handle var), prim-var: (handle var) -> resu 3d/compare-eax-and 0/imm32 74/jump-if-= $operand-matches-primitive?:end/disp8 # eax goes from meaning var->register to result 81 7/subop/compare *(edi+0x10) 0/imm32 # Var-register - 74/jump-if-= $operand-matches-primitive?:end/disp8 # eax goes from meaning var->register to result + b8/copy-to-eax 0/imm32/false + 74/jump-if-= $operand-matches-primitive?:end/disp8 # if prim-var->register is wildcard, it's a match (string-equal? *(edi+0x10) Any-register) # Var-register => eax 3d/compare-eax-and 0/imm32/false @@ -7944,8 +7961,8 @@ test-increment-var: 89/<- %edi 4/r32/esp # var stmt/esi: statement 68/push 0/imm32/next - 68/push 0/imm32/outputs - 57/push-edi/inouts + 57/push-edi/outputs + 68/push 0/imm32/inouts 68/push "increment"/imm32/operation 68/push 1/imm32 89/<- %esi 4/r32/esp @@ -7960,7 +7977,7 @@ test-increment-var: #? (rewind-stream _test-output-stream) #? # }}} # check output - (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-increment-var") + (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-var") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp -- cgit 1.4.1-2-gfad0