aboutsummaryrefslogtreecommitdiffstats
path: root/src/ortho/mcode/ortho_code-x86-emits.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2015-11-12 07:02:47 +0100
committerTristan Gingold <tgingold@free.fr>2015-11-12 07:02:47 +0100
commit02dbf10ab326793ed997b91e4647218cab01fe3b (patch)
treea9ecc2d48d11e5f053b8ad5cdabd8cb7f61cf86e /src/ortho/mcode/ortho_code-x86-emits.adb
parentd311f82ce7a565123f31bfab734489bcf4a51895 (diff)
downloadghdl-02dbf10ab326793ed997b91e4647218cab01fe3b.tar.gz
ghdl-02dbf10ab326793ed997b91e4647218cab01fe3b.tar.bz2
ghdl-02dbf10ab326793ed997b91e4647218cab01fe3b.zip
mcode x86: enable sse.
Diffstat (limited to 'src/ortho/mcode/ortho_code-x86-emits.adb')
-rw-r--r--src/ortho/mcode/ortho_code-x86-emits.adb15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/ortho/mcode/ortho_code-x86-emits.adb b/src/ortho/mcode/ortho_code-x86-emits.adb
index 46a6423e6..8e0b8f447 100644
--- a/src/ortho/mcode/ortho_code-x86-emits.adb
+++ b/src/ortho/mcode/ortho_code-x86-emits.adb
@@ -1638,9 +1638,19 @@ package body Ortho_Code.X86.Emits is
-- Convert FP to xxx.
procedure Gen_Conv_Fp (Stmt : O_Enode)
is
+ Mode : constant Mode_Type := Get_Expr_Mode (Stmt);
Reg : constant O_Reg := Get_Expr_Reg (Stmt);
Reg_Op : constant O_Reg := Get_Expr_Reg (Get_Expr_Operand (Stmt));
begin
+ if Mode = Mode_I32 and then Reg_Op in Regs_Xmm then
+ -- cvtsd2si
+ Init_Modrm_Reg (Reg_Op, Sz_32l);
+ Gen_SSE_Rep_Opc (Mode_F64, 16#2d#);
+ Gen_Mod_Rm (To_Reg32 (Reg) * 8);
+ End_Insn;
+ return;
+ end if;
+
Init_Modrm_Offset
(R_Bp, -Int32 (Cur_Subprg.Target.Fp_Slot), Sz_32l);
@@ -1657,7 +1667,7 @@ package body Ortho_Code.X86.Emits is
End_Insn;
end if;
- case Get_Expr_Mode (Stmt) is
+ case Mode is
when Mode_I32 =>
-- fistpl slot(%ebp)
Start_Insn;
@@ -1946,8 +1956,7 @@ package body Ortho_Code.X86.Emits is
| Mode_F64 =>
-- No Mod or Rem for fp types.
pragma Assert (Kind = OE_Div_Ov);
- Gen_Emit_Fp_Or_Xmm_Op
- (Stmt, 2#111_000#, 2#110_000#, 16#5e#);
+ Gen_Emit_Fp_Or_Xmm_Op (Stmt, 2#110_000#, 2#110_000#, 16#5e#);
when others =>
Error_Emit ("emit_insn: mod_ov", Stmt);
end case;