Convert SIMD load and store to their respective CLIF instructions

This commit is contained in:
Andrew Brown
2019-09-25 12:40:27 -07:00
parent a1f6457e8a
commit e45ef24d3b

View File

@@ -500,6 +500,11 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
} => { } => {
translate_load(*offset, ir::Opcode::Load, F64, builder, state, environ)?; translate_load(*offset, ir::Opcode::Load, F64, builder, state, environ)?;
} }
Operator::V128Load {
memarg: MemoryImmediate { flags: _, offset },
} => {
translate_load(*offset, ir::Opcode::Load, I8X16, builder, state, environ)?;
}
/****************************** Store instructions *********************************** /****************************** Store instructions ***********************************
* Wasm specifies an integer alignment flag but we drop it in Cranelift. * Wasm specifies an integer alignment flag but we drop it in Cranelift.
* The memory base address is provided by the environment. * The memory base address is provided by the environment.
@@ -539,6 +544,11 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
} => { } => {
translate_store(*offset, ir::Opcode::Istore32, builder, state, environ)?; translate_store(*offset, ir::Opcode::Istore32, builder, state, environ)?;
} }
Operator::V128Store {
memarg: MemoryImmediate { flags: _, offset },
} => {
translate_store(*offset, ir::Opcode::Store, builder, state, environ)?;
}
/****************************** Nullary Operators ************************************/ /****************************** Nullary Operators ************************************/
Operator::I32Const { value } => state.push1(builder.ins().iconst(I32, i64::from(*value))), Operator::I32Const { value } => state.push1(builder.ins().iconst(I32, i64::from(*value))),
Operator::I64Const { value } => state.push1(builder.ins().iconst(I64, *value)), Operator::I64Const { value } => state.push1(builder.ins().iconst(I64, *value)),
@@ -990,9 +1000,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
let (a, b) = state.pop2(); let (a, b) = state.pop2();
state.push1(builder.ins().iadd(a, b)) state.push1(builder.ins().iadd(a, b))
} }
Operator::V128Load { .. } Operator::I8x16Eq
| Operator::V128Store { .. }
| Operator::I8x16Eq
| Operator::I8x16Ne | Operator::I8x16Ne
| Operator::I8x16LtS | Operator::I8x16LtS
| Operator::I8x16LtU | Operator::I8x16LtU