use custom __m128 struct on non-win32 platforms to provide element-wise access

explicitly cast param for set_constant to correctly resolve overloaded function
This commit is contained in:
Anthony Pesch 2014-05-13 23:46:42 -07:00
parent c6cdf1f672
commit 0e6c47aac5
3 changed files with 17 additions and 2 deletions

View File

@ -81,7 +81,7 @@ int IVMAssembler::Assemble(
size_t type_size = GetTypeSize(slot->type); size_t type_size = GetTypeSize(slot->type);
// Align to natural size. // Align to natural size.
stack_offset = XEALIGN(stack_offset, type_size); stack_offset = XEALIGN(stack_offset, type_size);
slot->set_constant(stack_offset); slot->set_constant((uint32_t)stack_offset);
stack_offset += type_size; stack_offset += type_size;
} }
// Ensure 16b alignment. // Ensure 16b alignment.

View File

@ -11,7 +11,22 @@
#define ALLOY_BACKEND_X64_X64_LOWERING_TRACERS_H_ #define ALLOY_BACKEND_X64_X64_LOWERING_TRACERS_H_
#include <alloy/core.h> #include <alloy/core.h>
#if XE_LIKE_WIN32
#include <xmmintrin.h> #include <xmmintrin.h>
#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 { namespace alloy {

View File

@ -117,7 +117,7 @@ int X64Emitter::Emit(HIRBuilder* builder, size_t& out_stack_size) {
size_t type_size = GetTypeSize(slot->type); size_t type_size = GetTypeSize(slot->type);
// Align to natural size. // Align to natural size.
stack_offset = XEALIGN(stack_offset, type_size); stack_offset = XEALIGN(stack_offset, type_size);
slot->set_constant(stack_offset); slot->set_constant((uint32_t)stack_offset);
stack_offset += type_size; stack_offset += type_size;
} }
// Ensure 16b alignment. // Ensure 16b alignment.