/[pcre]/code/trunk/sljit/sljitNativePPC_32.c
ViewVC logotype

Diff of /code/trunk/sljit/sljitNativePPC_32.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1194 by zherczeg, Sun Oct 28 05:22:32 2012 UTC revision 1195 by zherczeg, Thu Nov 1 15:21:27 2012 UTC
# Line 26  Line 26 
26    
27  /* ppc 32-bit arch dependent functions. */  /* ppc 32-bit arch dependent functions. */
28    
29  static int load_immediate(struct sljit_compiler *compiler, int reg, sljit_w imm)  static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si reg, sljit_sw imm)
30  {  {
31          if (imm <= SIMM_MAX && imm >= SIMM_MIN)          if (imm <= SIMM_MAX && imm >= SIMM_MIN)
32                  return push_inst(compiler, ADDI | D(reg) | A(0) | IMM(imm));                  return push_inst(compiler, ADDI | D(reg) | A(0) | IMM(imm));
# Line 41  static int load_immediate(struct sljit_c Line 41  static int load_immediate(struct sljit_c
41  #define INS_CLEAR_LEFT(dst, src, from) \  #define INS_CLEAR_LEFT(dst, src, from) \
42          (RLWINM | S(src) | A(dst) | ((from) << 6) | (31 << 1))          (RLWINM | S(src) | A(dst) | ((from) << 6) | (31 << 1))
43    
44  static SLJIT_INLINE int emit_single_op(struct sljit_compiler *compiler, int op, int flags,  static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, sljit_si op, sljit_si flags,
45          int dst, int src1, int src2)          sljit_si dst, sljit_si src1, sljit_si src2)
46  {  {
47          switch (op) {          switch (op) {
48          case SLJIT_MOV:          case SLJIT_MOV:
# Line 120  static SLJIT_INLINE int emit_single_op(s Line 120  static SLJIT_INLINE int emit_single_op(s
120    
121          case SLJIT_ADDC:          case SLJIT_ADDC:
122                  if (flags & ALT_FORM1) {                  if (flags & ALT_FORM1) {
123                          FAIL_IF(push_inst(compiler, MFXER | S(0)));                          FAIL_IF(push_inst(compiler, MFXER | D(0)));
124                          FAIL_IF(push_inst(compiler, ADDE | D(dst) | A(src1) | B(src2)));                          FAIL_IF(push_inst(compiler, ADDE | D(dst) | A(src1) | B(src2)));
125                          return push_inst(compiler, MTXER | S(0));                          return push_inst(compiler, MTXER | S(0));
126                  }                  }
# Line 155  static SLJIT_INLINE int emit_single_op(s Line 155  static SLJIT_INLINE int emit_single_op(s
155    
156          case SLJIT_SUBC:          case SLJIT_SUBC:
157                  if (flags & ALT_FORM1) {                  if (flags & ALT_FORM1) {
158                          FAIL_IF(push_inst(compiler, MFXER | S(0)));                          FAIL_IF(push_inst(compiler, MFXER | D(0)));
159                          FAIL_IF(push_inst(compiler, SUBFE | D(dst) | A(src2) | B(src1)));                          FAIL_IF(push_inst(compiler, SUBFE | D(dst) | A(src2) | B(src1)));
160                          return push_inst(compiler, MTXER | S(0));                          return push_inst(compiler, MTXER | S(0));
161                  }                  }
# Line 228  static SLJIT_INLINE int emit_single_op(s Line 228  static SLJIT_INLINE int emit_single_op(s
228                  return push_inst(compiler, SRW | RC(flags) | S(src1) | A(dst) | B(src2));                  return push_inst(compiler, SRW | RC(flags) | S(src1) | A(dst) | B(src2));
229    
230          case SLJIT_ASHR:          case SLJIT_ASHR:
231                    if (flags & ALT_FORM3)
232                            FAIL_IF(push_inst(compiler, MFXER | D(0)));
233                  if (flags & ALT_FORM1) {                  if (flags & ALT_FORM1) {
234                          SLJIT_ASSERT(src2 == TMP_REG2);                          SLJIT_ASSERT(src2 == TMP_REG2);
235                          compiler->imm &= 0x1f;                          compiler->imm &= 0x1f;
236                          return push_inst(compiler, SRAWI | RC(flags) | S(src1) | A(dst) | (compiler->imm << 11));                          FAIL_IF(push_inst(compiler, SRAWI | RC(flags) | S(src1) | A(dst) | (compiler->imm << 11)));
237                  }                  }
238                  return push_inst(compiler, SRAW | RC(flags) | S(src1) | A(dst) | B(src2));                  else
239                            FAIL_IF(push_inst(compiler, SRAW | RC(flags) | S(src1) | A(dst) | B(src2)));
240                    return (flags & ALT_FORM3) ? push_inst(compiler, MTXER | S(0)) : SLJIT_SUCCESS;
241          }          }
242    
243          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
244          return SLJIT_SUCCESS;          return SLJIT_SUCCESS;
245  }  }
246    
247  static SLJIT_INLINE int emit_const(struct sljit_compiler *compiler, int reg, sljit_w init_value)  static SLJIT_INLINE sljit_si emit_const(struct sljit_compiler *compiler, sljit_si reg, sljit_sw init_value)
248  {  {
249          FAIL_IF(push_inst(compiler, ADDIS | D(reg) | A(0) | IMM(init_value >> 16)));          FAIL_IF(push_inst(compiler, ADDIS | D(reg) | A(0) | IMM(init_value >> 16)));
250          return push_inst(compiler, ORI | S(reg) | A(reg) | IMM(init_value));          return push_inst(compiler, ORI | S(reg) | A(reg) | IMM(init_value));
# Line 255  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_ Line 259  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
259          SLJIT_CACHE_FLUSH(inst, inst + 2);          SLJIT_CACHE_FLUSH(inst, inst + 2);
260  }  }
261    
262  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_w new_constant)  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_constant)
263  {  {
264          sljit_ins *inst = (sljit_ins*)addr;          sljit_ins *inst = (sljit_ins*)addr;
265    

Legend:
Removed from v.1194  
changed lines
  Added in v.1195

  ViewVC Help
Powered by ViewVC 1.1.5