diff --git a/module/mescc/compile.scm b/module/mescc/compile.scm index 06d5dc24..2797baac 100644 --- a/module/mescc/compile.scm +++ b/module/mescc/compile.scm @@ -1215,8 +1215,20 @@ (append-text info (wrap-as (as info 'not-r))))) ((bitwise-or ,a ,b) ((binop->r info) a b 'r0-or-r1)) ((bitwise-xor ,a ,b) ((binop->r info) a b 'r0-xor-r1)) - ((lshift ,a ,b) ((binop->r info) a b 'r0<r info) a b 'r0>>r1)) + ((lshift ,a ,b) + (let* ((type-a (ast->type a info)) + (default (get-type "default" info)) + (type (if (> (->size type-a info) (->size default info)) type-a + default)) + (info ((binop->r info) a b 'r0<type a info)) + (default (get-type "default" info)) + (type (if (> (->size type-a info) (->size default info)) type-a + default)) + (info ((binop->r info) a b 'r0>>r1))) + (append-text info (convert-r0 info type)))) ((div ,a ,b) ((binop->r info) a b 'r0/r1 (signed? (ast->type a info))))