Mercurial > hg > graal-compiler
comparison src/cpu/ppc/vm/assembler_ppc.hpp @ 17830:56e7f5560e60
8036767: PPC64: Support for little endian execution model
Reviewed-by: goetz, kvn, dholmes, simonis
Contributed-by: asmundak@google.com
author | kvn |
---|---|
date | Wed, 02 Apr 2014 11:24:44 -0700 |
parents | 31e80afe3fed |
children | b384ba33c9a0 |
comparison
equal
deleted
inserted
replaced
17829:0118c8c7b80f | 17830:56e7f5560e60 |
---|---|
1023 assert_unsigned_const(x, nbits); | 1023 assert_unsigned_const(x, nbits); |
1024 return x & ((1 << nbits) - 1); | 1024 return x & ((1 << nbits) - 1); |
1025 } | 1025 } |
1026 | 1026 |
1027 static void set_imm(int* instr, short s) { | 1027 static void set_imm(int* instr, short s) { |
1028 short* p = ((short *)instr) + 1; | 1028 // imm is always in the lower 16 bits of the instruction, |
1029 *p = s; | 1029 // so this is endian-neutral. Same for the get_imm below. |
1030 uint32_t w = *(uint32_t *)instr; | |
1031 *instr = (int)((w & ~0x0000FFFF) | (s & 0x0000FFFF)); | |
1030 } | 1032 } |
1031 | 1033 |
1032 static int get_imm(address a, int instruction_number) { | 1034 static int get_imm(address a, int instruction_number) { |
1033 short imm; | 1035 return (short)((int *)a)[instruction_number]; |
1034 short *p =((short *)a)+2*instruction_number+1; | |
1035 imm = *p; | |
1036 return (int)imm; | |
1037 } | 1036 } |
1038 | 1037 |
1039 static inline int hi16_signed( int x) { return (int)(int16_t)(x >> 16); } | 1038 static inline int hi16_signed( int x) { return (int)(int16_t)(x >> 16); } |
1040 static inline int lo16_unsigned(int x) { return x & 0xffff; } | 1039 static inline int lo16_unsigned(int x) { return x & 0xffff; } |
1041 | 1040 |