From 0e6c47aac57678c4d9eb43ecc52746285faaf298 Mon Sep 17 00:00:00 2001 From: Anthony Pesch Date: Tue, 13 May 2014 23:46:42 -0700 Subject: [PATCH] use custom __m128 struct on non-win32 platforms to provide element-wise access explicitly cast param for set_constant to correctly resolve overloaded function --- src/alloy/backend/ivm/ivm_assembler.cc | 2 +- src/alloy/backend/x64/lowering/tracers.h | 15 +++++++++++++++ src/alloy/backend/x64/x64_emitter.cc | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/alloy/backend/ivm/ivm_assembler.cc b/src/alloy/backend/ivm/ivm_assembler.cc index bfd7600a7..a95237f2e 100644 --- a/src/alloy/backend/ivm/ivm_assembler.cc +++ b/src/alloy/backend/ivm/ivm_assembler.cc @@ -81,7 +81,7 @@ int IVMAssembler::Assemble( size_t type_size = GetTypeSize(slot->type); // Align to natural size. stack_offset = XEALIGN(stack_offset, type_size); - slot->set_constant(stack_offset); + slot->set_constant((uint32_t)stack_offset); stack_offset += type_size; } // Ensure 16b alignment. diff --git a/src/alloy/backend/x64/lowering/tracers.h b/src/alloy/backend/x64/lowering/tracers.h index e0536c7c5..7201b4f25 100644 --- a/src/alloy/backend/x64/lowering/tracers.h +++ b/src/alloy/backend/x64/lowering/tracers.h @@ -11,7 +11,22 @@ #define ALLOY_BACKEND_X64_X64_LOWERING_TRACERS_H_ #include + +#if XE_LIKE_WIN32 #include +#else +typedef union __declspec(align(16)) __m128 { + float m128_f32[4]; + uint64_t m128_u64[2]; + int8_t m128_i8[16]; + int16_t m128_i16[8]; + int32_t m128_i32[4]; + int64_t m128_i64[2]; + uint8_t m128_u8[16]; + uint16_t m128_u16[8]; + uint32_t m128_u32[4]; +} __m128; +#endif namespace alloy { diff --git a/src/alloy/backend/x64/x64_emitter.cc b/src/alloy/backend/x64/x64_emitter.cc index 3a9e6d142..80ed2cbca 100644 --- a/src/alloy/backend/x64/x64_emitter.cc +++ b/src/alloy/backend/x64/x64_emitter.cc @@ -117,7 +117,7 @@ int X64Emitter::Emit(HIRBuilder* builder, size_t& out_stack_size) { size_t type_size = GetTypeSize(slot->type); // Align to natural size. stack_offset = XEALIGN(stack_offset, type_size); - slot->set_constant(stack_offset); + slot->set_constant((uint32_t)stack_offset); stack_offset += type_size; } // Ensure 16b alignment.