From a58b86dad39835841eb6f24e13253c69447abfc9 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Mon, 15 Oct 2012 21:23:20 +0200 Subject: PPC: Compile math.sqrt() to fsqrt instruction. --- src/lj_asm_ppc.h | 5 ++++- src/lj_target_ppc.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lj_asm_ppc.h b/src/lj_asm_ppc.h index e3cbe5b8..f65eed5a 100644 --- a/src/lj_asm_ppc.h +++ b/src/lj_asm_ppc.h @@ -2026,7 +2026,10 @@ static void asm_ir(ASMState *as, IRIns *ir) case IR_FPMATH: if (ir->op2 == IRFPM_EXP2 && asm_fpjoin_pow(as, ir)) break; - asm_callid(as, ir, IRCALL_lj_vm_floor + ir->op2); + if (ir->op2 == IRFPM_SQRT && (as->flags & JIT_F_SQRT)) + asm_fpunary(as, ir, PPCI_FSQRT); + else + asm_callid(as, ir, IRCALL_lj_vm_floor + ir->op2); break; /* Overflow-checking arithmetic ops. */ diff --git a/src/lj_target_ppc.h b/src/lj_target_ppc.h index f5e89325..5347c3f7 100644 --- a/src/lj_target_ppc.h +++ b/src/lj_target_ppc.h @@ -263,6 +263,7 @@ typedef enum PPCIns { PPCI_FSUB = 0xfc000028, PPCI_FMUL = 0xfc000032, PPCI_FDIV = 0xfc000024, + PPCI_FSQRT = 0xfc00002c, PPCI_FMADD = 0xfc00003a, PPCI_FMSUB = 0xfc000038, -- cgit v1.2.3-55-g6feb