-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
craneliftIssues related to the Cranelift code generatorIssues related to the Cranelift code generatorcranelift:E-compilerCompiler issues.Compiler issues.cranelift:area:x64Issues related to x64 codegenIssues related to x64 codegencranelift:goal:optimize-speedFocus area: the speed of the code produced by Cranelift.Focus area: the speed of the code produced by Cranelift.
Description
Right now the given CLIF
v1 = load.i32 v0+32
v2 = iconst.i32 2
v3 = iadd v1, v2
store v3, v0+32
generates the following assembly
movl $2, %eax
addl %eax, 32(%rdi)
However, x64 allows the following encoding
addl $2, 32(%rdi)
I tried to fix that, by:
- Change the
src2ofAluRMfromGprtoGprMemImm, - Add the corresponding encoding.
- Change the
alu_rmconstructor to takeGprMemImm - Change the
x64_add_mem&co constructors to takeGprMemImm.
This is a bit stupid since AluRM already takes a memory operand, so there is no way to encode the Mem part of GprMemImm. I guess maybe we could introduce RegImm and GprImm types. But that feels wrong and redundant.
Related issue where this first was brought up #1925
Metadata
Metadata
Assignees
Labels
craneliftIssues related to the Cranelift code generatorIssues related to the Cranelift code generatorcranelift:E-compilerCompiler issues.Compiler issues.cranelift:area:x64Issues related to x64 codegenIssues related to x64 codegencranelift:goal:optimize-speedFocus area: the speed of the code produced by Cranelift.Focus area: the speed of the code produced by Cranelift.