asm : JP reg8_hl
            | JP LP reg16i RP
436051
def p_JP_hl(p):
    
    s = 'JP '
    if p[2] == '(HL)':
        s += p[2]
    else:
        s += '(%s)' % p[3]

    p[0] = Asm(p.lineno(1), s)
898150
def _abs16(ins):
    ''' 
    '''
    output = _16bit_oper(ins.quad[2])
    output.append('call __ABS16')
    output.append('push hl')
    REQUIRES.add('abs16.asm')
    return output
443093
public final void pcmpestri(XMMRegister dst, XMMRegister src, Immediate imm8)
  {
    emitX86(INST_PCMPESTRI, dst, src, imm8);
  }
24148
def _paload32(ins):
    ''' 
    '''
    output = _paddr(ins.quad[2])

    output.append('call __ILOAD32')
    output.append('push de')
    output.append('push hl')

    REQUIRES.add('iload32.asm')

    return output
301574
def _gei8(ins):
    
    output = _8bit_oper(ins.quad[2], ins.quad[3], reversed_=True)
    output.append('call __LEI8')
    output.append('push af')
    REQUIRES.add('lei8.asm')

    return output
834615
def _jnzerof16(ins):
    
    value = ins.quad[1]
    if is_float(value):
        if float(value) != 0:
            return ['jp %s' % str(ins.quad[2])]  # Always true
        else:
            return []

    output = _f16_oper(value)
    output.append('ld a, h')
    output.append('or l')
    output.append('or e')
    output.append('or d')
    output.append('jp nz, %s' % str(ins.quad[2]))
    return output
305926
def LDRSH(self, params):
        
        # TODO LDRSH cant use immediates
        Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)

        self.check_arguments(low_registers=(Ra, Rb, Rc))

        def LDRSH_func():
            # TODO does memory read up?
            if (self.register[Rb] + self.register[Rc]) % 2 != 0:
                raise iarm.exceptions.HardFault(
                    "Memory access not half word aligned\nR{}: {}\nR{}: {}".format(Rb, self.register[Rb],
                                                                                   Rc, self.register[Rc]))
            self.register[Ra] = 0
            for i in range(2):
                self.register[Ra] |= (self.memory[self.register[Rb] + self.register[Rc] + i] << (8 * i))
            if self.register[Ra] & (1 << 15):
                self.register[Ra] |= (0xFFFF << 16)

        return LDRSH_func
332293
public final void pcmpestrm(XMMRegister dst, XMMRegister src, Immediate imm8)
  {
    emitX86(INST_PCMPESTRM, dst, src, imm8);
  }
1111350
def _pastore8(ins):
    ''' 
    '''
    output = _paddr(ins.quad[1])

    value = ins.quad[2]
    if value[0] == '*':
        value = value[1:]
        indirect = True
    else:
        indirect = False

    try:
        value = int(ins.quad[2]) & 0xFFFF
        if indirect:
            output.append('ld a, (%i)' % value)
            output.append('ld (hl), a')
        else:
            value &= 0xFF
            output.append('ld (hl), %i' % value)
    except ValueError:
        output.append('pop af')
        output.append('ld (hl), a')

    return output
1205842
def _get_u16(self, msb, lsb):
        
        buf = struct.pack('>BB', self._get_u8(msb), self._get_u8(lsb))
        return int(struct.unpack('>H', buf)[0])
376070
def p_jr(p):
    
    p[4] = Expr.makenode(Container('-', p.lineno(3)), p[4], Expr.makenode(Container(MEMORY.org + 2, p.lineno(1))))
    p[0] = Asm(p.lineno(1), 'JR %s,N' % p[2], p[4])
37683
def _paloadstr(ins):
    ''' 
    '''
    output = _paddr(ins.quad[2])

    output.append('call __ILOADSTR')
    output.append('push hl')
    REQUIRES.add('loadstr.asm')

    return output
75360
public final void mpsadbw(XMMRegister dst, XMMRegister src, Immediate imm8)
  {
    emitX86(INST_MPSADBW, dst, src, imm8);
  }
19551
def parse_assembly(llvmir, context=None):
    
    if context is None:
        context = get_global_context()
    llvmir = _encode_string(llvmir)
    strbuf = c_char_p(llvmir)
    with ffi.OutputString() as errmsg:
        mod = ModuleRef(
            ffi.lib.LLVMPY_ParseAssembly(context, strbuf, errmsg),
            context)
        if errmsg:
            mod.close()
            raise RuntimeError("LLVM IR parsing error\n{0}".format(errmsg))
    return mod
555387
def _pastoref16(ins):
    ''' 
    '''
    output = _paddr(ins.quad[1])

    value = ins.quad[2]
    if value[0] == '*':
        value = value[1:]
        indirect = True
    else:
        indirect = False

    try:
        if indirect:
            value = int(ins.quad[2])
            output.append('push hl')
            output.append('ld hl, %i' % (value & 0xFFFF))
            output.append('call __ILOAD32')
            output.append('ld b, h')
            output.append('ld c, l')  # BC = Lower 16 bits
            output.append('pop hl')
            REQUIRES.add('iload32.asm')
        else:
            de, hl = f16(value)
            output.append('ld de, %i' % de)
            output.append('ld bc, %i' % hl)
    except ValueError:
        output.append('pop bc')
        output.append('pop de')

    output.append('call __STORE32')
    REQUIRES.add('store32.asm')

    return output
1278
public final void shld(Mem dst, Register src1, Immediate src2)
  {
    emitX86(INST_SHLD, dst, src1, src2);
  }
1349793
def _paload16(ins):
    ''' 
    '''
    output = _paddr(ins.quad[2])

    output.append('ld e, (hl)')
    output.append('inc hl')
    output.append('ld d, (hl)')
    output.append('ex de, hl')
    output.append('push hl')

    return output