diff options
author | Ian Lynagh <igloo@earth.li> | 2012-02-24 00:56:26 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2012-02-24 00:56:26 +0000 |
commit | d16c68110cc2bbb9aaa47a6ac11ed4e57527646d (patch) | |
tree | 121cf2e2a508d64cb1d997e9a40deac8be2e40a1 /compiler/nativeGen/X86/CodeGen.hs | |
parent | 45eb0a425bb134d41e47a90e73ec5279c23bbc27 (diff) | |
download | haskell-d16c68110cc2bbb9aaa47a6ac11ed4e57527646d.tar.gz |
Implement 2-word-multiply for x86_64
Diffstat (limited to 'compiler/nativeGen/X86/CodeGen.hs')
-rw-r--r-- | compiler/nativeGen/X86/CodeGen.hs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs index 5f582774c2..84f443eef2 100644 --- a/compiler/nativeGen/X86/CodeGen.hs +++ b/compiler/nativeGen/X86/CodeGen.hs @@ -1854,6 +1854,21 @@ genCCall64 target dest_regs args = ADC size (OpImm (ImmInteger 0)) (OpReg reg_h) return code _ -> panic "genCCall64: Wrong number of arguments/results for add2" + (CmmPrim (MO_U_Mul2 width) _, [CmmHinted res_h _, CmmHinted res_l _]) -> + case args of + [CmmHinted arg_x _, CmmHinted arg_y _] -> + do (y_reg, y_code) <- getRegOrMem arg_y + x_code <- getAnyReg arg_x + let size = intSize width + reg_h = getRegisterReg True (CmmLocal res_h) + reg_l = getRegisterReg True (CmmLocal res_l) + code = y_code `appOL` + x_code rax `appOL` + toOL [MUL2 size y_reg, + MOV size (OpReg rdx) (OpReg reg_h), + MOV size (OpReg rax) (OpReg reg_l)] + return code + _ -> panic "genCCall64: Wrong number of arguments/results for add2" (CmmPrim _ (Just mkStmts), results) -> stmtsToInstrs (mkStmts results args) |