Lines Matching full:env
193 static HReg lookupIRTemp ( ISelEnv* env, IRTemp tmp ) in lookupIRTemp() argument
196 vassert(tmp < env->n_vregmap); in lookupIRTemp()
197 return env->vregmap[tmp]; in lookupIRTemp()
200 static void lookupIRTemp64 ( HReg* vrHI, HReg* vrLO, ISelEnv* env, IRTemp tmp ) in lookupIRTemp64() argument
203 vassert(tmp < env->n_vregmap); in lookupIRTemp64()
204 vassert(! hregIsInvalid(env->vregmapHI[tmp])); in lookupIRTemp64()
205 *vrLO = env->vregmap[tmp]; in lookupIRTemp64()
206 *vrHI = env->vregmapHI[tmp]; in lookupIRTemp64()
209 static void addInstr ( ISelEnv* env, X86Instr* instr ) in addInstr() argument
211 addHInstr(env->code, instr); in addInstr()
218 static HReg newVRegI ( ISelEnv* env ) in newVRegI() argument
220 HReg reg = mkHReg(True/*virtual reg*/, HRcInt32, 0/*enc*/, env->vreg_ctr); in newVRegI()
221 env->vreg_ctr++; in newVRegI()
225 static HReg newVRegF ( ISelEnv* env ) in newVRegF() argument
227 HReg reg = mkHReg(True/*virtual reg*/, HRcFlt64, 0/*enc*/, env->vreg_ctr); in newVRegF()
228 env->vreg_ctr++; in newVRegF()
232 static HReg newVRegV ( ISelEnv* env ) in newVRegV() argument
234 HReg reg = mkHReg(True/*virtual reg*/, HRcVec128, 0/*enc*/, env->vreg_ctr); in newVRegV()
235 env->vreg_ctr++; in newVRegV()
250 static X86RMI* iselIntExpr_RMI_wrk ( ISelEnv* env, IRExpr* e );
251 static X86RMI* iselIntExpr_RMI ( ISelEnv* env, IRExpr* e );
253 static X86RI* iselIntExpr_RI_wrk ( ISelEnv* env, IRExpr* e );
254 static X86RI* iselIntExpr_RI ( ISelEnv* env, IRExpr* e );
256 static X86RM* iselIntExpr_RM_wrk ( ISelEnv* env, IRExpr* e );
257 static X86RM* iselIntExpr_RM ( ISelEnv* env, IRExpr* e );
259 static HReg iselIntExpr_R_wrk ( ISelEnv* env, IRExpr* e );
260 static HReg iselIntExpr_R ( ISelEnv* env, IRExpr* e );
262 static X86AMode* iselIntExpr_AMode_wrk ( ISelEnv* env, IRExpr* e );
263 static X86AMode* iselIntExpr_AMode ( ISelEnv* env, IRExpr* e );
266 ISelEnv* env, IRExpr* e );
268 ISelEnv* env, IRExpr* e );
270 static X86CondCode iselCondCode_wrk ( ISelEnv* env, IRExpr* e );
271 static X86CondCode iselCondCode ( ISelEnv* env, IRExpr* e );
273 static HReg iselDblExpr_wrk ( ISelEnv* env, IRExpr* e );
274 static HReg iselDblExpr ( ISelEnv* env, IRExpr* e );
276 static HReg iselFltExpr_wrk ( ISelEnv* env, IRExpr* e );
277 static HReg iselFltExpr ( ISelEnv* env, IRExpr* e );
279 static HReg iselVecExpr_wrk ( ISelEnv* env, IRExpr* e );
280 static HReg iselVecExpr ( ISelEnv* env, IRExpr* e );
308 static void add_to_esp ( ISelEnv* env, Int n ) in add_to_esp() argument
311 addInstr(env, in add_to_esp()
315 static void sub_from_esp ( ISelEnv* env, Int n ) in sub_from_esp() argument
318 addInstr(env, in sub_from_esp()
347 static Int pushArg ( ISelEnv* env, IRExpr* arg, HReg r_vecRetAddr ) in pushArg() argument
352 addInstr(env, X86Instr_Push(X86RMI_Reg(r_vecRetAddr))); in pushArg()
356 addInstr(env, X86Instr_Push(X86RMI_Reg(hregX86_EBP()))); in pushArg()
360 IRType arg_ty = typeOfIRExpr(env->type_env, arg); in pushArg()
362 addInstr(env, X86Instr_Push(iselIntExpr_RMI(env, arg))); in pushArg()
367 iselInt64Expr(&rHi, &rLo, env, arg); in pushArg()
368 addInstr(env, X86Instr_Push(X86RMI_Reg(rHi))); in pushArg()
369 addInstr(env, X86Instr_Push(X86RMI_Reg(rLo))); in pushArg()
381 void callHelperAndClearArgs ( ISelEnv* env, X86CondCode cc, in callHelperAndClearArgs() argument
390 addInstr(env, X86Instr_Call( cc, (Addr)cee->addr, in callHelperAndClearArgs()
393 add_to_esp(env, 4*n_arg_ws); in callHelperAndClearArgs()
430 ISelEnv* env, in doHelperCall() argument
527 r_vecRetAddr = newVRegI(env); in doHelperCall()
528 sub_from_esp(env, 16); in doHelperCall()
529 addInstr(env, mk_iMOVsd_RR( hregX86_ESP(), r_vecRetAddr )); in doHelperCall()
544 n_arg_ws += pushArg(env, args[i], r_vecRetAddr); in doHelperCall()
594 vassert(typeOfIRExpr(env->type_env, arg) == Ity_I32); in doHelperCall()
595 tmpregs[argreg] = iselIntExpr_R(env, arg); in doHelperCall()
602 addInstr( env, mk_iMOVsd_RR( tmpregs[argregX], argregs[argregX] ) ); in doHelperCall()
614 addInstr(env, X86Instr_Alu32R(Xalu_MOV, in doHelperCall()
621 vassert(typeOfIRExpr(env->type_env, arg) == Ity_I32); in doHelperCall()
622 addInstr(env, X86Instr_Alu32R(Xalu_MOV, in doHelperCall()
623 iselIntExpr_RMI(env, arg), in doHelperCall()
650 cc = iselCondCode( env, guard ); in doHelperCall()
686 callHelperAndClearArgs( env, cc, cee, n_arg_ws, *retloc ); in doHelperCall()
695 X86AMode* genGuestArrayOffset ( ISelEnv* env, IRRegArray* descr, in genGuestArrayOffset() argument
724 tmp = newVRegI(env); in genGuestArrayOffset()
725 roff = iselIntExpr_R(env, off); in genGuestArrayOffset()
726 addInstr(env, mk_iMOVsd_RR(roff, tmp)); in genGuestArrayOffset()
728 addInstr(env, in genGuestArrayOffset()
731 addInstr(env, in genGuestArrayOffset()
741 void set_FPU_rounding_default ( ISelEnv* env ) in set_FPU_rounding_default() argument
748 addInstr(env, X86Instr_Push(X86RMI_Imm(DEFAULT_FPUCW))); in set_FPU_rounding_default()
749 addInstr(env, X86Instr_FpLdCW(zero_esp)); in set_FPU_rounding_default()
750 add_to_esp(env, 4); in set_FPU_rounding_default()
760 void set_FPU_rounding_mode ( ISelEnv* env, IRExpr* mode ) in set_FPU_rounding_mode() argument
762 HReg rrm = iselIntExpr_R(env, mode); in set_FPU_rounding_mode()
763 HReg rrm2 = newVRegI(env); in set_FPU_rounding_mode()
774 addInstr(env, mk_iMOVsd_RR(rrm, rrm2)); in set_FPU_rounding_mode()
775 addInstr(env, X86Instr_Alu32R(Xalu_AND, X86RMI_Imm(3), rrm2)); in set_FPU_rounding_mode()
776 addInstr(env, X86Instr_Sh32(Xsh_SHL, 10, rrm2)); in set_FPU_rounding_mode()
777 addInstr(env, X86Instr_Alu32R(Xalu_OR, X86RMI_Imm(DEFAULT_FPUCW), rrm2)); in set_FPU_rounding_mode()
778 addInstr(env, X86Instr_Push(X86RMI_Reg(rrm2))); in set_FPU_rounding_mode()
779 addInstr(env, X86Instr_FpLdCW(zero_esp)); in set_FPU_rounding_mode()
780 add_to_esp(env, 4); in set_FPU_rounding_mode()
788 static HReg do_sse_Not128 ( ISelEnv* env, HReg src ) in do_sse_Not128() argument
790 HReg dst = newVRegV(env); in do_sse_Not128()
793 addInstr(env, X86Instr_SseReRg(Xsse_XOR, dst, dst)); in do_sse_Not128()
795 addInstr(env, X86Instr_Sse32Fx4(Xsse_CMPEQF, dst, dst)); in do_sse_Not128()
797 addInstr(env, X86Instr_SseReRg(Xsse_XOR, src, dst)); in do_sse_Not128()
810 static void roundToF64 ( ISelEnv* env, HReg reg ) in roundToF64() argument
813 sub_from_esp(env, 8); in roundToF64()
814 addInstr(env, X86Instr_FpLdSt(False/*store*/, 8, reg, zero_esp)); in roundToF64()
815 addInstr(env, X86Instr_FpLdSt(True/*load*/, 8, reg, zero_esp)); in roundToF64()
816 add_to_esp(env, 8); in roundToF64()
838 static HReg iselIntExpr_R ( ISelEnv* env, IRExpr* e ) in iselIntExpr_R() argument
840 HReg r = iselIntExpr_R_wrk(env, e); in iselIntExpr_R()
851 static HReg iselIntExpr_R_wrk ( ISelEnv* env, IRExpr* e ) in iselIntExpr_R_wrk() argument
855 IRType ty = typeOfIRExpr(env->type_env,e); in iselIntExpr_R_wrk()
862 return lookupIRTemp(env, e->Iex.RdTmp.tmp); in iselIntExpr_R_wrk()
867 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
868 X86AMode* amode = iselIntExpr_AMode ( env, e->Iex.Load.addr ); in iselIntExpr_R_wrk()
875 addInstr(env, X86Instr_Alu32R(Xalu_MOV, in iselIntExpr_R_wrk()
880 addInstr(env, X86Instr_LoadEX(2,False,amode,dst)); in iselIntExpr_R_wrk()
884 addInstr(env, X86Instr_LoadEX(1,False,amode,dst)); in iselIntExpr_R_wrk()
897 HReg junk = newVRegF(env); in iselIntExpr_R_wrk()
898 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
899 HReg srcL = iselDblExpr(env, triop->arg2); in iselIntExpr_R_wrk()
900 HReg srcR = iselDblExpr(env, triop->arg3); in iselIntExpr_R_wrk()
903 addInstr(env, X86Instr_FpBinary( in iselIntExpr_R_wrk()
910 addInstr(env, X86Instr_FpStSW_AX()); in iselIntExpr_R_wrk()
911 addInstr(env, mk_iMOVsd_RR(hregX86_EAX(), dst)); in iselIntExpr_R_wrk()
912 addInstr(env, X86Instr_Alu32R(Xalu_AND, X86RMI_Imm(0x4700), dst)); in iselIntExpr_R_wrk()
926 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
927 HReg reg = iselIntExpr_R(env, e->Iex.Binop.arg2); in iselIntExpr_R_wrk()
928 addInstr(env, mk_iMOVsd_RR(reg,dst)); in iselIntExpr_R_wrk()
929 addInstr(env, X86Instr_Unary32(Xun_NEG,dst)); in iselIntExpr_R_wrk()
953 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
954 HReg reg = iselIntExpr_R(env, e->Iex.Binop.arg1); in iselIntExpr_R_wrk()
955 X86RMI* rmi = iselIntExpr_RMI(env, e->Iex.Binop.arg2); in iselIntExpr_R_wrk()
956 addInstr(env, mk_iMOVsd_RR(reg,dst)); in iselIntExpr_R_wrk()
957 addInstr(env, X86Instr_Alu32R(aluOp, rmi, dst)); in iselIntExpr_R_wrk()
990 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
993 HReg regL = iselIntExpr_R(env, e->Iex.Binop.arg1); in iselIntExpr_R_wrk()
994 addInstr(env, mk_iMOVsd_RR(regL,dst)); in iselIntExpr_R_wrk()
999 addInstr(env, X86Instr_Alu32R( in iselIntExpr_R_wrk()
1003 addInstr(env, X86Instr_Alu32R( in iselIntExpr_R_wrk()
1007 addInstr(env, X86Instr_Sh32(Xsh_SHL, 24, dst)); in iselIntExpr_R_wrk()
1008 addInstr(env, X86Instr_Sh32(Xsh_SAR, 24, dst)); in iselIntExpr_R_wrk()
1011 addInstr(env, X86Instr_Sh32(Xsh_SHL, 16, dst)); in iselIntExpr_R_wrk()
1012 addInstr(env, X86Instr_Sh32(Xsh_SAR, 16, dst)); in iselIntExpr_R_wrk()
1027 addInstr(env, X86Instr_Sh32( shOp, nshift, dst )); in iselIntExpr_R_wrk()
1030 HReg regR = iselIntExpr_R(env, e->Iex.Binop.arg2); in iselIntExpr_R_wrk()
1031 addInstr(env, mk_iMOVsd_RR(regR,hregX86_ECX())); in iselIntExpr_R_wrk()
1032 addInstr(env, X86Instr_Sh32(shOp, 0/* %cl */, dst)); in iselIntExpr_R_wrk()
1040 HReg src1 = iselIntExpr_R(env, e->Iex.Binop.arg1); in iselIntExpr_R_wrk()
1041 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1042 HReg src2 = iselIntExpr_R(env, e->Iex.Binop.arg2); in iselIntExpr_R_wrk()
1043 addInstr(env, mk_iMOVsd_RR(src1,dst)); in iselIntExpr_R_wrk()
1044 addInstr(env, X86Instr_Alu32R(Xalu_CMP, X86RMI_Reg(src2), dst)); in iselIntExpr_R_wrk()
1045 addInstr(env, X86Instr_CMov32(Xcc_B, X86RM_Reg(src2), dst)); in iselIntExpr_R_wrk()
1050 HReg hi8 = newVRegI(env); in iselIntExpr_R_wrk()
1051 HReg lo8 = newVRegI(env); in iselIntExpr_R_wrk()
1052 HReg hi8s = iselIntExpr_R(env, e->Iex.Binop.arg1); in iselIntExpr_R_wrk()
1053 HReg lo8s = iselIntExpr_R(env, e->Iex.Binop.arg2); in iselIntExpr_R_wrk()
1054 addInstr(env, mk_iMOVsd_RR(hi8s, hi8)); in iselIntExpr_R_wrk()
1055 addInstr(env, mk_iMOVsd_RR(lo8s, lo8)); in iselIntExpr_R_wrk()
1056 addInstr(env, X86Instr_Sh32(Xsh_SHL, 8, hi8)); in iselIntExpr_R_wrk()
1057 addInstr(env, X86Instr_Alu32R(Xalu_AND, X86RMI_Imm(0xFF), lo8)); in iselIntExpr_R_wrk()
1058 addInstr(env, X86Instr_Alu32R(Xalu_OR, X86RMI_Reg(lo8), hi8)); in iselIntExpr_R_wrk()
1063 HReg hi16 = newVRegI(env); in iselIntExpr_R_wrk()
1064 HReg lo16 = newVRegI(env); in iselIntExpr_R_wrk()
1065 HReg hi16s = iselIntExpr_R(env, e->Iex.Binop.arg1); in iselIntExpr_R_wrk()
1066 HReg lo16s = iselIntExpr_R(env, e->Iex.Binop.arg2); in iselIntExpr_R_wrk()
1067 addInstr(env, mk_iMOVsd_RR(hi16s, hi16)); in iselIntExpr_R_wrk()
1068 addInstr(env, mk_iMOVsd_RR(lo16s, lo16)); in iselIntExpr_R_wrk()
1069 addInstr(env, X86Instr_Sh32(Xsh_SHL, 16, hi16)); in iselIntExpr_R_wrk()
1070 addInstr(env, X86Instr_Alu32R(Xalu_AND, X86RMI_Imm(0xFFFF), lo16)); in iselIntExpr_R_wrk()
1071 addInstr(env, X86Instr_Alu32R(Xalu_OR, X86RMI_Reg(lo16), hi16)); in iselIntExpr_R_wrk()
1077 HReg a16 = newVRegI(env); in iselIntExpr_R_wrk()
1078 HReg b16 = newVRegI(env); in iselIntExpr_R_wrk()
1079 HReg a16s = iselIntExpr_R(env, e->Iex.Binop.arg1); in iselIntExpr_R_wrk()
1080 HReg b16s = iselIntExpr_R(env, e->Iex.Binop.arg2); in iselIntExpr_R_wrk()
1088 addInstr(env, mk_iMOVsd_RR(a16s, a16)); in iselIntExpr_R_wrk()
1089 addInstr(env, mk_iMOVsd_RR(b16s, b16)); in iselIntExpr_R_wrk()
1090 addInstr(env, X86Instr_Sh32(Xsh_SHL, shift, a16)); in iselIntExpr_R_wrk()
1091 addInstr(env, X86Instr_Sh32(Xsh_SHL, shift, b16)); in iselIntExpr_R_wrk()
1092 addInstr(env, X86Instr_Sh32(shr_op, shift, a16)); in iselIntExpr_R_wrk()
1093 addInstr(env, X86Instr_Sh32(shr_op, shift, b16)); in iselIntExpr_R_wrk()
1094 addInstr(env, X86Instr_Alu32R(Xalu_MUL, X86RMI_Reg(a16), b16)); in iselIntExpr_R_wrk()
1099 HReg fL = iselDblExpr(env, e->Iex.Binop.arg1); in iselIntExpr_R_wrk()
1100 HReg fR = iselDblExpr(env, e->Iex.Binop.arg2); in iselIntExpr_R_wrk()
1101 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1102 addInstr(env, X86Instr_FpCmp(fL,fR,dst)); in iselIntExpr_R_wrk()
1105 addInstr(env, X86Instr_Sh32(Xsh_SHR, 8, dst)); in iselIntExpr_R_wrk()
1112 HReg rf = iselDblExpr(env, e->Iex.Binop.arg2); in iselIntExpr_R_wrk()
1113 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1125 sub_from_esp(env, 4); in iselIntExpr_R_wrk()
1128 set_FPU_rounding_mode( env, e->Iex.Binop.arg1 ); in iselIntExpr_R_wrk()
1131 addInstr(env, X86Instr_FpLdStI(False/*store*/, in iselIntExpr_R_wrk()
1136 addInstr(env, X86Instr_LoadEX(2,False,zero_esp,dst)); in iselIntExpr_R_wrk()
1140 addInstr(env, X86Instr_Alu32R( in iselIntExpr_R_wrk()
1145 set_FPU_rounding_default( env ); in iselIntExpr_R_wrk()
1148 add_to_esp(env, 4); in iselIntExpr_R_wrk()
1165 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1166 HReg src = iselIntExpr_R(env, expr32); in iselIntExpr_R_wrk()
1167 addInstr(env, mk_iMOVsd_RR(src,dst) ); in iselIntExpr_R_wrk()
1168 addInstr(env, X86Instr_Alu32R(Xalu_AND, in iselIntExpr_R_wrk()
1181 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1182 X86AMode* amode = iselIntExpr_AMode ( env, mi.bindee[0] ); in iselIntExpr_R_wrk()
1183 addInstr(env, X86Instr_LoadEX(1,False,amode,dst)); in iselIntExpr_R_wrk()
1195 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1196 X86AMode* amode = iselIntExpr_AMode ( env, mi.bindee[0] ); in iselIntExpr_R_wrk()
1197 addInstr(env, X86Instr_LoadEX(1,True,amode,dst)); in iselIntExpr_R_wrk()
1209 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1210 X86AMode* amode = iselIntExpr_AMode ( env, mi.bindee[0] ); in iselIntExpr_R_wrk()
1211 addInstr(env, X86Instr_LoadEX(2,False,amode,dst)); in iselIntExpr_R_wrk()
1222 dst = newVRegI(env); in iselIntExpr_R_wrk()
1225 addInstr(env, X86Instr_LoadEX(1,False,amode,dst)); in iselIntExpr_R_wrk()
1236 dst = newVRegI(env); in iselIntExpr_R_wrk()
1239 addInstr(env, X86Instr_LoadEX(2,False,amode,dst)); in iselIntExpr_R_wrk()
1248 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1249 HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); in iselIntExpr_R_wrk()
1251 addInstr(env, mk_iMOVsd_RR(src,dst) ); in iselIntExpr_R_wrk()
1252 addInstr(env, X86Instr_Alu32R(Xalu_AND, in iselIntExpr_R_wrk()
1259 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1260 HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); in iselIntExpr_R_wrk()
1262 addInstr(env, mk_iMOVsd_RR(src,dst) ); in iselIntExpr_R_wrk()
1263 addInstr(env, X86Instr_Sh32(Xsh_SHL, amt, dst)); in iselIntExpr_R_wrk()
1264 addInstr(env, X86Instr_Sh32(Xsh_SAR, amt, dst)); in iselIntExpr_R_wrk()
1270 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1271 HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); in iselIntExpr_R_wrk()
1272 addInstr(env, mk_iMOVsd_RR(src,dst) ); in iselIntExpr_R_wrk()
1273 addInstr(env, X86Instr_Unary32(Xun_NOT,dst)); in iselIntExpr_R_wrk()
1278 iselInt64Expr(&rHi,&rLo, env, e->Iex.Unop.arg); in iselIntExpr_R_wrk()
1283 iselInt64Expr(&rHi,&rLo, env, e->Iex.Unop.arg); in iselIntExpr_R_wrk()
1288 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1289 HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); in iselIntExpr_R_wrk()
1291 addInstr(env, mk_iMOVsd_RR(src,dst) ); in iselIntExpr_R_wrk()
1292 addInstr(env, X86Instr_Sh32(Xsh_SHR, shift, dst)); in iselIntExpr_R_wrk()
1297 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1298 X86CondCode cond = iselCondCode(env, e->Iex.Unop.arg); in iselIntExpr_R_wrk()
1299 addInstr(env, X86Instr_Set32(cond,dst)); in iselIntExpr_R_wrk()
1306 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1307 X86CondCode cond = iselCondCode(env, e->Iex.Unop.arg); in iselIntExpr_R_wrk()
1308 addInstr(env, X86Instr_Set32(cond,dst)); in iselIntExpr_R_wrk()
1309 addInstr(env, X86Instr_Sh32(Xsh_SHL, 31, dst)); in iselIntExpr_R_wrk()
1310 addInstr(env, X86Instr_Sh32(Xsh_SAR, 31, dst)); in iselIntExpr_R_wrk()
1315 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1316 HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); in iselIntExpr_R_wrk()
1317 addInstr(env, X86Instr_Bsfr32(True,src,dst)); in iselIntExpr_R_wrk()
1324 HReg tmp = newVRegI(env); in iselIntExpr_R_wrk()
1325 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1326 HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); in iselIntExpr_R_wrk()
1327 addInstr(env, X86Instr_Bsfr32(False,src,tmp)); in iselIntExpr_R_wrk()
1328 addInstr(env, X86Instr_Alu32R(Xalu_MOV, in iselIntExpr_R_wrk()
1330 addInstr(env, X86Instr_Alu32R(Xalu_SUB, in iselIntExpr_R_wrk()
1336 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1337 HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); in iselIntExpr_R_wrk()
1338 addInstr(env, mk_iMOVsd_RR(src,dst)); in iselIntExpr_R_wrk()
1339 addInstr(env, X86Instr_Unary32(Xun_NEG,dst)); in iselIntExpr_R_wrk()
1340 addInstr(env, X86Instr_Alu32R(Xalu_OR, in iselIntExpr_R_wrk()
1342 addInstr(env, X86Instr_Sh32(Xsh_SAR, 31, dst)); in iselIntExpr_R_wrk()
1348 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1349 HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); in iselIntExpr_R_wrk()
1350 addInstr(env, mk_iMOVsd_RR(src, dst)); in iselIntExpr_R_wrk()
1351 addInstr(env, X86Instr_Unary32(Xun_NEG, dst)); in iselIntExpr_R_wrk()
1352 addInstr(env, X86Instr_Alu32R(Xalu_OR, X86RMI_Reg(src), dst)); in iselIntExpr_R_wrk()
1357 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1358 HReg vec = iselVecExpr(env, e->Iex.Unop.arg); in iselIntExpr_R_wrk()
1360 sub_from_esp(env, 16); in iselIntExpr_R_wrk()
1361 addInstr(env, X86Instr_SseLdSt(False/*store*/, vec, esp0)); in iselIntExpr_R_wrk()
1362 addInstr(env, X86Instr_Alu32R( Xalu_MOV, X86RMI_Mem(esp0), dst )); in iselIntExpr_R_wrk()
1363 add_to_esp(env, 16); in iselIntExpr_R_wrk()
1372 HReg rf = iselFltExpr(env, e->Iex.Unop.arg); in iselIntExpr_R_wrk()
1373 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1376 set_FPU_rounding_default(env); in iselIntExpr_R_wrk()
1378 sub_from_esp(env, 8); in iselIntExpr_R_wrk()
1380 addInstr(env, in iselIntExpr_R_wrk()
1383 addInstr(env, in iselIntExpr_R_wrk()
1386 add_to_esp(env, 8); in iselIntExpr_R_wrk()
1394 return iselIntExpr_R(env, e->Iex.Unop.arg); in iselIntExpr_R_wrk()
1402 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1404 iselInt64Expr(&xHi, &xLo, env, e->Iex.Unop.arg); in iselIntExpr_R_wrk()
1405 addInstr(env, X86Instr_Push(X86RMI_Reg(xHi))); in iselIntExpr_R_wrk()
1406 addInstr(env, X86Instr_Push(X86RMI_Reg(xLo))); in iselIntExpr_R_wrk()
1407 addInstr(env, X86Instr_Call( Xcc_ALWAYS, (Addr32)fn, in iselIntExpr_R_wrk()
1409 add_to_esp(env, 2*4); in iselIntExpr_R_wrk()
1410 addInstr(env, mk_iMOVsd_RR(hregX86_EAX(), dst)); in iselIntExpr_R_wrk()
1423 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1424 addInstr(env, X86Instr_Alu32R( in iselIntExpr_R_wrk()
1432 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1433 addInstr(env, X86Instr_LoadEX( in iselIntExpr_R_wrk()
1446 env, e->Iex.GetI.descr, in iselIntExpr_R_wrk()
1448 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1450 addInstr(env, X86Instr_LoadEX( 1, False, am, dst )); in iselIntExpr_R_wrk()
1454 addInstr(env, X86Instr_Alu32R(Xalu_MOV, X86RMI_Mem(am), dst)); in iselIntExpr_R_wrk()
1462 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1474 doHelperCall( &addToSp, &rloc, env, NULL/*guard*/, in iselIntExpr_R_wrk()
1480 addInstr(env, mk_iMOVsd_RR(hregX86_EAX(), dst)); in iselIntExpr_R_wrk()
1487 X86RMI* rmi = iselIntExpr_RMI ( env, e ); in iselIntExpr_R_wrk()
1488 HReg r = newVRegI(env); in iselIntExpr_R_wrk()
1489 addInstr(env, X86Instr_Alu32R(Xalu_MOV, rmi, r)); in iselIntExpr_R_wrk()
1496 && typeOfIRExpr(env->type_env,e->Iex.ITE.cond) == Ity_I1) { in iselIntExpr_R_wrk()
1497 HReg r1 = iselIntExpr_R(env, e->Iex.ITE.iftrue); in iselIntExpr_R_wrk()
1498 X86RM* r0 = iselIntExpr_RM(env, e->Iex.ITE.iffalse); in iselIntExpr_R_wrk()
1499 HReg dst = newVRegI(env); in iselIntExpr_R_wrk()
1500 addInstr(env, mk_iMOVsd_RR(r1,dst)); in iselIntExpr_R_wrk()
1501 X86CondCode cc = iselCondCode(env, e->Iex.ITE.cond); in iselIntExpr_R_wrk()
1502 addInstr(env, X86Instr_CMov32(cc ^ 1, r0, dst)); in iselIntExpr_R_wrk()
1549 static X86AMode* iselIntExpr_AMode ( ISelEnv* env, IRExpr* e ) in iselIntExpr_AMode() argument
1551 X86AMode* am = iselIntExpr_AMode_wrk(env, e); in iselIntExpr_AMode()
1557 static X86AMode* iselIntExpr_AMode_wrk ( ISelEnv* env, IRExpr* e ) in iselIntExpr_AMode_wrk() argument
1559 IRType ty = typeOfIRExpr(env->type_env,e); in iselIntExpr_AMode_wrk()
1579 HReg r1 = iselIntExpr_R(env, e->Iex.Binop.arg1->Iex.Binop.arg1); in iselIntExpr_AMode_wrk()
1580 HReg r2 = iselIntExpr_R(env, e->Iex.Binop.arg1 in iselIntExpr_AMode_wrk()
1595 HReg r1 = iselIntExpr_R(env, e->Iex.Binop.arg1); in iselIntExpr_AMode_wrk()
1596 HReg r2 = iselIntExpr_R(env, e->Iex.Binop.arg2->Iex.Binop.arg1 ); in iselIntExpr_AMode_wrk()
1606 HReg r1 = iselIntExpr_R(env, e->Iex.Binop.arg1); in iselIntExpr_AMode_wrk()
1613 HReg r1 = iselIntExpr_R(env, e); in iselIntExpr_AMode_wrk()
1624 static X86RMI* iselIntExpr_RMI ( ISelEnv* env, IRExpr* e ) in iselIntExpr_RMI() argument
1626 X86RMI* rmi = iselIntExpr_RMI_wrk(env, e); in iselIntExpr_RMI()
1644 static X86RMI* iselIntExpr_RMI_wrk ( ISelEnv* env, IRExpr* e ) in iselIntExpr_RMI_wrk() argument
1646 IRType ty = typeOfIRExpr(env->type_env,e); in iselIntExpr_RMI_wrk()
1670 X86AMode* am = iselIntExpr_AMode(env, e->Iex.Load.addr); in iselIntExpr_RMI_wrk()
1676 HReg r = iselIntExpr_R ( env, e ); in iselIntExpr_RMI_wrk()
1687 static X86RI* iselIntExpr_RI ( ISelEnv* env, IRExpr* e ) in iselIntExpr_RI() argument
1689 X86RI* ri = iselIntExpr_RI_wrk(env, e); in iselIntExpr_RI()
1704 static X86RI* iselIntExpr_RI_wrk ( ISelEnv* env, IRExpr* e ) in iselIntExpr_RI_wrk() argument
1706 IRType ty = typeOfIRExpr(env->type_env,e); in iselIntExpr_RI_wrk()
1723 HReg r = iselIntExpr_R ( env, e ); in iselIntExpr_RI_wrk()
1734 static X86RM* iselIntExpr_RM ( ISelEnv* env, IRExpr* e ) in iselIntExpr_RM() argument
1736 X86RM* rm = iselIntExpr_RM_wrk(env, e); in iselIntExpr_RM()
1752 static X86RM* iselIntExpr_RM_wrk ( ISelEnv* env, IRExpr* e ) in iselIntExpr_RM_wrk() argument
1754 IRType ty = typeOfIRExpr(env->type_env,e); in iselIntExpr_RM_wrk()
1767 HReg r = iselIntExpr_R ( env, e ); in iselIntExpr_RM_wrk()
1779 static X86CondCode iselCondCode ( ISelEnv* env, IRExpr* e ) in iselCondCode() argument
1782 return iselCondCode_wrk(env,e); in iselCondCode()
1786 static X86CondCode iselCondCode_wrk ( ISelEnv* env, IRExpr* e ) in iselCondCode_wrk() argument
1791 vassert(typeOfIRExpr(env->type_env,e) == Ity_I1); in iselCondCode_wrk()
1795 HReg r32 = lookupIRTemp(env, e->Iex.RdTmp.tmp); in iselCondCode_wrk()
1797 addInstr(env, X86Instr_Test32(1,X86RM_Reg(r32))); in iselCondCode_wrk()
1807 r = newVRegI(env); in iselCondCode_wrk()
1808 addInstr(env, X86Instr_Alu32R(Xalu_MOV,X86RMI_Imm(0),r)); in iselCondCode_wrk()
1809 addInstr(env, X86Instr_Alu32R(Xalu_XOR,X86RMI_Reg(r),r)); in iselCondCode_wrk()
1816 return 1 ^ iselCondCode(env, e->Iex.Unop.arg); in iselCondCode_wrk()
1823 X86RM* rm = iselIntExpr_RM(env, e->Iex.Unop.arg); in iselCondCode_wrk()
1824 addInstr(env, X86Instr_Test32(1,rm)); in iselCondCode_wrk()
1833 X86RM* rm = iselIntExpr_RM(env, e->Iex.Unop.arg); in iselCondCode_wrk()
1834 addInstr(env, X86Instr_Test32(0xFF,rm)); in iselCondCode_wrk()
1843 X86RM* rm = iselIntExpr_RM(env, e->Iex.Unop.arg); in iselCondCode_wrk()
1844 addInstr(env, X86Instr_Test32(0xFFFF,rm)); in iselCondCode_wrk()
1856 HReg r0 = iselIntExpr_R(env, mi.bindee[0]); in iselCondCode_wrk()
1857 X86RMI* rmi1 = iselIntExpr_RMI(env, mi.bindee[1]); in iselCondCode_wrk()
1858 HReg tmp = newVRegI(env); in iselCondCode_wrk()
1859 addInstr(env, mk_iMOVsd_RR(r0, tmp)); in iselCondCode_wrk()
1860 addInstr(env, X86Instr_Alu32R(Xalu_AND,rmi1,tmp)); in iselCondCode_wrk()
1871 HReg r0 = iselIntExpr_R(env, mi.bindee[0]); in iselCondCode_wrk()
1872 X86RMI* rmi1 = iselIntExpr_RMI(env, mi.bindee[1]); in iselCondCode_wrk()
1873 HReg tmp = newVRegI(env); in iselCondCode_wrk()
1874 addInstr(env, mk_iMOVsd_RR(r0, tmp)); in iselCondCode_wrk()
1875 addInstr(env, X86Instr_Alu32R(Xalu_OR,rmi1,tmp)); in iselCondCode_wrk()
1886 addInstr(env, X86Instr_Alu32M(Xalu_CMP, X86RI_Imm(0), am)); in iselCondCode_wrk()
1893 HReg r1 = iselIntExpr_R(env, e->Iex.Unop.arg); in iselCondCode_wrk()
1895 addInstr(env, X86Instr_Alu32R(Xalu_CMP,rmi2,r1)); in iselCondCode_wrk()
1908 HReg tmp = newVRegI(env); in iselCondCode_wrk()
1909 iselInt64Expr( &hi1, &lo1, env, mi.bindee[0] ); in iselCondCode_wrk()
1910 addInstr(env, mk_iMOVsd_RR(hi1, tmp)); in iselCondCode_wrk()
1911 addInstr(env, X86Instr_Alu32R(Xalu_OR,X86RMI_Reg(lo1),tmp)); in iselCondCode_wrk()
1912 iselInt64Expr( &hi2, &lo2, env, mi.bindee[1] ); in iselCondCode_wrk()
1913 addInstr(env, X86Instr_Alu32R(Xalu_OR,X86RMI_Reg(hi2),tmp)); in iselCondCode_wrk()
1914 addInstr(env, X86Instr_Alu32R(Xalu_OR,X86RMI_Reg(lo2),tmp)); in iselCondCode_wrk()
1923 HReg tmp = newVRegI(env); in iselCondCode_wrk()
1924 iselInt64Expr( &hi, &lo, env, e->Iex.Unop.arg ); in iselCondCode_wrk()
1925 addInstr(env, mk_iMOVsd_RR(hi, tmp)); in iselCondCode_wrk()
1926 addInstr(env, X86Instr_Alu32R(Xalu_OR,X86RMI_Reg(lo), tmp)); in iselCondCode_wrk()
1939 HReg r1 = iselIntExpr_R(env, e->Iex.Binop.arg1); in iselCondCode_wrk()
1940 addInstr(env, X86Instr_Test32(0xFF,X86RM_Reg(r1))); in iselCondCode_wrk()
1947 HReg r1 = iselIntExpr_R(env, e->Iex.Binop.arg1); in iselCondCode_wrk()
1948 X86RMI* rmi2 = iselIntExpr_RMI(env, e->Iex.Binop.arg2); in iselCondCode_wrk()
1949 HReg r = newVRegI(env); in iselCondCode_wrk()
1950 addInstr(env, mk_iMOVsd_RR(r1,r)); in iselCondCode_wrk()
1951 addInstr(env, X86Instr_Alu32R(Xalu_XOR,rmi2,r)); in iselCondCode_wrk()
1952 addInstr(env, X86Instr_Test32(0xFF,X86RM_Reg(r))); in iselCondCode_wrk()
1968 HReg r1 = iselIntExpr_R(env, e->Iex.Binop.arg1); in iselCondCode_wrk()
1969 X86RMI* rmi2 = iselIntExpr_RMI(env, e->Iex.Binop.arg2); in iselCondCode_wrk()
1970 HReg r = newVRegI(env); in iselCondCode_wrk()
1971 addInstr(env, mk_iMOVsd_RR(r1,r)); in iselCondCode_wrk()
1972 addInstr(env, X86Instr_Alu32R(Xalu_XOR,rmi2,r)); in iselCondCode_wrk()
1973 addInstr(env, X86Instr_Test32(0xFFFF,X86RM_Reg(r))); in iselCondCode_wrk()
1998 doHelperCall( &addToSp, &rloc, env, NULL/*guard*/, in iselCondCode_wrk()
2005 addInstr(env, X86Instr_Alu32R(Xalu_CMP, in iselCondCode_wrk()
2022 HReg r1 = iselIntExpr_R(env, e->Iex.Binop.arg1); in iselCondCode_wrk()
2023 X86RMI* rmi2 = iselIntExpr_RMI(env, e->Iex.Binop.arg2); in iselCondCode_wrk()
2024 addInstr(env, X86Instr_Alu32R(Xalu_CMP,rmi2,r1)); in iselCondCode_wrk()
2042 HReg tHi = newVRegI(env); in iselCondCode_wrk()
2043 HReg tLo = newVRegI(env); in iselCondCode_wrk()
2044 iselInt64Expr( &hi1, &lo1, env, e->Iex.Binop.arg1 ); in iselCondCode_wrk()
2045 iselInt64Expr( &hi2, &lo2, env, e->Iex.Binop.arg2 ); in iselCondCode_wrk()
2046 addInstr(env, mk_iMOVsd_RR(hi1, tHi)); in iselCondCode_wrk()
2047 addInstr(env, X86Instr_Alu32R(Xalu_XOR,X86RMI_Reg(hi2), tHi)); in iselCondCode_wrk()
2048 addInstr(env, mk_iMOVsd_RR(lo1, tLo)); in iselCondCode_wrk()
2049 addInstr(env, X86Instr_Alu32R(Xalu_XOR,X86RMI_Reg(lo2), tLo)); in iselCondCode_wrk()
2050 addInstr(env, X86Instr_Alu32R(Xalu_OR,X86RMI_Reg(tHi), tLo)); in iselCondCode_wrk()
2072 static void iselInt64Expr ( HReg* rHi, HReg* rLo, ISelEnv* env, IRExpr* e ) in iselInt64Expr() argument
2074 iselInt64Expr_wrk(rHi, rLo, env, e); in iselInt64Expr()
2085 static void iselInt64Expr_wrk ( HReg* rHi, HReg* rLo, ISelEnv* env, IRExpr* e ) in iselInt64Expr_wrk() argument
2090 vassert(typeOfIRExpr(env->type_env,e) == Ity_I64); in iselInt64Expr_wrk()
2097 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2098 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2102 addInstr(env, X86Instr_Alu32R(Xalu_MOV, X86RMI_Imm(wLo), tLo)); in iselInt64Expr_wrk()
2106 addInstr(env, X86Instr_Alu32R(Xalu_MOV, X86RMI_Imm(wHi), tHi)); in iselInt64Expr_wrk()
2107 addInstr(env, X86Instr_Alu32R(Xalu_MOV, X86RMI_Imm(wLo), tLo)); in iselInt64Expr_wrk()
2116 lookupIRTemp64( rHi, rLo, env, e->Iex.RdTmp.tmp); in iselInt64Expr_wrk()
2125 tLo = newVRegI(env); in iselInt64Expr_wrk()
2126 tHi = newVRegI(env); in iselInt64Expr_wrk()
2127 am0 = iselIntExpr_AMode(env, e->Iex.Load.addr); in iselInt64Expr_wrk()
2129 addInstr(env, X86Instr_Alu32R( Xalu_MOV, X86RMI_Mem(am0), tLo )); in iselInt64Expr_wrk()
2130 addInstr(env, X86Instr_Alu32R( Xalu_MOV, X86RMI_Mem(am4), tHi )); in iselInt64Expr_wrk()
2140 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2141 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2142 addInstr(env, X86Instr_Alu32R( Xalu_MOV, X86RMI_Mem(am), tLo )); in iselInt64Expr_wrk()
2143 addInstr(env, X86Instr_Alu32R( Xalu_MOV, X86RMI_Mem(am4), tHi )); in iselInt64Expr_wrk()
2152 = genGuestArrayOffset( env, e->Iex.GetI.descr, in iselInt64Expr_wrk()
2155 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2156 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2157 addInstr(env, X86Instr_Alu32R( Xalu_MOV, X86RMI_Mem(am), tLo )); in iselInt64Expr_wrk()
2158 addInstr(env, X86Instr_Alu32R( Xalu_MOV, X86RMI_Mem(am4), tHi )); in iselInt64Expr_wrk()
2167 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2168 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2169 iselInt64Expr(&e0Hi, &e0Lo, env, e->Iex.ITE.iffalse); in iselInt64Expr_wrk()
2170 iselInt64Expr(&e1Hi, &e1Lo, env, e->Iex.ITE.iftrue); in iselInt64Expr_wrk()
2171 addInstr(env, mk_iMOVsd_RR(e1Hi, tHi)); in iselInt64Expr_wrk()
2172 addInstr(env, mk_iMOVsd_RR(e1Lo, tLo)); in iselInt64Expr_wrk()
2173 X86CondCode cc = iselCondCode(env, e->Iex.ITE.cond); in iselInt64Expr_wrk()
2176 addInstr(env, X86Instr_CMov32(cc ^ 1, X86RM_Reg(e0Hi), tHi)); in iselInt64Expr_wrk()
2177 addInstr(env, X86Instr_CMov32(cc ^ 1, X86RM_Reg(e0Lo), tLo)); in iselInt64Expr_wrk()
2192 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2193 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2195 X86RM* rmLeft = iselIntExpr_RM(env, e->Iex.Binop.arg1); in iselInt64Expr_wrk()
2196 HReg rRight = iselIntExpr_R(env, e->Iex.Binop.arg2); in iselInt64Expr_wrk()
2197 addInstr(env, mk_iMOVsd_RR(rRight, hregX86_EAX())); in iselInt64Expr_wrk()
2198 addInstr(env, X86Instr_MulL(syned, rmLeft)); in iselInt64Expr_wrk()
2200 addInstr(env, mk_iMOVsd_RR(hregX86_EDX(), tHi)); in iselInt64Expr_wrk()
2201 addInstr(env, mk_iMOVsd_RR(hregX86_EAX(), tLo)); in iselInt64Expr_wrk()
2213 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2214 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2216 X86RM* rmRight = iselIntExpr_RM(env, e->Iex.Binop.arg2); in iselInt64Expr_wrk()
2217 iselInt64Expr(&sHi,&sLo, env, e->Iex.Binop.arg1); in iselInt64Expr_wrk()
2218 addInstr(env, mk_iMOVsd_RR(sHi, hregX86_EDX())); in iselInt64Expr_wrk()
2219 addInstr(env, mk_iMOVsd_RR(sLo, hregX86_EAX())); in iselInt64Expr_wrk()
2220 addInstr(env, X86Instr_Div(syned, rmRight)); in iselInt64Expr_wrk()
2221 addInstr(env, mk_iMOVsd_RR(hregX86_EDX(), tHi)); in iselInt64Expr_wrk()
2222 addInstr(env, mk_iMOVsd_RR(hregX86_EAX(), tLo)); in iselInt64Expr_wrk()
2233 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2234 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2238 iselInt64Expr(&xHi, &xLo, env, e->Iex.Binop.arg1); in iselInt64Expr_wrk()
2239 iselInt64Expr(&yHi, &yLo, env, e->Iex.Binop.arg2); in iselInt64Expr_wrk()
2240 addInstr(env, mk_iMOVsd_RR(xHi, tHi)); in iselInt64Expr_wrk()
2241 addInstr(env, X86Instr_Alu32R(op, X86RMI_Reg(yHi), tHi)); in iselInt64Expr_wrk()
2242 addInstr(env, mk_iMOVsd_RR(xLo, tLo)); in iselInt64Expr_wrk()
2243 addInstr(env, X86Instr_Alu32R(op, X86RMI_Reg(yLo), tLo)); in iselInt64Expr_wrk()
2256 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2257 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2260 iselInt64Expr(&xHi, &xLo, env, e->Iex.Binop.arg1); in iselInt64Expr_wrk()
2261 addInstr(env, mk_iMOVsd_RR(xHi, tHi)); in iselInt64Expr_wrk()
2262 addInstr(env, mk_iMOVsd_RR(xLo, tLo)); in iselInt64Expr_wrk()
2263 addInstr(env, X86Instr_Alu32R(Xalu_ADD, X86RMI_Imm(wLo), tLo)); in iselInt64Expr_wrk()
2264 addInstr(env, X86Instr_Alu32R(Xalu_ADC, X86RMI_Imm(wHi), tHi)); in iselInt64Expr_wrk()
2272 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2273 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2274 iselInt64Expr(&xHi, &xLo, env, e->Iex.Binop.arg1); in iselInt64Expr_wrk()
2275 addInstr(env, mk_iMOVsd_RR(xHi, tHi)); in iselInt64Expr_wrk()
2276 addInstr(env, mk_iMOVsd_RR(xLo, tLo)); in iselInt64Expr_wrk()
2277 iselInt64Expr(&yHi, &yLo, env, e->Iex.Binop.arg2); in iselInt64Expr_wrk()
2279 addInstr(env, X86Instr_Alu32R(Xalu_ADD, X86RMI_Reg(yLo), tLo)); in iselInt64Expr_wrk()
2280 addInstr(env, X86Instr_Alu32R(Xalu_ADC, X86RMI_Reg(yHi), tHi)); in iselInt64Expr_wrk()
2282 addInstr(env, X86Instr_Alu32R(Xalu_SUB, X86RMI_Reg(yLo), tLo)); in iselInt64Expr_wrk()
2283 addInstr(env, X86Instr_Alu32R(Xalu_SBB, X86RMI_Reg(yHi), tHi)); in iselInt64Expr_wrk()
2292 *rHi = iselIntExpr_R(env, e->Iex.Binop.arg1); in iselInt64Expr_wrk()
2293 *rLo = iselIntExpr_R(env, e->Iex.Binop.arg2); in iselInt64Expr_wrk()
2318 tLo = newVRegI(env); in iselInt64Expr_wrk()
2319 tHi = newVRegI(env); in iselInt64Expr_wrk()
2320 tTemp = newVRegI(env); in iselInt64Expr_wrk()
2321 rAmt = iselIntExpr_R(env, e->Iex.Binop.arg2); in iselInt64Expr_wrk()
2322 iselInt64Expr(&sHi,&sLo, env, e->Iex.Binop.arg1); in iselInt64Expr_wrk()
2323 addInstr(env, mk_iMOVsd_RR(rAmt, hregX86_ECX())); in iselInt64Expr_wrk()
2324 addInstr(env, mk_iMOVsd_RR(sHi, tHi)); in iselInt64Expr_wrk()
2325 addInstr(env, mk_iMOVsd_RR(sLo, tLo)); in iselInt64Expr_wrk()
2328 addInstr(env, X86Instr_Sh3232(Xsh_SHL, 0/*%cl*/, tLo, tHi)); in iselInt64Expr_wrk()
2329 addInstr(env, X86Instr_Sh32(Xsh_SHL, 0/*%cl*/, tLo)); in iselInt64Expr_wrk()
2330 addInstr(env, X86Instr_Test32(32, X86RM_Reg(hregX86_ECX()))); in iselInt64Expr_wrk()
2331 addInstr(env, X86Instr_CMov32(Xcc_NZ, X86RM_Reg(tLo), tHi)); in iselInt64Expr_wrk()
2332 addInstr(env, X86Instr_Alu32R(Xalu_MOV, X86RMI_Imm(0), tTemp)); in iselInt64Expr_wrk()
2333 addInstr(env, X86Instr_CMov32(Xcc_NZ, X86RM_Reg(tTemp), tLo)); in iselInt64Expr_wrk()
2360 tLo = newVRegI(env); in iselInt64Expr_wrk()
2361 tHi = newVRegI(env); in iselInt64Expr_wrk()
2362 tTemp = newVRegI(env); in iselInt64Expr_wrk()
2363 rAmt = iselIntExpr_R(env, e->Iex.Binop.arg2); in iselInt64Expr_wrk()
2364 iselInt64Expr(&sHi,&sLo, env, e->Iex.Binop.arg1); in iselInt64Expr_wrk()
2365 addInstr(env, mk_iMOVsd_RR(rAmt, hregX86_ECX())); in iselInt64Expr_wrk()
2366 addInstr(env, mk_iMOVsd_RR(sHi, tHi)); in iselInt64Expr_wrk()
2367 addInstr(env, mk_iMOVsd_RR(sLo, tLo)); in iselInt64Expr_wrk()
2370 addInstr(env, X86Instr_Sh3232(Xsh_SHR, 0/*%cl*/, tHi, tLo)); in iselInt64Expr_wrk()
2371 addInstr(env, X86Instr_Sh32(Xsh_SHR, 0/*%cl*/, tHi)); in iselInt64Expr_wrk()
2372 addInstr(env, X86Instr_Test32(32, X86RM_Reg(hregX86_ECX()))); in iselInt64Expr_wrk()
2373 addInstr(env, X86Instr_CMov32(Xcc_NZ, X86RM_Reg(tHi), tLo)); in iselInt64Expr_wrk()
2374 addInstr(env, X86Instr_Alu32R(Xalu_MOV, X86RMI_Imm(0), tTemp)); in iselInt64Expr_wrk()
2375 addInstr(env, X86Instr_CMov32(Xcc_NZ, X86RM_Reg(tTemp), tHi)); in iselInt64Expr_wrk()
2386 HReg rf = iselDblExpr(env, e->Iex.Binop.arg2); in iselInt64Expr_wrk()
2387 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2388 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2404 sub_from_esp(env, 8); in iselInt64Expr_wrk()
2407 set_FPU_rounding_mode( env, e->Iex.Binop.arg1 ); in iselInt64Expr_wrk()
2410 addInstr(env, X86Instr_FpLdStI(False/*store*/, 8, rf, zero_esp)); in iselInt64Expr_wrk()
2414 addInstr(env, X86Instr_Alu32R( in iselInt64Expr_wrk()
2416 addInstr(env, X86Instr_Alu32R( in iselInt64Expr_wrk()
2420 set_FPU_rounding_default( env ); in iselInt64Expr_wrk()
2423 add_to_esp(env, 8); in iselInt64Expr_wrk()
2536 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2537 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2538 iselInt64Expr(&yHi, &yLo, env, e->Iex.Binop.arg2); in iselInt64Expr_wrk()
2539 addInstr(env, X86Instr_Push(X86RMI_Reg(yHi))); in iselInt64Expr_wrk()
2540 addInstr(env, X86Instr_Push(X86RMI_Reg(yLo))); in iselInt64Expr_wrk()
2541 iselInt64Expr(&xHi, &xLo, env, e->Iex.Binop.arg1); in iselInt64Expr_wrk()
2542 addInstr(env, X86Instr_Push(X86RMI_Reg(xHi))); in iselInt64Expr_wrk()
2543 addInstr(env, X86Instr_Push(X86RMI_Reg(xLo))); in iselInt64Expr_wrk()
2544 addInstr(env, X86Instr_Call( Xcc_ALWAYS, (Addr32)fn, in iselInt64Expr_wrk()
2546 add_to_esp(env, 4*4); in iselInt64Expr_wrk()
2547 addInstr(env, mk_iMOVsd_RR(hregX86_EDX(), tHi)); in iselInt64Expr_wrk()
2548 addInstr(env, mk_iMOVsd_RR(hregX86_EAX(), tLo)); in iselInt64Expr_wrk()
2577 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2578 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2579 X86RMI* y = iselIntExpr_RMI(env, e->Iex.Binop.arg2); in iselInt64Expr_wrk()
2580 addInstr(env, X86Instr_Push(y)); in iselInt64Expr_wrk()
2581 iselInt64Expr(&xHi, &xLo, env, e->Iex.Binop.arg1); in iselInt64Expr_wrk()
2582 addInstr(env, X86Instr_Push(X86RMI_Reg(xHi))); in iselInt64Expr_wrk()
2583 addInstr(env, X86Instr_Push(X86RMI_Reg(xLo))); in iselInt64Expr_wrk()
2584 addInstr(env, X86Instr_Call( Xcc_ALWAYS, (Addr32)fn, in iselInt64Expr_wrk()
2586 add_to_esp(env, 3*4); in iselInt64Expr_wrk()
2587 addInstr(env, mk_iMOVsd_RR(hregX86_EDX(), tHi)); in iselInt64Expr_wrk()
2588 addInstr(env, mk_iMOVsd_RR(hregX86_EAX(), tLo)); in iselInt64Expr_wrk()
2606 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2607 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2608 HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); in iselInt64Expr_wrk()
2609 addInstr(env, mk_iMOVsd_RR(src,tHi)); in iselInt64Expr_wrk()
2610 addInstr(env, mk_iMOVsd_RR(src,tLo)); in iselInt64Expr_wrk()
2611 addInstr(env, X86Instr_Sh32(Xsh_SAR, 31, tHi)); in iselInt64Expr_wrk()
2619 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2620 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2621 HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); in iselInt64Expr_wrk()
2622 addInstr(env, mk_iMOVsd_RR(src,tLo)); in iselInt64Expr_wrk()
2623 addInstr(env, X86Instr_Alu32R(Xalu_MOV, X86RMI_Imm(0), tHi)); in iselInt64Expr_wrk()
2631 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2632 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2633 HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); in iselInt64Expr_wrk()
2634 addInstr(env, mk_iMOVsd_RR(src,tLo)); in iselInt64Expr_wrk()
2635 addInstr(env, X86Instr_Alu32R(Xalu_AND, in iselInt64Expr_wrk()
2637 addInstr(env, X86Instr_Alu32R(Xalu_MOV, X86RMI_Imm(0), tHi)); in iselInt64Expr_wrk()
2647 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2648 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2649 HReg vec = iselVecExpr(env, e->Iex.Unop.arg); in iselInt64Expr_wrk()
2653 sub_from_esp(env, 16); in iselInt64Expr_wrk()
2654 addInstr(env, X86Instr_SseLdSt(False/*store*/, vec, esp0)); in iselInt64Expr_wrk()
2655 addInstr(env, X86Instr_Alu32R( Xalu_MOV, in iselInt64Expr_wrk()
2657 addInstr(env, X86Instr_Alu32R( Xalu_MOV, in iselInt64Expr_wrk()
2659 add_to_esp(env, 16); in iselInt64Expr_wrk()
2667 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2668 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2669 X86CondCode cond = iselCondCode(env, e->Iex.Unop.arg); in iselInt64Expr_wrk()
2670 addInstr(env, X86Instr_Set32(cond,tLo)); in iselInt64Expr_wrk()
2671 addInstr(env, X86Instr_Sh32(Xsh_SHL, 31, tLo)); in iselInt64Expr_wrk()
2672 addInstr(env, X86Instr_Sh32(Xsh_SAR, 31, tLo)); in iselInt64Expr_wrk()
2673 addInstr(env, mk_iMOVsd_RR(tLo, tHi)); in iselInt64Expr_wrk()
2681 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2682 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2684 iselInt64Expr(&sHi, &sLo, env, e->Iex.Unop.arg); in iselInt64Expr_wrk()
2685 addInstr(env, mk_iMOVsd_RR(sHi, tHi)); in iselInt64Expr_wrk()
2686 addInstr(env, mk_iMOVsd_RR(sLo, tLo)); in iselInt64Expr_wrk()
2687 addInstr(env, X86Instr_Unary32(Xun_NOT,tHi)); in iselInt64Expr_wrk()
2688 addInstr(env, X86Instr_Unary32(Xun_NOT,tLo)); in iselInt64Expr_wrk()
2697 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2698 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2700 iselInt64Expr(&yHi, &yLo, env, e->Iex.Unop.arg); in iselInt64Expr_wrk()
2702 addInstr(env, X86Instr_Alu32R(Xalu_MOV, X86RMI_Imm(0), tLo)); in iselInt64Expr_wrk()
2703 addInstr(env, X86Instr_Alu32R(Xalu_SUB, X86RMI_Reg(yLo), tLo)); in iselInt64Expr_wrk()
2705 addInstr(env, X86Instr_Alu32R(Xalu_MOV, X86RMI_Imm(0), tHi)); in iselInt64Expr_wrk()
2706 addInstr(env, X86Instr_Alu32R(Xalu_SBB, X86RMI_Reg(yHi), tHi)); in iselInt64Expr_wrk()
2710 addInstr(env, X86Instr_Alu32R(Xalu_OR, X86RMI_Reg(yLo), tLo)); in iselInt64Expr_wrk()
2711 addInstr(env, X86Instr_Alu32R(Xalu_OR, X86RMI_Reg(yHi), tHi)); in iselInt64Expr_wrk()
2728 HReg xBoth = newVRegI(env); in iselInt64Expr_wrk()
2729 HReg merged = newVRegI(env); in iselInt64Expr_wrk()
2730 HReg tmp2 = newVRegI(env); in iselInt64Expr_wrk()
2732 iselInt64Expr(&xHi,&xLo, env, mi.bindee[0]); in iselInt64Expr_wrk()
2733 addInstr(env, mk_iMOVsd_RR(xHi,xBoth)); in iselInt64Expr_wrk()
2734 addInstr(env, X86Instr_Alu32R(Xalu_OR, in iselInt64Expr_wrk()
2737 iselInt64Expr(&yHi,&yLo, env, mi.bindee[1]); in iselInt64Expr_wrk()
2738 addInstr(env, mk_iMOVsd_RR(yHi,merged)); in iselInt64Expr_wrk()
2739 addInstr(env, X86Instr_Alu32R(Xalu_OR, in iselInt64Expr_wrk()
2741 addInstr(env, X86Instr_Alu32R(Xalu_OR, in iselInt64Expr_wrk()
2745 addInstr(env, mk_iMOVsd_RR(merged,tmp2)); in iselInt64Expr_wrk()
2746 addInstr(env, X86Instr_Unary32(Xun_NEG,tmp2)); in iselInt64Expr_wrk()
2747 addInstr(env, X86Instr_Alu32R(Xalu_OR, in iselInt64Expr_wrk()
2749 addInstr(env, X86Instr_Sh32(Xsh_SAR, 31, tmp2)); in iselInt64Expr_wrk()
2756 HReg tmp1 = newVRegI(env); in iselInt64Expr_wrk()
2757 HReg tmp2 = newVRegI(env); in iselInt64Expr_wrk()
2759 iselInt64Expr(&srcHi, &srcLo, env, e->Iex.Unop.arg); in iselInt64Expr_wrk()
2761 addInstr(env, mk_iMOVsd_RR(srcHi,tmp1)); in iselInt64Expr_wrk()
2762 addInstr(env, X86Instr_Alu32R(Xalu_OR, in iselInt64Expr_wrk()
2765 addInstr(env, mk_iMOVsd_RR(tmp1,tmp2)); in iselInt64Expr_wrk()
2766 addInstr(env, X86Instr_Unary32(Xun_NEG,tmp2)); in iselInt64Expr_wrk()
2767 addInstr(env, X86Instr_Alu32R(Xalu_OR, in iselInt64Expr_wrk()
2769 addInstr(env, X86Instr_Sh32(Xsh_SAR, 31, tmp2)); in iselInt64Expr_wrk()
2780 HReg rf = iselDblExpr(env, e->Iex.Unop.arg); in iselInt64Expr_wrk()
2781 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2782 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2786 set_FPU_rounding_default(env); in iselInt64Expr_wrk()
2788 sub_from_esp(env, 8); in iselInt64Expr_wrk()
2790 addInstr(env, in iselInt64Expr_wrk()
2793 addInstr(env, in iselInt64Expr_wrk()
2796 addInstr(env, in iselInt64Expr_wrk()
2799 add_to_esp(env, 8); in iselInt64Expr_wrk()
2818 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2819 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2820 iselInt64Expr(&xHi, &xLo, env, e->Iex.Unop.arg); in iselInt64Expr_wrk()
2821 addInstr(env, X86Instr_Push(X86RMI_Reg(xHi))); in iselInt64Expr_wrk()
2822 addInstr(env, X86Instr_Push(X86RMI_Reg(xLo))); in iselInt64Expr_wrk()
2823 addInstr(env, X86Instr_Call( Xcc_ALWAYS, (Addr32)fn, in iselInt64Expr_wrk()
2825 add_to_esp(env, 2*4); in iselInt64Expr_wrk()
2826 addInstr(env, mk_iMOVsd_RR(hregX86_EDX(), tHi)); in iselInt64Expr_wrk()
2827 addInstr(env, mk_iMOVsd_RR(hregX86_EAX(), tLo)); in iselInt64Expr_wrk()
2841 HReg tLo = newVRegI(env); in iselInt64Expr_wrk()
2842 HReg tHi = newVRegI(env); in iselInt64Expr_wrk()
2847 doHelperCall( &addToSp, &rloc, env, NULL/*guard*/, in iselInt64Expr_wrk()
2855 addInstr(env, mk_iMOVsd_RR(hregX86_EDX(), tHi)); in iselInt64Expr_wrk()
2856 addInstr(env, mk_iMOVsd_RR(hregX86_EAX(), tLo)); in iselInt64Expr_wrk()
2874 static HReg iselFltExpr ( ISelEnv* env, IRExpr* e ) in iselFltExpr() argument
2876 HReg r = iselFltExpr_wrk( env, e ); in iselFltExpr()
2886 static HReg iselFltExpr_wrk ( ISelEnv* env, IRExpr* e ) in iselFltExpr_wrk() argument
2888 IRType ty = typeOfIRExpr(env->type_env,e); in iselFltExpr_wrk()
2892 return lookupIRTemp(env, e->Iex.RdTmp.tmp); in iselFltExpr_wrk()
2897 HReg res = newVRegF(env); in iselFltExpr_wrk()
2899 am = iselIntExpr_AMode(env, e->Iex.Load.addr); in iselFltExpr_wrk()
2900 addInstr(env, X86Instr_FpLdSt(True/*load*/, 4, res, am)); in iselFltExpr_wrk()
2909 HReg dst = newVRegF(env); in iselFltExpr_wrk()
2910 HReg src = iselDblExpr(env, e->Iex.Binop.arg2); in iselFltExpr_wrk()
2911 set_FPU_rounding_mode( env, e->Iex.Binop.arg1 ); in iselFltExpr_wrk()
2912 addInstr(env, X86Instr_Fp64to32(src,dst)); in iselFltExpr_wrk()
2913 set_FPU_rounding_default( env ); in iselFltExpr_wrk()
2920 HReg res = newVRegF(env); in iselFltExpr_wrk()
2921 addInstr(env, X86Instr_FpLdSt( True/*load*/, 4, res, am )); in iselFltExpr_wrk()
2929 HReg dst = newVRegF(env); in iselFltExpr_wrk()
2930 X86RMI* rmi = iselIntExpr_RMI(env, e->Iex.Unop.arg); in iselFltExpr_wrk()
2932 addInstr(env, X86Instr_Push(rmi)); in iselFltExpr_wrk()
2933 addInstr(env, X86Instr_FpLdSt( in iselFltExpr_wrk()
2936 add_to_esp(env, 4); in iselFltExpr_wrk()
2941 HReg rf = iselFltExpr(env, e->Iex.Binop.arg2); in iselFltExpr_wrk()
2942 HReg dst = newVRegF(env); in iselFltExpr_wrk()
2948 set_FPU_rounding_mode( env, e->Iex.Binop.arg1 ); in iselFltExpr_wrk()
2951 addInstr(env, X86Instr_FpUnary(Xfp_ROUND, rf, dst)); in iselFltExpr_wrk()
2954 set_FPU_rounding_default( env ); in iselFltExpr_wrk()
2991 static HReg iselDblExpr ( ISelEnv* env, IRExpr* e ) in iselDblExpr() argument
2993 HReg r = iselDblExpr_wrk( env, e ); in iselDblExpr()
3003 static HReg iselDblExpr_wrk ( ISelEnv* env, IRExpr* e ) in iselDblExpr_wrk() argument
3005 IRType ty = typeOfIRExpr(env->type_env,e); in iselDblExpr_wrk()
3010 return lookupIRTemp(env, e->Iex.RdTmp.tmp); in iselDblExpr_wrk()
3015 HReg freg = newVRegF(env); in iselDblExpr_wrk()
3030 addInstr(env, X86Instr_Push(X86RMI_Imm(u.u32x2[1]))); in iselDblExpr_wrk()
3031 addInstr(env, X86Instr_Push(X86RMI_Imm(u.u32x2[0]))); in iselDblExpr_wrk()
3032 addInstr(env, X86Instr_FpLdSt(True/*load*/, 8, freg, in iselDblExpr_wrk()
3034 add_to_esp(env, 8); in iselDblExpr_wrk()
3040 HReg res = newVRegF(env); in iselDblExpr_wrk()
3042 am = iselIntExpr_AMode(env, e->Iex.Load.addr); in iselDblExpr_wrk()
3043 addInstr(env, X86Instr_FpLdSt(True/*load*/, 8, res, am)); in iselDblExpr_wrk()
3050 HReg res = newVRegF(env); in iselDblExpr_wrk()
3051 addInstr(env, X86Instr_FpLdSt( True/*load*/, 8, res, am )); in iselDblExpr_wrk()
3058 env, e->Iex.GetI.descr, in iselDblExpr_wrk()
3060 HReg res = newVRegF(env); in iselDblExpr_wrk()
3061 addInstr(env, X86Instr_FpLdSt( True/*load*/, 8, res, am )); in iselDblExpr_wrk()
3082 HReg res = newVRegF(env); in iselDblExpr_wrk()
3083 HReg srcL = iselDblExpr(env, triop->arg2); in iselDblExpr_wrk()
3084 HReg srcR = iselDblExpr(env, triop->arg3); in iselDblExpr_wrk()
3087 addInstr(env, X86Instr_FpBinary(fpop,srcL,srcR,res)); in iselDblExpr_wrk()
3090 roundToF64(env, res); in iselDblExpr_wrk()
3096 HReg rf = iselDblExpr(env, e->Iex.Binop.arg2); in iselDblExpr_wrk()
3097 HReg dst = newVRegF(env); in iselDblExpr_wrk()
3103 set_FPU_rounding_mode( env, e->Iex.Binop.arg1 ); in iselDblExpr_wrk()
3106 addInstr(env, X86Instr_FpUnary(Xfp_ROUND, rf, dst)); in iselDblExpr_wrk()
3109 set_FPU_rounding_default( env ); in iselDblExpr_wrk()
3115 HReg dst = newVRegF(env); in iselDblExpr_wrk()
3117 iselInt64Expr( &rHi, &rLo, env, e->Iex.Binop.arg2); in iselDblExpr_wrk()
3118 addInstr(env, X86Instr_Push(X86RMI_Reg(rHi))); in iselDblExpr_wrk()
3119 addInstr(env, X86Instr_Push(X86RMI_Reg(rLo))); in iselDblExpr_wrk()
3122 set_FPU_rounding_mode( env, e->Iex.Binop.arg1 ); in iselDblExpr_wrk()
3124 addInstr(env, X86Instr_FpLdStI( in iselDblExpr_wrk()
3129 set_FPU_rounding_default( env ); in iselDblExpr_wrk()
3131 add_to_esp(env, 8); in iselDblExpr_wrk()
3146 HReg res = newVRegF(env); in iselDblExpr_wrk()
3147 HReg src = iselDblExpr(env, e->Iex.Binop.arg2); in iselDblExpr_wrk()
3155 addInstr(env, X86Instr_FpUnary(fpop,src,res)); in iselDblExpr_wrk()
3158 roundToF64(env, res); in iselDblExpr_wrk()
3171 HReg res = newVRegF(env); in iselDblExpr_wrk()
3172 HReg src = iselDblExpr(env, e->Iex.Unop.arg); in iselDblExpr_wrk()
3173 addInstr(env, X86Instr_FpUnary(fpop,src,res)); in iselDblExpr_wrk()
3174 /* No need to do roundToF64(env,res) for Xfp_NEG or Xfp_ABS, in iselDblExpr_wrk()
3183 HReg dst = newVRegF(env); in iselDblExpr_wrk()
3184 HReg ri = iselIntExpr_R(env, e->Iex.Unop.arg); in iselDblExpr_wrk()
3185 addInstr(env, X86Instr_Push(X86RMI_Reg(ri))); in iselDblExpr_wrk()
3186 set_FPU_rounding_default(env); in iselDblExpr_wrk()
3187 addInstr(env, X86Instr_FpLdStI( in iselDblExpr_wrk()
3190 add_to_esp(env, 4); in iselDblExpr_wrk()
3196 HReg dst = newVRegF(env); in iselDblExpr_wrk()
3198 iselInt64Expr( &rHi, &rLo, env, e->Iex.Unop.arg); in iselDblExpr_wrk()
3200 set_FPU_rounding_default(env); in iselDblExpr_wrk()
3201 addInstr(env, X86Instr_Push(X86RMI_Reg(rHi))); in iselDblExpr_wrk()
3202 addInstr(env, X86Instr_Push(X86RMI_Reg(rLo))); in iselDblExpr_wrk()
3203 addInstr(env, X86Instr_FpLdSt( in iselDblExpr_wrk()
3206 add_to_esp(env, 8); in iselDblExpr_wrk()
3211 HReg res = iselFltExpr(env, e->Iex.Unop.arg); in iselDblExpr_wrk()
3222 && typeOfIRExpr(env->type_env,e->Iex.ITE.cond) == Ity_I1) { in iselDblExpr_wrk()
3223 HReg r1 = iselDblExpr(env, e->Iex.ITE.iftrue); in iselDblExpr_wrk()
3224 HReg r0 = iselDblExpr(env, e->Iex.ITE.iffalse); in iselDblExpr_wrk()
3225 HReg dst = newVRegF(env); in iselDblExpr_wrk()
3226 addInstr(env, X86Instr_FpUnary(Xfp_MOV,r1,dst)); in iselDblExpr_wrk()
3227 X86CondCode cc = iselCondCode(env, e->Iex.ITE.cond); in iselDblExpr_wrk()
3228 addInstr(env, X86Instr_FpCMov(cc ^ 1, r0, dst)); in iselDblExpr_wrk()
3242 static HReg iselVecExpr ( ISelEnv* env, IRExpr* e ) in iselVecExpr() argument
3244 HReg r = iselVecExpr_wrk( env, e ); in iselVecExpr()
3255 static HReg iselVecExpr_wrk ( ISelEnv* env, IRExpr* e ) in iselVecExpr_wrk() argument
3259 do { if (env->hwcaps == 0/*baseline, no sse*/ \ in iselVecExpr_wrk()
3260 || env->hwcaps == VEX_HWCAPS_X86_MMXEXT /*Integer SSE*/) \ in iselVecExpr_wrk()
3265 do { if (0 == (env->hwcaps & VEX_HWCAPS_X86_SSE2)) \ in iselVecExpr_wrk()
3270 (env->hwcaps & VEX_HWCAPS_X86_SSE2) in iselVecExpr_wrk()
3276 IRType ty = typeOfIRExpr(env->type_env,e); in iselVecExpr_wrk()
3283 return lookupIRTemp(env, e->Iex.RdTmp.tmp); in iselVecExpr_wrk()
3287 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3288 addInstr(env, X86Instr_SseLdSt( in iselVecExpr_wrk()
3298 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3299 X86AMode* am = iselIntExpr_AMode(env, e->Iex.Load.addr); in iselVecExpr_wrk()
3300 addInstr(env, X86Instr_SseLdSt( True/*load*/, dst, am )); in iselVecExpr_wrk()
3305 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3307 addInstr(env, X86Instr_SseConst(e->Iex.Const.con->Ico.V128, dst)); in iselVecExpr_wrk()
3320 X86AMode* am = iselIntExpr_AMode(env, mi.bindee[0]); in iselVecExpr_wrk()
3321 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3322 addInstr(env, X86Instr_SseLdzLO(8, dst, am)); in iselVecExpr_wrk()
3330 HReg arg = iselVecExpr(env, e->Iex.Unop.arg); in iselVecExpr_wrk()
3331 return do_sse_Not128(env, arg); in iselVecExpr_wrk()
3350 HReg arg = iselVecExpr(env, e->Iex.Unop.arg); in iselVecExpr_wrk()
3351 HReg tmp = newVRegV(env); in iselVecExpr_wrk()
3352 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3354 addInstr(env, X86Instr_SseReRg(Xsse_XOR, tmp, tmp)); in iselVecExpr_wrk()
3355 addInstr(env, X86Instr_SseReRg(Xsse_CMPEQ32, arg, tmp)); in iselVecExpr_wrk()
3356 tmp = do_sse_Not128(env, tmp); in iselVecExpr_wrk()
3357 addInstr(env, X86Instr_SseShuf(0xB1, tmp, dst)); in iselVecExpr_wrk()
3358 addInstr(env, X86Instr_SseReRg(Xsse_OR, tmp, dst)); in iselVecExpr_wrk()
3373 HReg arg = iselVecExpr(env, e->Iex.Unop.arg); in iselVecExpr_wrk()
3374 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3375 HReg r32 = newVRegI(env); in iselVecExpr_wrk()
3376 sub_from_esp(env, 16); in iselVecExpr_wrk()
3377 addInstr(env, X86Instr_SseLdSt(False/*store*/, arg, esp0)); in iselVecExpr_wrk()
3380 addInstr(env, X86Instr_Alu32R(Xalu_MOV, X86RMI_Mem(am), r32)); in iselVecExpr_wrk()
3381 addInstr(env, X86Instr_Unary32(Xun_NEG, r32)); in iselVecExpr_wrk()
3382 addInstr(env, X86Instr_Alu32R(Xalu_SBB, X86RMI_Reg(r32), r32)); in iselVecExpr_wrk()
3383 addInstr(env, X86Instr_Alu32M(Xalu_MOV, X86RI_Reg(r32), am)); in iselVecExpr_wrk()
3385 addInstr(env, X86Instr_SseLdSt(True/*load*/, dst, esp0)); in iselVecExpr_wrk()
3386 add_to_esp(env, 16); in iselVecExpr_wrk()
3394 HReg vec0 = newVRegV(env); in iselVecExpr_wrk()
3395 HReg vec1 = newVRegV(env); in iselVecExpr_wrk()
3396 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3401 addInstr(env, X86Instr_SseReRg(Xsse_XOR, vec0, vec0)); in iselVecExpr_wrk()
3402 addInstr(env, mk_vMOVsd_RR(vec0, vec1)); in iselVecExpr_wrk()
3403 addInstr(env, X86Instr_Sse32Fx4(Xsse_CMPEQF, vec1, vec1)); in iselVecExpr_wrk()
3406 arg = iselVecExpr(env, e->Iex.Unop.arg); in iselVecExpr_wrk()
3408 addInstr(env, mk_vMOVsd_RR(arg, dst)); in iselVecExpr_wrk()
3410 addInstr(env, X86Instr_SseReRg(cmpOp, vec0, dst)); in iselVecExpr_wrk()
3412 addInstr(env, X86Instr_SseReRg(Xsse_XOR, vec1, dst)); in iselVecExpr_wrk()
3420 HReg arg = iselVecExpr(env, e->Iex.Unop.arg); in iselVecExpr_wrk()
3421 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3422 addInstr(env, X86Instr_Sse32Fx4(op, arg, dst)); in iselVecExpr_wrk()
3437 HReg arg = iselVecExpr(env, e->Iex.Unop.arg); in iselVecExpr_wrk()
3438 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3439 addInstr(env, mk_vMOVsd_RR(arg, dst)); in iselVecExpr_wrk()
3440 addInstr(env, X86Instr_Sse32FLo(op, arg, dst)); in iselVecExpr_wrk()
3453 HReg arg = iselVecExpr(env, e->Iex.Unop.arg); in iselVecExpr_wrk()
3454 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3456 addInstr(env, mk_vMOVsd_RR(arg, dst)); in iselVecExpr_wrk()
3457 addInstr(env, X86Instr_Sse64FLo(op, arg, dst)); in iselVecExpr_wrk()
3462 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3464 X86RMI* rmi = iselIntExpr_RMI(env, e->Iex.Unop.arg); in iselVecExpr_wrk()
3465 addInstr(env, X86Instr_Push(rmi)); in iselVecExpr_wrk()
3466 addInstr(env, X86Instr_SseLdzLO(4, dst, esp0)); in iselVecExpr_wrk()
3467 add_to_esp(env, 4); in iselVecExpr_wrk()
3473 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3475 iselInt64Expr(&rHi, &rLo, env, e->Iex.Unop.arg); in iselVecExpr_wrk()
3476 addInstr(env, X86Instr_Push(X86RMI_Reg(rHi))); in iselVecExpr_wrk()
3477 addInstr(env, X86Instr_Push(X86RMI_Reg(rLo))); in iselVecExpr_wrk()
3478 addInstr(env, X86Instr_SseLdzLO(8, dst, esp0)); in iselVecExpr_wrk()
3479 add_to_esp(env, 8); in iselVecExpr_wrk()
3496 HReg arg = iselVecExpr(env, e->Iex.Binop.arg2); in iselVecExpr_wrk()
3497 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3500 addInstr(env, (e->Iex.Binop.op == Iop_Sqrt64Fx2 in iselVecExpr_wrk()
3507 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3508 HReg srcV = iselVecExpr(env, e->Iex.Binop.arg1); in iselVecExpr_wrk()
3509 HReg srcI = iselIntExpr_R(env, e->Iex.Binop.arg2); in iselVecExpr_wrk()
3511 sub_from_esp(env, 16); in iselVecExpr_wrk()
3512 addInstr(env, X86Instr_SseLdSt(False/*store*/, srcV, esp0)); in iselVecExpr_wrk()
3513 addInstr(env, X86Instr_Alu32M(Xalu_MOV, X86RI_Reg(srcI), esp0)); in iselVecExpr_wrk()
3514 addInstr(env, X86Instr_SseLdSt(True/*load*/, dst, esp0)); in iselVecExpr_wrk()
3515 add_to_esp(env, 16); in iselVecExpr_wrk()
3520 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3521 HReg srcV = iselVecExpr(env, e->Iex.Binop.arg1); in iselVecExpr_wrk()
3525 iselInt64Expr(&srcIhi, &srcIlo, env, e->Iex.Binop.arg2); in iselVecExpr_wrk()
3526 sub_from_esp(env, 16); in iselVecExpr_wrk()
3527 addInstr(env, X86Instr_SseLdSt(False/*store*/, srcV, esp0)); in iselVecExpr_wrk()
3528 addInstr(env, X86Instr_Alu32M(Xalu_MOV, X86RI_Reg(srcIlo), esp0)); in iselVecExpr_wrk()
3529 addInstr(env, X86Instr_Alu32M(Xalu_MOV, X86RI_Reg(srcIhi), esp4)); in iselVecExpr_wrk()
3530 addInstr(env, X86Instr_SseLdSt(True/*load*/, dst, esp0)); in iselVecExpr_wrk()
3531 add_to_esp(env, 16); in iselVecExpr_wrk()
3541 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3543 sub_from_esp(env, 16); in iselVecExpr_wrk()
3545 iselInt64Expr(&r1, &r0, env, e->Iex.Binop.arg2); in iselVecExpr_wrk()
3546 addInstr(env, X86Instr_Alu32M(Xalu_MOV, X86RI_Reg(r0), esp0)); in iselVecExpr_wrk()
3547 addInstr(env, X86Instr_Alu32M(Xalu_MOV, X86RI_Reg(r1), esp4)); in iselVecExpr_wrk()
3549 iselInt64Expr(&r3, &r2, env, e->Iex.Binop.arg1); in iselVecExpr_wrk()
3550 addInstr(env, X86Instr_Alu32M(Xalu_MOV, X86RI_Reg(r2), esp8)); in iselVecExpr_wrk()
3551 addInstr(env, X86Instr_Alu32M(Xalu_MOV, X86RI_Reg(r3), esp12)); in iselVecExpr_wrk()
3553 addInstr(env, X86Instr_SseLdSt(True/*load*/, dst, esp0)); in iselVecExpr_wrk()
3554 add_to_esp(env, 16); in iselVecExpr_wrk()
3566 HReg argL = iselVecExpr(env, e->Iex.Binop.arg1); in iselVecExpr_wrk()
3567 HReg argR = iselVecExpr(env, e->Iex.Binop.arg2); in iselVecExpr_wrk()
3568 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3569 addInstr(env, mk_vMOVsd_RR(argL, dst)); in iselVecExpr_wrk()
3570 addInstr(env, X86Instr_Sse32Fx4(op, argR, dst)); in iselVecExpr_wrk()
3582 HReg argL = iselVecExpr(env, e->Iex.Binop.arg1); in iselVecExpr_wrk()
3583 HReg argR = iselVecExpr(env, e->Iex.Binop.arg2); in iselVecExpr_wrk()
3584 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3586 addInstr(env, mk_vMOVsd_RR(argL, dst)); in iselVecExpr_wrk()
3587 addInstr(env, X86Instr_Sse64Fx2(op, argR, dst)); in iselVecExpr_wrk()
3602 HReg argL = iselVecExpr(env, e->Iex.Binop.arg1); in iselVecExpr_wrk()
3603 HReg argR = iselVecExpr(env, e->Iex.Binop.arg2); in iselVecExpr_wrk()
3604 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3605 addInstr(env, mk_vMOVsd_RR(argL, dst)); in iselVecExpr_wrk()
3606 addInstr(env, X86Instr_Sse32FLo(op, argR, dst)); in iselVecExpr_wrk()
3621 HReg argL = iselVecExpr(env, e->Iex.Binop.arg1); in iselVecExpr_wrk()
3622 HReg argR = iselVecExpr(env, e->Iex.Binop.arg2); in iselVecExpr_wrk()
3623 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3625 addInstr(env, mk_vMOVsd_RR(argL, dst)); in iselVecExpr_wrk()
3626 addInstr(env, X86Instr_Sse64FLo(op, argR, dst)); in iselVecExpr_wrk()
3690 HReg arg1 = iselVecExpr(env, e->Iex.Binop.arg1); in iselVecExpr_wrk()
3691 HReg arg2 = iselVecExpr(env, e->Iex.Binop.arg2); in iselVecExpr_wrk()
3692 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3696 addInstr(env, mk_vMOVsd_RR(arg2, dst)); in iselVecExpr_wrk()
3697 addInstr(env, X86Instr_SseReRg(op, arg1, dst)); in iselVecExpr_wrk()
3699 addInstr(env, mk_vMOVsd_RR(arg1, dst)); in iselVecExpr_wrk()
3700 addInstr(env, X86Instr_SseReRg(op, arg2, dst)); in iselVecExpr_wrk()
3714 HReg greg = iselVecExpr(env, e->Iex.Binop.arg1); in iselVecExpr_wrk()
3715 X86RMI* rmi = iselIntExpr_RMI(env, e->Iex.Binop.arg2); in iselVecExpr_wrk()
3717 HReg ereg = newVRegV(env); in iselVecExpr_wrk()
3718 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3720 addInstr(env, X86Instr_Push(X86RMI_Imm(0))); in iselVecExpr_wrk()
3721 addInstr(env, X86Instr_Push(X86RMI_Imm(0))); in iselVecExpr_wrk()
3722 addInstr(env, X86Instr_Push(X86RMI_Imm(0))); in iselVecExpr_wrk()
3723 addInstr(env, X86Instr_Push(rmi)); in iselVecExpr_wrk()
3724 addInstr(env, X86Instr_SseLdSt(True/*load*/, ereg, esp0)); in iselVecExpr_wrk()
3725 addInstr(env, mk_vMOVsd_RR(greg, dst)); in iselVecExpr_wrk()
3726 addInstr(env, X86Instr_SseReRg(op, ereg, dst)); in iselVecExpr_wrk()
3727 add_to_esp(env, 16); in iselVecExpr_wrk()
3741 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3742 HReg argL = iselVecExpr(env, e->Iex.Binop.arg1); in iselVecExpr_wrk()
3743 HReg argR = iselVecExpr(env, e->Iex.Binop.arg2); in iselVecExpr_wrk()
3744 HReg argp = newVRegI(env); in iselVecExpr_wrk()
3746 sub_from_esp(env, 112); in iselVecExpr_wrk()
3748 addInstr(env, X86Instr_Lea32(X86AMode_IR(48, hregX86_ESP()), in iselVecExpr_wrk()
3751 addInstr(env, X86Instr_Alu32R(Xalu_AND, in iselVecExpr_wrk()
3759 addInstr(env, X86Instr_Lea32(X86AMode_IR(0, argp), in iselVecExpr_wrk()
3761 addInstr(env, X86Instr_Lea32(X86AMode_IR(16, argp), in iselVecExpr_wrk()
3763 addInstr(env, X86Instr_Lea32(X86AMode_IR(32, argp), in iselVecExpr_wrk()
3769 addInstr(env, X86Instr_SseLdSt(False/*!isLoad*/, argL, in iselVecExpr_wrk()
3771 addInstr(env, X86Instr_SseLdSt(False/*!isLoad*/, argR, in iselVecExpr_wrk()
3774 addInstr(env, X86Instr_Call( Xcc_ALWAYS, (Addr32)fn, in iselVecExpr_wrk()
3778 addInstr(env, X86Instr_SseLdSt(True/*isLoad*/, dst, in iselVecExpr_wrk()
3781 add_to_esp(env, 112); in iselVecExpr_wrk()
3801 HReg argL = iselVecExpr(env, triop->arg2); in iselVecExpr_wrk()
3802 HReg argR = iselVecExpr(env, triop->arg3); in iselVecExpr_wrk()
3803 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3804 addInstr(env, mk_vMOVsd_RR(argL, dst)); in iselVecExpr_wrk()
3807 addInstr(env, X86Instr_Sse32Fx4(op, argR, dst)); in iselVecExpr_wrk()
3817 HReg argL = iselVecExpr(env, triop->arg2); in iselVecExpr_wrk()
3818 HReg argR = iselVecExpr(env, triop->arg3); in iselVecExpr_wrk()
3819 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3821 addInstr(env, mk_vMOVsd_RR(argL, dst)); in iselVecExpr_wrk()
3824 addInstr(env, X86Instr_Sse64Fx2(op, argR, dst)); in iselVecExpr_wrk()
3835 HReg r1 = iselVecExpr(env, e->Iex.ITE.iftrue); in iselVecExpr_wrk()
3836 HReg r0 = iselVecExpr(env, e->Iex.ITE.iffalse); in iselVecExpr_wrk()
3837 HReg dst = newVRegV(env); in iselVecExpr_wrk()
3838 addInstr(env, mk_vMOVsd_RR(r1,dst)); in iselVecExpr_wrk()
3839 X86CondCode cc = iselCondCode(env, e->Iex.ITE.cond); in iselVecExpr_wrk()
3840 addInstr(env, X86Instr_SseCMov(cc ^ 1, r0, dst)); in iselVecExpr_wrk()
3846 LibVEX_ppVexHwCaps(VexArchX86,env->hwcaps)); in iselVecExpr_wrk()
3860 static void iselStmt ( ISelEnv* env, IRStmt* stmt ) in iselStmt() argument
3872 IRType tya = typeOfIRExpr(env->type_env, stmt->Ist.Store.addr); in iselStmt()
3873 IRType tyd = typeOfIRExpr(env->type_env, stmt->Ist.Store.data); in iselStmt()
3880 X86AMode* am = iselIntExpr_AMode(env, stmt->Ist.Store.addr); in iselStmt()
3881 X86RI* ri = iselIntExpr_RI(env, stmt->Ist.Store.data); in iselStmt()
3882 addInstr(env, X86Instr_Alu32M(Xalu_MOV,ri,am)); in iselStmt()
3886 X86AMode* am = iselIntExpr_AMode(env, stmt->Ist.Store.addr); in iselStmt()
3887 HReg r = iselIntExpr_R(env, stmt->Ist.Store.data); in iselStmt()
3888 addInstr(env, X86Instr_Store( toUChar(tyd==Ity_I8 ? 1 : 2), in iselStmt()
3893 X86AMode* am = iselIntExpr_AMode(env, stmt->Ist.Store.addr); in iselStmt()
3894 HReg r = iselDblExpr(env, stmt->Ist.Store.data); in iselStmt()
3895 addInstr(env, X86Instr_FpLdSt(False/*store*/, 8, r, am)); in iselStmt()
3899 X86AMode* am = iselIntExpr_AMode(env, stmt->Ist.Store.addr); in iselStmt()
3900 HReg r = iselFltExpr(env, stmt->Ist.Store.data); in iselStmt()
3901 addInstr(env, X86Instr_FpLdSt(False/*store*/, 4, r, am)); in iselStmt()
3906 iselInt64Expr(&vHi, &vLo, env, stmt->Ist.Store.data); in iselStmt()
3907 rA = iselIntExpr_R(env, stmt->Ist.Store.addr); in iselStmt()
3908 addInstr(env, X86Instr_Alu32M( in iselStmt()
3910 addInstr(env, X86Instr_Alu32M( in iselStmt()
3915 X86AMode* am = iselIntExpr_AMode(env, stmt->Ist.Store.addr); in iselStmt()
3916 HReg r = iselVecExpr(env, stmt->Ist.Store.data); in iselStmt()
3917 addInstr(env, X86Instr_SseLdSt(False/*store*/, r, am)); in iselStmt()
3925 IRType ty = typeOfIRExpr(env->type_env, stmt->Ist.Put.data); in iselStmt()
3929 X86RI* ri = iselIntExpr_RI(env, stmt->Ist.Put.data); in iselStmt()
3930 addInstr(env, in iselStmt()
3939 HReg r = iselIntExpr_R(env, stmt->Ist.Put.data); in iselStmt()
3940 addInstr(env, X86Instr_Store( in iselStmt()
3951 iselInt64Expr(&vHi, &vLo, env, stmt->Ist.Put.data); in iselStmt()
3952 addInstr(env, X86Instr_Alu32M( Xalu_MOV, X86RI_Reg(vLo), am )); in iselStmt()
3953 addInstr(env, X86Instr_Alu32M( Xalu_MOV, X86RI_Reg(vHi), am4 )); in iselStmt()
3957 HReg vec = iselVecExpr(env, stmt->Ist.Put.data); in iselStmt()
3959 addInstr(env, X86Instr_SseLdSt(False/*store*/, vec, am)); in iselStmt()
3963 HReg f32 = iselFltExpr(env, stmt->Ist.Put.data); in iselStmt()
3965 set_FPU_rounding_default(env); /* paranoia */ in iselStmt()
3966 addInstr(env, X86Instr_FpLdSt( False/*store*/, 4, f32, am )); in iselStmt()
3970 HReg f64 = iselDblExpr(env, stmt->Ist.Put.data); in iselStmt()
3972 set_FPU_rounding_default(env); /* paranoia */ in iselStmt()
3973 addInstr(env, X86Instr_FpLdSt( False/*store*/, 8, f64, am )); in iselStmt()
3985 env, puti->descr, in iselStmt()
3988 IRType ty = typeOfIRExpr(env->type_env, puti->data); in iselStmt()
3990 HReg val = iselDblExpr(env, puti->data); in iselStmt()
3991 addInstr(env, X86Instr_FpLdSt( False/*store*/, 8, val, am )); in iselStmt()
3995 HReg r = iselIntExpr_R(env, puti->data); in iselStmt()
3996 addInstr(env, X86Instr_Store( 1, r, am )); in iselStmt()
4000 HReg r = iselIntExpr_R(env, puti->data); in iselStmt()
4001 addInstr(env, X86Instr_Alu32M( Xalu_MOV, X86RI_Reg(r), am )); in iselStmt()
4007 iselInt64Expr(&rHi, &rLo, env, puti->data); in iselStmt()
4008 addInstr(env, X86Instr_Alu32M( Xalu_MOV, X86RI_Reg(rLo), am )); in iselStmt()
4009 addInstr(env, X86Instr_Alu32M( Xalu_MOV, X86RI_Reg(rHi), am4 )); in iselStmt()
4018 IRType ty = typeOfIRTemp(env->type_env, tmp); in iselStmt()
4029 X86AMode* am = iselIntExpr_AMode(env, stmt->Ist.WrTmp.data); in iselStmt()
4030 HReg dst = lookupIRTemp(env, tmp); in iselStmt()
4036 addInstr(env, X86Instr_Alu32R(Xalu_MOV, X86RMI_Reg(src), dst)); in iselStmt()
4038 addInstr(env, X86Instr_Lea32(am,dst)); in iselStmt()
4044 X86RMI* rmi = iselIntExpr_RMI(env, stmt->Ist.WrTmp.data); in iselStmt()
4045 HReg dst = lookupIRTemp(env, tmp); in iselStmt()
4046 addInstr(env, X86Instr_Alu32R(Xalu_MOV,rmi,dst)); in iselStmt()
4051 iselInt64Expr(&rHi,&rLo, env, stmt->Ist.WrTmp.data); in iselStmt()
4052 lookupIRTemp64( &dstHi, &dstLo, env, tmp); in iselStmt()
4053 addInstr(env, mk_iMOVsd_RR(rHi,dstHi) ); in iselStmt()
4054 addInstr(env, mk_iMOVsd_RR(rLo,dstLo) ); in iselStmt()
4058 X86CondCode cond = iselCondCode(env, stmt->Ist.WrTmp.data); in iselStmt()
4059 HReg dst = lookupIRTemp(env, tmp); in iselStmt()
4060 addInstr(env, X86Instr_Set32(cond, dst)); in iselStmt()
4064 HReg dst = lookupIRTemp(env, tmp); in iselStmt()
4065 HReg src = iselDblExpr(env, stmt->Ist.WrTmp.data); in iselStmt()
4066 addInstr(env, X86Instr_FpUnary(Xfp_MOV,src,dst)); in iselStmt()
4070 HReg dst = lookupIRTemp(env, tmp); in iselStmt()
4071 HReg src = iselFltExpr(env, stmt->Ist.WrTmp.data); in iselStmt()
4072 addInstr(env, X86Instr_FpUnary(Xfp_MOV,src,dst)); in iselStmt()
4076 HReg dst = lookupIRTemp(env, tmp); in iselStmt()
4077 HReg src = iselVecExpr(env, stmt->Ist.WrTmp.data); in iselStmt()
4078 addInstr(env, mk_vMOVsd_RR(src,dst)); in iselStmt()
4091 retty = typeOfIRTemp(env->type_env, d->tmp); in iselStmt()
4110 doHelperCall( &addToSp, &rloc, env, d->guard, d->cee, retty, d->args ); in iselStmt()
4127 HReg dst = lookupIRTemp(env, d->tmp); in iselStmt()
4128 addInstr(env, mk_iMOVsd_RR(hregX86_EAX(),dst) ); in iselStmt()
4137 lookupIRTemp64( &dstHi, &dstLo, env, d->tmp); in iselStmt()
4138 addInstr(env, mk_iMOVsd_RR(hregX86_EDX(),dstHi) ); in iselStmt()
4139 addInstr(env, mk_iMOVsd_RR(hregX86_EAX(),dstLo) ); in iselStmt()
4149 HReg dst = lookupIRTemp(env, d->tmp); in iselStmt()
4151 addInstr(env, X86Instr_SseLdSt( True/*load*/, dst, am )); in iselStmt()
4152 add_to_esp(env, addToSp); in iselStmt()
4166 addInstr(env, X86Instr_MFence(env->hwcaps)); in iselStmt()
4179 IRType ty = typeOfIRExpr(env->type_env, cas->dataLo); in iselStmt()
4181 X86AMode* am = iselIntExpr_AMode(env, cas->addr); in iselStmt()
4182 HReg rDataLo = iselIntExpr_R(env, cas->dataLo); in iselStmt()
4183 HReg rExpdLo = iselIntExpr_R(env, cas->expdLo); in iselStmt()
4184 HReg rOldLo = lookupIRTemp(env, cas->oldLo); in iselStmt()
4187 addInstr(env, mk_iMOVsd_RR(rExpdLo, rOldLo)); in iselStmt()
4188 addInstr(env, mk_iMOVsd_RR(rExpdLo, hregX86_EAX())); in iselStmt()
4189 addInstr(env, mk_iMOVsd_RR(rDataLo, hregX86_EBX())); in iselStmt()
4196 addInstr(env, X86Instr_ACAS(am, sz)); in iselStmt()
4197 addInstr(env, in iselStmt()
4204 IRType ty = typeOfIRExpr(env->type_env, cas->dataLo); in iselStmt()
4208 X86AMode* am = iselIntExpr_AMode(env, cas->addr); in iselStmt()
4209 HReg rDataHi = iselIntExpr_R(env, cas->dataHi); in iselStmt()
4210 HReg rDataLo = iselIntExpr_R(env, cas->dataLo); in iselStmt()
4211 HReg rExpdHi = iselIntExpr_R(env, cas->expdHi); in iselStmt()
4212 HReg rExpdLo = iselIntExpr_R(env, cas->expdLo); in iselStmt()
4213 HReg rOldHi = lookupIRTemp(env, cas->oldHi); in iselStmt()
4214 HReg rOldLo = lookupIRTemp(env, cas->oldLo); in iselStmt()
4217 addInstr(env, mk_iMOVsd_RR(rExpdHi, rOldHi)); in iselStmt()
4218 addInstr(env, mk_iMOVsd_RR(rExpdLo, rOldLo)); in iselStmt()
4219 addInstr(env, mk_iMOVsd_RR(rExpdHi, hregX86_EDX())); in iselStmt()
4220 addInstr(env, mk_iMOVsd_RR(rExpdLo, hregX86_EAX())); in iselStmt()
4221 addInstr(env, mk_iMOVsd_RR(rDataHi, hregX86_ECX())); in iselStmt()
4222 addInstr(env, mk_iMOVsd_RR(rDataLo, hregX86_EBX())); in iselStmt()
4223 addInstr(env, X86Instr_DACAS(am)); in iselStmt()
4224 addInstr(env, in iselStmt()
4227 addInstr(env, in iselStmt()
4250 X86CondCode cc = iselCondCode(env, stmt->Ist.Exit.guard); in iselStmt()
4256 if (env->chainingAllowed) { in iselStmt()
4261 = ((Addr32)stmt->Ist.Exit.dst->Ico.U32) > env->max_ga; in iselStmt()
4263 addInstr(env, X86Instr_XDirect(stmt->Ist.Exit.dst->Ico.U32, in iselStmt()
4269 HReg r = iselIntExpr_R(env, IRExpr_Const(stmt->Ist.Exit.dst)); in iselStmt()
4270 addInstr(env, X86Instr_XAssisted(r, amEIP, cc, Ijk_Boring)); in iselStmt()
4295 HReg r = iselIntExpr_R(env, IRExpr_Const(stmt->Ist.Exit.dst)); in iselStmt()
4296 addInstr(env, X86Instr_XAssisted(r, amEIP, cc, stmt->Ist.Exit.jk)); in iselStmt()
4319 static void iselNext ( ISelEnv* env, in iselNext() argument
4337 if (env->chainingAllowed) { in iselNext()
4342 = ((Addr32)cdst->Ico.U32) > env->max_ga; in iselNext()
4344 addInstr(env, X86Instr_XDirect(cdst->Ico.U32, in iselNext()
4351 HReg r = iselIntExpr_R(env, next); in iselNext()
4352 addInstr(env, X86Instr_XAssisted(r, amEIP, Xcc_ALWAYS, in iselNext()
4362 HReg r = iselIntExpr_R(env, next); in iselNext()
4364 if (env->chainingAllowed) { in iselNext()
4365 addInstr(env, X86Instr_XIndir(r, amEIP, Xcc_ALWAYS)); in iselNext()
4367 addInstr(env, X86Instr_XAssisted(r, amEIP, Xcc_ALWAYS, in iselNext()
4396 HReg r = iselIntExpr_R(env, next); in iselNext()
4398 addInstr(env, X86Instr_XAssisted(r, amEIP, Xcc_ALWAYS, jk)); in iselNext()
4432 ISelEnv* env; in iselSB_X86() local
4449 env = LibVEX_Alloc_inline(sizeof(ISelEnv)); in iselSB_X86()
4450 env->vreg_ctr = 0; in iselSB_X86()
4453 env->code = newHInstrArray(); in iselSB_X86()
4455 /* Copy BB's type env. */ in iselSB_X86()
4456 env->type_env = bb->tyenv; in iselSB_X86()
4460 env->n_vregmap = bb->tyenv->types_used; in iselSB_X86()
4461 env->vregmap = LibVEX_Alloc_inline(env->n_vregmap * sizeof(HReg)); in iselSB_X86()
4462 env->vregmapHI = LibVEX_Alloc_inline(env->n_vregmap * sizeof(HReg)); in iselSB_X86()
4465 env->chainingAllowed = chainingAllowed; in iselSB_X86()
4466 env->hwcaps = hwcaps_host; in iselSB_X86()
4467 env->max_ga = max_ga; in iselSB_X86()
4472 for (i = 0; i < env->n_vregmap; i++) { in iselSB_X86()
4487 env->vregmap[i] = hreg; in iselSB_X86()
4488 env->vregmapHI[i] = hregHI; in iselSB_X86()
4490 env->vreg_ctr = j; in iselSB_X86()
4495 addInstr(env, X86Instr_EvCheck(amCounter, amFailAddr)); in iselSB_X86()
4502 addInstr(env, X86Instr_ProfInc()); in iselSB_X86()
4507 iselStmt(env, bb->stmts[i]); in iselSB_X86()
4509 iselNext(env, bb->next, bb->jumpkind, bb->offsIP); in iselSB_X86()
4512 env->code->n_vregs = env->vreg_ctr; in iselSB_X86()
4513 return env->code; in iselSB_X86()