Lines Matching defs:imm

144 static inline bool is_range16(s32 imm)
146 return !(imm >= SBIT(15) || imm < -SBIT(15));
161 static inline void emit_load_imm(unsigned int dst, u32 imm, struct jit_ctx *ctx)
165 if (!is_range16(imm)) {
167 uasm_i_lui(&p, r_tmp_imm, (s32)imm >> 16);
169 uasm_i_ori(&p, dst, r_tmp_imm, imm & 0xffff);
172 uasm_i_addiu(&p, dst, r_zero, imm);
177 if (!is_range16(imm))
187 static inline void emit_ori(unsigned int dst, unsigned src, u32 imm,
190 if (imm >= BIT(16)) {
191 emit_load_imm(r_tmp, imm, ctx);
194 emit_instr(ctx, ori, dst, src, imm);
199 int imm, struct jit_ctx *ctx)
202 * Only used for stack, so the imm is relatively small
205 emit_instr(ctx, daddiu, dst, src, imm);
209 u32 imm, struct jit_ctx *ctx)
211 if (!is_range16(imm)) {
212 emit_load_imm(r_tmp, imm, ctx);
215 emit_instr(ctx, addiu, dst, src, imm);
226 u32 imm, struct jit_ctx *ctx)
228 /* If imm does not fit in u16 then load it to register */
229 if (imm >= BIT(16)) {
230 emit_load_imm(r_tmp, imm, ctx);
233 emit_instr(ctx, andi, dst, src, imm);
243 static inline void emit_xori(ptr dst, ptr src, u32 imm, struct jit_ctx *ctx)
245 /* If imm does not fit in u16 then load it to register */
246 if (imm >= BIT(16)) {
247 emit_load_imm(r_tmp, imm, ctx);
250 emit_instr(ctx, xori, dst, src, imm);
317 unsigned int imm, struct jit_ctx *ctx)
320 if (!is_range16((s32)imm)) {
321 emit_load_imm(r_tmp, imm, ctx);
324 emit_instr(ctx, sltiu, dst, src, imm);
424 int imm, struct jit_ctx *ctx)
427 emit_long_instr(ctx, LW, dst, imm, src);
431 static inline void emit_load_func(unsigned int reg, ptr imm,
435 /* At this point imm is always 64-bit */
436 emit_load_imm(r_tmp, (u64)imm >> 32, ctx);
438 emit_ori(r_tmp, r_tmp_imm, (imm >> 16) & 0xffff, ctx);
440 emit_ori(reg, r_tmp_imm, imm & 0xffff, ctx);
442 emit_load_imm(reg, imm, ctx);
482 unsigned int imm, struct jit_ctx *ctx)
489 uasm_i_beq(&p, reg1, reg2, imm);
492 uasm_i_bne(&p, reg1, reg2, imm);
495 uasm_i_b(&p, imm);
505 static inline void emit_b(unsigned int imm, struct jit_ctx *ctx)
507 emit_bcond(MIPS_COND_ALL, r_zero, r_zero, imm, ctx);