[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] libjit ChangeLog tests/cond.pas jit/jit-rules-x...
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] libjit ChangeLog tests/cond.pas jit/jit-rules-x... |
Date: |
Sat, 19 Jul 2008 19:19:51 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: libjit
Changes by: Klaus Treichel <ktreichel> 08/07/19 19:19:51
Modified files:
. : ChangeLog
tests : cond.pas
jit : jit-rules-x86-64.c jit-rules-x86-64.ins
Log message:
Add more tests using branches in tests/cond.pas.
Rewrite float32/float64 compare and branch rules with consideration of
nan
values.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libjit/ChangeLog?cvsroot=dotgnu-pnet&r1=1.385&r2=1.386
http://cvs.savannah.gnu.org/viewcvs/libjit/tests/cond.pas?cvsroot=dotgnu-pnet&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-rules-x86-64.c?cvsroot=dotgnu-pnet&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-rules-x86-64.ins?cvsroot=dotgnu-pnet&r1=1.7&r2=1.8
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/libjit/ChangeLog,v
retrieving revision 1.385
retrieving revision 1.386
diff -u -b -r1.385 -r1.386
--- ChangeLog 19 Jul 2008 10:20:51 -0000 1.385
+++ ChangeLog 19 Jul 2008 19:19:50 -0000 1.386
@@ -8,6 +8,15 @@
* tests/cond.pas: Add float compare tests where nan values are
involved. Add compare tests for the *_inv opcodes.
+ Add the same tests using branches for all float compare opcodes.
+
+ * jit/jit-rules-x86-64.c (xmm_setcc, xmm_cmp_setcc_reg_reg,
+ xmm_brcc, xmm_cmp_brcc_reg_reg, xmm_cmp_brcc_reg_membase): Add
+ functions to handle float compares with consideration of nan values.
+
+ * jit/jit-rules-x66-64.ins: Rewrite the float32 and float64 compare
+ and branch rules using the new functions in jit-rules-x86-64.c.
+ Add the corresponding *_inv rules.
2008-07-06 Klaus Treichel <address@hidden>
Index: tests/cond.pas
===================================================================
RCS file: /cvsroot/dotgnu-pnet/libjit/tests/cond.pas,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- tests/cond.pas 19 Jul 2008 10:20:51 -0000 1.2
+++ tests/cond.pas 19 Jul 2008 19:19:50 -0000 1.3
@@ -837,6 +837,585 @@
runcheck("cond_n_nle_0.0_1.0", longreal_nle(0.0, 1.0), False);
end;
+function shortreal_beq(f1, f2: ShortReal): Boolean;
+begin
+ if (f1 = f2) then begin
+ shortreal_beq := True;
+ end else begin
+ shortreal_beq := False;
+ end;
+end;
+
+function shortreal_bneq(f1, f2: ShortReal): Boolean;
+begin
+ if not (f1 = f2) then begin
+ shortreal_bneq := True;
+ end else begin
+ shortreal_bneq := False;
+ end;
+end;
+
+function shortreal_bne(f1, f2: ShortReal): Boolean;
+begin
+ if (f1 <> f2) then begin
+ shortreal_bne := True;
+ end else begin
+ shortreal_bne := False;
+ end;
+end;
+
+function shortreal_bnne(f1, f2: ShortReal): Boolean;
+begin
+ if not (f1 <> f2) then begin
+ shortreal_bnne := True;
+ end else begin
+ shortreal_bnne := False;
+ end;
+end;
+
+function shortreal_bgt(f1, f2: ShortReal): Boolean;
+begin
+ if (f1 > f2) then begin
+ shortreal_bgt := True;
+ end else begin
+ shortreal_bgt := False;
+ end;
+end;
+
+function shortreal_bngt(f1, f2: ShortReal): Boolean;
+begin
+ if not (f1 > f2) then begin
+ shortreal_bngt := True;
+ end else begin
+ shortreal_bngt := False;
+ end;
+end;
+
+function shortreal_bge(f1, f2: ShortReal): Boolean;
+begin
+ if (f1 >= f2) then begin
+ shortreal_bge := True;
+ end else begin
+ shortreal_bge := False;
+ end;
+end;
+
+function shortreal_bnge(f1, f2: ShortReal): Boolean;
+begin
+ if not (f1 >= f2) then begin
+ shortreal_bnge := True;
+ end else begin
+ shortreal_bnge := False;
+ end;
+end;
+
+function shortreal_blt(f1, f2: ShortReal): Boolean;
+begin
+ if (f1 < f2) then begin
+ shortreal_blt := True;
+ end else begin
+ shortreal_blt := False;
+ end;
+end;
+
+function shortreal_bnlt(f1, f2: ShortReal): Boolean;
+begin
+ if not (f1 < f2) then begin
+ shortreal_bnlt := True;
+ end else begin
+ shortreal_bnlt := False;
+ end;
+end;
+
+function shortreal_ble(f1, f2: ShortReal): Boolean;
+begin
+ if (f1 <= f2) then begin
+ shortreal_ble := True;
+ end else begin
+ shortreal_ble := False;
+ end;
+end;
+
+function shortreal_bnle(f1, f2: ShortReal): Boolean;
+begin
+ if not (f1 <= f2) then begin
+ shortreal_bnle := True;
+ end else begin
+ shortreal_bnle := False;
+ end;
+end;
+
+procedure shortreal_branch_tests;
+var
+ fnan :ShortReal;
+begin
+ fnan := sqrt(ShortReal(-1));
+
+ runcheck("cond_f_beq_nan_0.0", shortreal_beq(fnan, 0.0), False);
+ runcheck("cond_f_beq_0.0_nan", shortreal_beq(0.0, fnan), False);
+ runcheck("cond_f_beq_nan_nan", shortreal_beq(fnan, fnan), False);
+ runcheck("cond_f_beq_1.0_0.0", shortreal_beq(1.0, 0.0), False);
+ runcheck("cond_f_beq_0.0_0.0", shortreal_beq(0.0, 0.0), True);
+ runcheck("cond_f_beq_0.0_1.0", shortreal_beq(0.0, 1.0), False);
+ runcheck("cond_f_bneq_nan_0.0", shortreal_bneq(fnan, 0.0), True);
+ runcheck("cond_f_bneq_0.0_nan", shortreal_bneq(0.0, fnan), True);
+ runcheck("cond_f_bneq_nan_nan", shortreal_bneq(fnan, fnan), True);
+ runcheck("cond_f_bneq_1.0_0.0", shortreal_bneq(1.0, 0.0), True);
+ runcheck("cond_f_bneq_0.0_0.0", shortreal_bneq(0.0, 0.0), False);
+ runcheck("cond_f_bneq_0.0_1.0", shortreal_bneq(0.0, 1.0), True);
+
+ runcheck("cond_f_bne_nan_0.0", shortreal_bne(fnan, 0.0), True);
+ runcheck("cond_f_bne_0.0_nan", shortreal_bne(0.0, fnan), True);
+ runcheck("cond_f_bne_nan_nan", shortreal_bne(fnan, fnan), True);
+ runcheck("cond_f_bne_1.0_0.0", shortreal_bne(1.0, 0.0), True);
+ runcheck("cond_f_bne_0.0_0.0", shortreal_bne(0.0, 0.0), False);
+ runcheck("cond_f_bne_0.0_1.0", shortreal_bne(0.0, 1.0), True);
+ runcheck("cond_f_bnne_nan_0.0", shortreal_bnne(fnan, 0.0), False);
+ runcheck("cond_f_bnne_0.0_nan", shortreal_bnne(0.0, fnan), False);
+ runcheck("cond_f_bnne_nan_nan", shortreal_bnne(fnan, fnan), False);
+ runcheck("cond_f_bnne_1.0_0.0", shortreal_bnne(1.0, 0.0), False);
+ runcheck("cond_f_bnne_0.0_0.0", shortreal_bnne(0.0, 0.0), True);
+ runcheck("cond_f_bnne_0.0_1.0", shortreal_bnne(0.0, 1.0), False);
+
+ runcheck("cond_f_bgt_nan_0.0", shortreal_bgt(fnan, 0.0), False);
+ runcheck("cond_f_bgt_0.0_nan", shortreal_bgt(0.0, fnan), False);
+ runcheck("cond_f_bgt_nan_nan", shortreal_bgt(fnan, fnan), False);
+ runcheck("cond_f_bgt_0.0_0.0", shortreal_bgt(0.0, 0.0), False);
+ runcheck("cond_f_bgt_1.0_0.0", shortreal_bgt(1.0, 0.0), True);
+ runcheck("cond_f_bgt_0.0_1.0", shortreal_bgt(0.0, 1.0), False);
+ runcheck("cond_f_bngt_nan_0.0", shortreal_bngt(fnan, 0.0), True);
+ runcheck("cond_f_bngt_0.0_nan", shortreal_bngt(0.0, fnan), True);
+ runcheck("cond_f_bngt_nan_nan", shortreal_bngt(fnan, fnan), True);
+ runcheck("cond_f_bngt_0.0_0.0", shortreal_bngt(0.0, 0.0), True);
+ runcheck("cond_f_bngt_1.0_0.0", shortreal_bngt(1.0, 0.0), False);
+ runcheck("cond_f_bngt_0.0_1.0", shortreal_bngt(0.0, 1.0), True);
+
+ runcheck("cond_f_bge_nan_0.0", shortreal_bge(fnan, 0.0), False);
+ runcheck("cond_f_bge_0.0_nan", shortreal_bge(0.0, fnan), False);
+ runcheck("cond_f_bge_nan_nan", shortreal_bge(fnan, fnan), False);
+ runcheck("cond_f_bge_0.0_0.0", shortreal_bge(0.0, 0.0), True);
+ runcheck("cond_f_bge_1.0_0.0", shortreal_bge(1.0, 0.0), True);
+ runcheck("cond_f_bge_0.0_1.0", shortreal_bge(0.0, 1.0), False);
+ runcheck("cond_f_bnge_nan_0.0", shortreal_bnge(fnan, 0.0), True);
+ runcheck("cond_f_bnge_0.0_nan", shortreal_bnge(0.0, fnan), True);
+ runcheck("cond_f_bnge_nan_nan", shortreal_bnge(fnan, fnan), True);
+ runcheck("cond_f_bnge_0.0_0.0", shortreal_bnge(0.0, 0.0), False);
+ runcheck("cond_f_bnge_1.0_0.0", shortreal_bnge(1.0, 0.0), False);
+ runcheck("cond_f_bnge_0.0_1.0", shortreal_bnge(0.0, 1.0), True);
+
+ runcheck("cond_f_blt_nan_0.0", shortreal_blt(fnan, 0.0), False);
+ runcheck("cond_f_blt_0.0_nan", shortreal_blt(0.0, fnan), False);
+ runcheck("cond_f_blt_nan_nan", shortreal_blt(fnan, fnan), False);
+ runcheck("cond_f_blt_0.0_0.0", shortreal_blt(0.0, 0.0), False);
+ runcheck("cond_f_blt_1.0_0.0", shortreal_blt(1.0, 0.0), False);
+ runcheck("cond_f_blt_0.0_1.0", shortreal_blt(0.0, 1.0), True);
+ runcheck("cond_f_bnlt_nan_0.0", shortreal_bnlt(fnan, 0.0), True);
+ runcheck("cond_f_bnlt_0.0_nan", shortreal_bnlt(0.0, fnan), True);
+ runcheck("cond_f_bnlt_nan_nan", shortreal_bnlt(fnan, fnan), True);
+ runcheck("cond_f_bnlt_0.0_0.0", shortreal_bnlt(0.0, 0.0), True);
+ runcheck("cond_f_bnlt_1.0_0.0", shortreal_bnlt(1.0, 0.0), True);
+ runcheck("cond_f_bnlt_0.0_1.0", shortreal_bnlt(0.0, 1.0), False);
+
+ runcheck("cond_f_ble_nan_0.0", shortreal_ble(fnan, 0.0), False);
+ runcheck("cond_f_ble_0.0_nan", shortreal_ble(0.0, fnan), False);
+ runcheck("cond_f_ble_nan_nan", shortreal_ble(fnan, fnan), False);
+ runcheck("cond_f_ble_0.0_0.0", shortreal_ble(0.0, 0.0), True);
+ runcheck("cond_f_ble_1.0_0.0", shortreal_ble(1.0, 0.0), False);
+ runcheck("cond_f_ble_0.0_1.0", shortreal_ble(0.0, 1.0), True);
+ runcheck("cond_f_bnle_nan_0.0", shortreal_bnle(fnan, 0.0), True);
+ runcheck("cond_f_bnle_0.0_nan", shortreal_bnle(0.0, fnan), True);
+ runcheck("cond_f_bnle_nan_nan", shortreal_bnle(fnan, fnan), True);
+ runcheck("cond_f_bnle_0.0_0.0", shortreal_bnle(0.0, 0.0), False);
+ runcheck("cond_f_bnle_1.0_0.0", shortreal_bnle(1.0, 0.0), True);
+ runcheck("cond_f_bnle_0.0_1.0", shortreal_bnle(0.0, 1.0), False);
+end;
+
+function real_beq(d1, d2: Real): Boolean;
+begin
+ if (d1 = d2) then begin
+ real_beq := True;
+ end else begin
+ real_beq := False;
+ end;
+end;
+
+function real_bneq(d1, d2: Real): Boolean;
+begin
+ if not (d1 = d2) then begin
+ real_bneq := True;
+ end else begin
+ real_bneq := False;
+ end;
+end;
+
+function real_bne(d1, d2: Real): Boolean;
+begin
+ if (d1 <> d2) then begin
+ real_bne := True;
+ end else begin
+ real_bne := False;
+ end;
+end;
+
+function real_bnne(d1, d2: Real): Boolean;
+begin
+ if not (d1 <> d2) then begin
+ real_bnne := True;
+ end else begin
+ real_bnne := False;
+ end;
+end;
+
+function real_bgt(d1, d2: Real): Boolean;
+begin
+ if (d1 > d2) then begin
+ real_bgt := True;
+ end else begin
+ real_bgt := False;
+ end;
+end;
+
+function real_bngt(d1, d2: Real): Boolean;
+begin
+ if not (d1 > d2) then begin
+ real_bngt := True;
+ end else begin
+ real_bngt := False;
+ end;
+end;
+
+function real_bge(d1, d2: Real): Boolean;
+begin
+ if (d1 >= d2) then begin
+ real_bge := True;
+ end else begin
+ real_bge := False;
+ end;
+end;
+
+function real_bnge(d1, d2: Real): Boolean;
+begin
+ if not (d1 >= d2) then begin
+ real_bnge := True;
+ end else begin
+ real_bnge := False;
+ end;
+end;
+
+function real_blt(d1, d2: Real): Boolean;
+begin
+ if (d1 < d2) then begin
+ real_blt := True;
+ end else begin
+ real_blt := False;
+ end;
+end;
+
+function real_bnlt(d1, d2: Real): Boolean;
+begin
+ if not (d1 < d2) then begin
+ real_bnlt := True;
+ end else begin
+ real_bnlt := False;
+ end;
+end;
+
+function real_ble(d1, d2: Real): Boolean;
+begin
+ if (d1 <= d2) then begin
+ real_ble := True;
+ end else begin
+ real_ble := False;
+ end;
+end;
+
+function real_bnle(d1, d2: Real): Boolean;
+begin
+ if not (d1 <= d2) then begin
+ real_bnle := True;
+ end else begin
+ real_bnle := False;
+ end;
+end;
+
+procedure real_branch_tests;
+var
+ dnan :Real;
+begin
+ dnan := sqrt(Real(-1));
+
+ runcheck("cond_d_beq_nan_0.0", real_beq(dnan, 0.0), False);
+ runcheck("cond_d_beq_0.0_nan", real_beq(0.0, dnan), False);
+ runcheck("cond_d_beq_nan_nan", real_beq(dnan, dnan), False);
+ runcheck("cond_d_beq_1.0_0.0", real_beq(1.0, 0.0), False);
+ runcheck("cond_d_beq_0.0_0.0", real_beq(0.0, 0.0), True);
+ runcheck("cond_d_beq_0.0_1.0", real_beq(0.0, 1.0), False);
+ runcheck("cond_d_bneq_nan_0.0", real_bneq(dnan, 0.0), True);
+ runcheck("cond_d_bneq_0.0_nan", real_bneq(0.0, dnan), True);
+ runcheck("cond_d_bneq_nan_nan", real_bneq(dnan, dnan), True);
+ runcheck("cond_d_bneq_1.0_0.0", real_bneq(1.0, 0.0), True);
+ runcheck("cond_d_bneq_0.0_0.0", real_bneq(0.0, 0.0), False);
+ runcheck("cond_d_bneq_0.0_1.0", real_bneq(0.0, 1.0), True);
+
+ runcheck("cond_d_bne_nan_0.0", real_bne(dnan, 0.0), True);
+ runcheck("cond_d_bne_0.0_nan", real_bne(0.0, dnan), True);
+ runcheck("cond_d_bne_nan_nan", real_bne(dnan, dnan), True);
+ runcheck("cond_d_bne_1.0_0.0", real_bne(1.0, 0.0), True);
+ runcheck("cond_d_bne_0.0_0.0", real_bne(0.0, 0.0), False);
+ runcheck("cond_d_bne_0.0_1.0", real_bne(0.0, 1.0), True);
+ runcheck("cond_d_bnne_nan_0.0", real_bnne(dnan, 0.0), False);
+ runcheck("cond_d_bnne_0.0_nan", real_bnne(0.0, dnan), False);
+ runcheck("cond_d_bnne_nan_nan", real_bnne(dnan, dnan), False);
+ runcheck("cond_d_bnne_1.0_0.0", real_bnne(1.0, 0.0), False);
+ runcheck("cond_d_bnne_0.0_0.0", real_bnne(0.0, 0.0), True);
+ runcheck("cond_d_bnne_0.0_1.0", real_bnne(0.0, 1.0), False);
+
+ runcheck("cond_d_bgt_nan_0.0", real_bgt(dnan, 0.0), False);
+ runcheck("cond_d_bgt_0.0_nan", real_bgt(0.0, dnan), False);
+ runcheck("cond_d_bgt_nan_nan", real_bgt(dnan, dnan), False);
+ runcheck("cond_d_bgt_0.0_0.0", real_bgt(0.0, 0.0), False);
+ runcheck("cond_d_bgt_1.0_0.0", real_bgt(1.0, 0.0), True);
+ runcheck("cond_d_bgt_0.0_1.0", real_bgt(0.0, 1.0), False);
+ runcheck("cond_d_bngt_nan_0.0", real_bngt(dnan, 0.0), True);
+ runcheck("cond_d_bngt_0.0_nan", real_bngt(0.0, dnan), True);
+ runcheck("cond_d_bngt_nan_nan", real_bngt(dnan, dnan), True);
+ runcheck("cond_d_bngt_0.0_0.0", real_bngt(0.0, 0.0), True);
+ runcheck("cond_d_bngt_1.0_0.0", real_bngt(1.0, 0.0), False);
+ runcheck("cond_d_bngt_0.0_1.0", real_bngt(0.0, 1.0), True);
+
+ runcheck("cond_d_bge_nan_0.0", real_bge(dnan, 0.0), False);
+ runcheck("cond_d_bge_0.0_nan", real_bge(0.0, dnan), False);
+ runcheck("cond_d_bge_nan_nan", real_bge(dnan, dnan), False);
+ runcheck("cond_d_bge_0.0_0.0", real_bge(0.0, 0.0), True);
+ runcheck("cond_d_bge_1.0_0.0", real_bge(1.0, 0.0), True);
+ runcheck("cond_d_bge_0.0_1.0", real_bge(0.0, 1.0), False);
+ runcheck("cond_d_bnge_nan_0.0", real_bnge(dnan, 0.0), True);
+ runcheck("cond_d_bnge_0.0_nan", real_bnge(0.0, dnan), True);
+ runcheck("cond_d_bnge_nan_nan", real_bnge(dnan, dnan), True);
+ runcheck("cond_d_bnge_0.0_0.0", real_bnge(0.0, 0.0), False);
+ runcheck("cond_d_bnge_1.0_0.0", real_bnge(1.0, 0.0), False);
+ runcheck("cond_d_bnge_0.0_1.0", real_bnge(0.0, 1.0), True);
+
+ runcheck("cond_d_blt_nan_0.0", real_blt(dnan, 0.0), False);
+ runcheck("cond_d_blt_0.0_nan", real_blt(0.0, dnan), False);
+ runcheck("cond_d_blt_nan_nan", real_blt(dnan, dnan), False);
+ runcheck("cond_d_blt_0.0_0.0", real_blt(0.0, 0.0), False);
+ runcheck("cond_d_blt_1.0_0.0", real_blt(1.0, 0.0), False);
+ runcheck("cond_d_blt_0.0_1.0", real_blt(0.0, 1.0), True);
+ runcheck("cond_d_bnlt_nan_0.0", real_bnlt(dnan, 0.0), True);
+ runcheck("cond_d_bnlt_0.0_nan", real_bnlt(0.0, dnan), True);
+ runcheck("cond_d_bnlt_nan_nan", real_bnlt(dnan, dnan), True);
+ runcheck("cond_d_bnlt_0.0_0.0", real_bnlt(0.0, 0.0), True);
+ runcheck("cond_d_bnlt_1.0_0.0", real_bnlt(1.0, 0.0), True);
+ runcheck("cond_d_bnlt_0.0_1.0", real_bnlt(0.0, 1.0), False);
+
+ runcheck("cond_d_ble_nan_0.0", real_ble(dnan, 0.0), False);
+ runcheck("cond_d_ble_0.0_nan", real_ble(0.0, dnan), False);
+ runcheck("cond_d_ble_nan_nan", real_ble(dnan, dnan), False);
+ runcheck("cond_d_ble_0.0_0.0", real_ble(0.0, 0.0), True);
+ runcheck("cond_d_ble_1.0_0.0", real_ble(1.0, 0.0), False);
+ runcheck("cond_d_ble_0.0_1.0", real_ble(0.0, 1.0), True);
+ runcheck("cond_d_bnle_nan_0.0", real_bnle(dnan, 0.0), True);
+ runcheck("cond_d_bnle_0.0_nan", real_bnle(0.0, dnan), True);
+ runcheck("cond_d_bnle_nan_nan", real_bnle(dnan, dnan), True);
+ runcheck("cond_d_bnle_0.0_0.0", real_bnle(0.0, 0.0), False);
+ runcheck("cond_d_bnle_1.0_0.0", real_bnle(1.0, 0.0), True);
+ runcheck("cond_d_bnle_0.0_1.0", real_bnle(0.0, 1.0), False);
+end;
+
+function longreal_beq(n1, n2: LongReal): Boolean;
+begin
+ if (n1 = n2) then begin
+ longreal_beq := True;
+ end else begin
+ longreal_beq := False;
+ end;
+end;
+
+function longreal_bneq(n1, n2: LongReal): Boolean;
+begin
+ if not (n1 = n2) then begin
+ longreal_bneq := True;
+ end else begin
+ longreal_bneq := False;
+ end;
+end;
+
+function longreal_bne(n1, n2: LongReal): Boolean;
+begin
+ if (n1 <> n2) then begin
+ longreal_bne := True;
+ end else begin
+ longreal_bne := False;
+ end;
+end;
+
+function longreal_bnne(n1, n2: LongReal): Boolean;
+begin
+ if not (n1 <> n2) then begin
+ longreal_bnne := True;
+ end else begin
+ longreal_bnne := False;
+ end;
+end;
+
+function longreal_bgt(n1, n2: LongReal): Boolean;
+begin
+ if (n1 > n2) then begin
+ longreal_bgt := True;
+ end else begin
+ longreal_bgt := False;
+ end;
+end;
+
+function longreal_bngt(n1, n2: LongReal): Boolean;
+begin
+ if not (n1 > n2) then begin
+ longreal_bngt := True;
+ end else begin
+ longreal_bngt := False;
+ end;
+end;
+
+function longreal_bge(n1, n2: LongReal): Boolean;
+begin
+ if (n1 >= n2) then begin
+ longreal_bge := True;
+ end else begin
+ longreal_bge := False;
+ end;
+end;
+
+function longreal_bnge(n1, n2: LongReal): Boolean;
+begin
+ if not (n1 >= n2) then begin
+ longreal_bnge := True;
+ end else begin
+ longreal_bnge := False;
+ end;
+end;
+
+function longreal_blt(n1, n2: LongReal): Boolean;
+begin
+ if (n1 < n2) then begin
+ longreal_blt := True;
+ end else begin
+ longreal_blt := False;
+ end;
+end;
+
+function longreal_bnlt(n1, n2: LongReal): Boolean;
+begin
+ if not (n1 < n2) then begin
+ longreal_bnlt := True;
+ end else begin
+ longreal_bnlt := False;
+ end;
+end;
+
+function longreal_ble(n1, n2: LongReal): Boolean;
+begin
+ if (n1 <= n2) then begin
+ longreal_ble := True;
+ end else begin
+ longreal_ble := False;
+ end;
+end;
+
+function longreal_bnle(n1, n2: LongReal): Boolean;
+begin
+ if not (n1 <= n2) then begin
+ longreal_bnle := True;
+ end else begin
+ longreal_bnle := False;
+ end;
+end;
+
+procedure longreal_branch_tests;
+var
+ nnan :LongReal;
+begin
+ nnan := sqrt(LongReal(-1));
+
+ runcheck("cond_n_beq_nan_0.0", longreal_beq(nnan, 0.0), False);
+ runcheck("cond_n_beq_0.0_nan", longreal_beq(0.0, nnan), False);
+ runcheck("cond_n_beq_nan_nan", longreal_beq(nnan, nnan), False);
+ runcheck("cond_n_beq_1.0_0.0", longreal_beq(1.0, 0.0), False);
+ runcheck("cond_n_beq_0.0_0.0", longreal_beq(0.0, 0.0), True);
+ runcheck("cond_n_beq_0.0_1.0", longreal_beq(0.0, 1.0), False);
+ runcheck("cond_n_bneq_nan_0.0", longreal_bneq(nnan, 0.0), True);
+ runcheck("cond_n_bneq_0.0_nan", longreal_bneq(0.0, nnan), True);
+ runcheck("cond_n_bneq_nan_nan", longreal_bneq(nnan, nnan), True);
+ runcheck("cond_n_bneq_1.0_0.0", longreal_bneq(1.0, 0.0), True);
+ runcheck("cond_n_bneq_0.0_0.0", longreal_bneq(0.0, 0.0), False);
+ runcheck("cond_n_bneq_0.0_1.0", longreal_bneq(0.0, 1.0), True);
+
+ runcheck("cond_n_bne_nan_0.0", longreal_bne(nnan, 0.0), True);
+ runcheck("cond_n_bne_0.0_nan", longreal_bne(0.0, nnan), True);
+ runcheck("cond_n_bne_nan_nan", longreal_bne(nnan, nnan), True);
+ runcheck("cond_n_bne_1.0_0.0", longreal_bne(1.0, 0.0), True);
+ runcheck("cond_n_bne_0.0_0.0", longreal_bne(0.0, 0.0), False);
+ runcheck("cond_n_bne_0.0_1.0", longreal_bne(0.0, 1.0), True);
+ runcheck("cond_n_bnne_nan_0.0", longreal_bnne(nnan, 0.0), False);
+ runcheck("cond_n_bnne_0.0_nan", longreal_bnne(0.0, nnan), False);
+ runcheck("cond_n_bnne_nan_nan", longreal_bnne(nnan, nnan), False);
+ runcheck("cond_n_bnne_1.0_0.0", longreal_bnne(1.0, 0.0), False);
+ runcheck("cond_n_bnne_0.0_0.0", longreal_bnne(0.0, 0.0), True);
+ runcheck("cond_n_bnne_0.0_1.0", longreal_bnne(0.0, 1.0), False);
+
+ runcheck("cond_n_bgt_nan_0.0", longreal_bgt(nnan, 0.0), False);
+ runcheck("cond_n_bgt_0.0_nan", longreal_bgt(0.0, nnan), False);
+ runcheck("cond_n_bgt_nan_nan", longreal_bgt(nnan, nnan), False);
+ runcheck("cond_n_bgt_0.0_0.0", longreal_bgt(0.0, 0.0), False);
+ runcheck("cond_n_bgt_1.0_0.0", longreal_bgt(1.0, 0.0), True);
+ runcheck("cond_n_bgt_0.0_1.0", longreal_bgt(0.0, 1.0), False);
+ runcheck("cond_n_bngt_nan_0.0", longreal_bngt(nnan, 0.0), True);
+ runcheck("cond_n_bngt_0.0_nan", longreal_bngt(0.0, nnan), True);
+ runcheck("cond_n_bngt_nan_nan", longreal_bngt(nnan, nnan), True);
+ runcheck("cond_n_bngt_0.0_0.0", longreal_bngt(0.0, 0.0), True);
+ runcheck("cond_n_bngt_1.0_0.0", longreal_bngt(1.0, 0.0), False);
+ runcheck("cond_n_bngt_0.0_1.0", longreal_bngt(0.0, 1.0), True);
+
+ runcheck("cond_n_bge_nan_0.0", longreal_bge(nnan, 0.0), False);
+ runcheck("cond_n_bge_0.0_nan", longreal_bge(0.0, nnan), False);
+ runcheck("cond_n_bge_nan_nan", longreal_bge(nnan, nnan), False);
+ runcheck("cond_n_bge_0.0_0.0", longreal_bge(0.0, 0.0), True);
+ runcheck("cond_n_bge_1.0_0.0", longreal_bge(1.0, 0.0), True);
+ runcheck("cond_n_bge_0.0_1.0", longreal_bge(0.0, 1.0), False);
+ runcheck("cond_n_bnge_nan_0.0", longreal_bnge(nnan, 0.0), True);
+ runcheck("cond_n_bnge_0.0_nan", longreal_bnge(0.0, nnan), True);
+ runcheck("cond_n_bnge_nan_nan", longreal_bnge(nnan, nnan), True);
+ runcheck("cond_n_bnge_0.0_0.0", longreal_bnge(0.0, 0.0), False);
+ runcheck("cond_n_bnge_1.0_0.0", longreal_bnge(1.0, 0.0), False);
+ runcheck("cond_n_bnge_0.0_1.0", longreal_bnge(0.0, 1.0), True);
+
+ runcheck("cond_n_blt_nan_0.0", longreal_blt(nnan, 0.0), False);
+ runcheck("cond_n_blt_0.0_nan", longreal_blt(0.0, nnan), False);
+ runcheck("cond_n_blt_nan_nan", longreal_blt(nnan, nnan), False);
+ runcheck("cond_n_blt_0.0_0.0", longreal_blt(0.0, 0.0), False);
+ runcheck("cond_n_blt_1.0_0.0", longreal_blt(1.0, 0.0), False);
+ runcheck("cond_n_blt_0.0_1.0", longreal_blt(0.0, 1.0), True);
+ runcheck("cond_n_bnlt_nan_0.0", longreal_bnlt(nnan, 0.0), True);
+ runcheck("cond_n_bnlt_0.0_nan", longreal_bnlt(0.0, nnan), True);
+ runcheck("cond_n_bnlt_nan_nan", longreal_bnlt(nnan, nnan), True);
+ runcheck("cond_n_bnlt_0.0_0.0", longreal_bnlt(0.0, 0.0), True);
+ runcheck("cond_n_bnlt_1.0_0.0", longreal_bnlt(1.0, 0.0), True);
+ runcheck("cond_n_bnlt_0.0_1.0", longreal_bnlt(0.0, 1.0), False);
+
+ runcheck("cond_n_ble_nan_0.0", longreal_ble(nnan, 0.0), False);
+ runcheck("cond_n_ble_0.0_nan", longreal_ble(0.0, nnan), False);
+ runcheck("cond_n_ble_nan_nan", longreal_ble(nnan, nnan), False);
+ runcheck("cond_n_ble_0.0_0.0", longreal_ble(0.0, 0.0), True);
+ runcheck("cond_n_ble_1.0_0.0", longreal_ble(1.0, 0.0), False);
+ runcheck("cond_n_ble_0.0_1.0", longreal_ble(0.0, 1.0), True);
+ runcheck("cond_n_bnle_nan_0.0", longreal_bnle(nnan, 0.0), True);
+ runcheck("cond_n_bnle_0.0_nan", longreal_bnle(0.0, nnan), True);
+ runcheck("cond_n_bnle_nan_nan", longreal_bnle(nnan, nnan), True);
+ runcheck("cond_n_bnle_0.0_0.0", longreal_bnle(0.0, 0.0), False);
+ runcheck("cond_n_bnle_1.0_0.0", longreal_bnle(1.0, 0.0), True);
+ runcheck("cond_n_bnle_0.0_1.0", longreal_bnle(0.0, 1.0), False);
+end;
+
procedure run_tests;
begin
const_integer_tests;
@@ -845,8 +1424,11 @@
longint_tests;
longcard_tests;
shortreal_tests;
+ shortreal_branch_tests;
real_tests;
+ real_branch_tests;
longreal_tests;
+ longreal_branch_tests;
end;
begin
Index: jit/jit-rules-x86-64.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/libjit/jit/jit-rules-x86-64.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- jit/jit-rules-x86-64.c 24 May 2008 19:40:43 -0000 1.4
+++ jit/jit-rules-x86-64.c 19 Jul 2008 19:19:51 -0000 1.5
@@ -1335,6 +1335,145 @@
}
/*
+ * Compare two scalar float or double values and set dreg depending on the
+ * flags set.
+ * The result for nan values depends on nan_result.
+ * If nan_result is == 0 then the result is 0 if any nan value is involved,
+ * otherwise the result is true.
+ */
+static unsigned char *
+xmm_setcc(unsigned char *inst, int dreg, int cond, int sreg, int nan_result)
+{
+ x86_64_set_reg(inst, cond, dreg, 0);
+ if(nan_result)
+ {
+ /*
+ * Check pf only for comparisions where a flag is checked
+ * for 0 because an unordered result sets all flags.
+ * The cases where the additional check is not needed is
+ * eq, lt and le.
+ */
+ if((cond != 0) && (cond != 2) && (cond != 3))
+ {
+ x86_64_set_reg(inst, 8 /* p */ , sreg, 0);
+ x86_64_or_reg_reg_size(inst, dreg, sreg, 4);
+ }
+ }
+ else
+ {
+ /*
+ * Check pf only for comparisions where a flag is checked
+ * for 1 because an unordered result sets all flags.
+ * The cases where the additional check is not needed is
+ * ne, gt and ge.
+ */
+ if((cond != 1) && (cond != 4) && (cond != 5))
+ {
+ x86_64_set_reg(inst, 9 /* np */ , sreg, 0);
+ x86_64_and_reg_reg_size(inst, dreg, sreg, 4);
+ }
+ }
+ x86_64_movzx8_reg_reg_size(inst, dreg, dreg, 4);
+ return inst;
+}
+
+static unsigned char *
+xmm_cmp_setcc_reg_reg(unsigned char *inst, int dreg, int cond, int xreg1,
+ int xreg2, int sreg, int is_double, int nan_result)
+{
+ if(is_double)
+ {
+ x86_64_ucomisd_reg_reg(inst, xreg1, xreg2);
+ }
+ else
+ {
+ x86_64_ucomiss_reg_reg(inst, xreg1, xreg2);
+ }
+ return xmm_setcc(inst, dreg, cond, sreg, nan_result);
+}
+
+/*
+ * Compare two float values and branch depending on the flags.
+ */
+static unsigned char *
+xmm_brcc(jit_function_t func, unsigned char *inst, int cond, int nan_result,
+ jit_insn_t insn)
+{
+ if(nan_result)
+ {
+ /*
+ * Check pf only for comparisions where a flag is checked
+ * for 0 because an unordered result sets all flags.
+ * The cases where the additional check is not needed is
+ * eq, lt and le.
+ */
+ if((cond != 0) && (cond != 2) && (cond != 3))
+ {
+ /* Branch if the parity flag is set */
+ inst = output_branch(func, inst,
+ x86_cc_unsigned_map[8], insn);
+ }
+ inst = output_branch(func, inst, x86_cc_unsigned_map[cond],
insn);
+ }
+ else
+ {
+ /*
+ * Check pf only for comparisions where a flag is checked
+ * for 1 because an unordered result sets all flags.
+ * The cases where the additional check is not needed is
+ * ne, gt and ge.
+ */
+ if((cond != 1) && (cond != 4) && (cond != 5))
+ {
+ unsigned char *patch;
+ patch = inst;
+ x86_branch8(inst, X86_CC_P, 0, 0);
+ inst = output_branch(func, inst,
+ x86_cc_unsigned_map[cond], insn);
+ x86_patch(patch, inst);
+ }
+ else
+ {
+ inst = output_branch(func, inst,
+ x86_cc_unsigned_map[cond], insn);
+ }
+ }
+ return inst;
+}
+
+static unsigned char *
+xmm_cmp_brcc_reg_reg(jit_function_t func, unsigned char *inst, int cond,
+ int xreg1, int xreg2, int is_double, int nan_result,
+ jit_insn_t insn)
+{
+ if(is_double)
+ {
+ x86_64_ucomisd_reg_reg(inst, xreg1, xreg2);
+ }
+ else
+ {
+ x86_64_ucomiss_reg_reg(inst, xreg1, xreg2);
+ }
+ return xmm_brcc(func, inst, cond, nan_result, insn);
+}
+
+static unsigned char *
+xmm_cmp_brcc_reg_membase(jit_function_t func, unsigned char *inst, int cond,
+ int xreg1, int basereg, int offset, int is_double,
+ int nan_result, jit_insn_t insn)
+{
+ if(is_double)
+ {
+ x86_64_ucomisd_reg_membase(inst, xreg1, basereg, offset);
+ }
+ else
+ {
+ x86_64_ucomiss_reg_membase(inst, xreg1, basereg, offset);
+ }
+ return xmm_brcc(func, inst, cond, nan_result, insn);
+}
+
+/*
* Support functiond for the FPU stack
*/
Index: jit/jit-rules-x86-64.ins
===================================================================
RCS file: /cvsroot/dotgnu-pnet/libjit/jit/jit-rules-x86-64.ins,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- jit/jit-rules-x86-64.ins 6 Jul 2008 14:00:42 -0000 1.7
+++ jit/jit-rules-x86-64.ins 19 Jul 2008 19:19:51 -0000 1.8
@@ -2046,124 +2046,164 @@
inst = output_branch(func, inst, 0x73 /* ge_un */, insn);
}
-JIT_OP_BR_FEQ: branch, commutative
+JIT_OP_BR_FEQ, JIT_OP_BR_FEQ_INV: branch, commutative
[xreg, local] -> {
- x86_64_comiss_reg_membase(inst, $1, X86_64_RBP, $2);
- inst = output_branch(func, inst, 0x74 /* eq */, insn);
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_Z, $1,
X86_64_RBP, $2, 0, 0, insn);
}
[xreg, xreg] -> {
- x86_64_comiss_reg_reg(inst, $1, $2);
- inst = output_branch(func, inst, 0x74 /* eq */, insn);
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_Z, $1, $2, 0, 0,
insn);
}
-JIT_OP_BR_FNE: branch, commutative
+JIT_OP_BR_FNE, JIT_OP_BR_FNE_INV: branch, commutative
[xreg, local] -> {
- x86_64_comiss_reg_membase(inst, $1, X86_64_RBP, $2);
- inst = output_branch(func, inst, 0x75 /* ne */, insn);
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_NZ, $1,
X86_64_RBP, $2, 0, 1, insn);
}
- [xreg, xreg] -> {
- x86_64_comiss_reg_reg(inst, $1, $2);
- inst = output_branch(func, inst, 0x75 /* ne */, insn);
+ [xreg, xreg, space("20")] -> {
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_NZ, $1, $2, 0,
1, insn);
}
JIT_OP_BR_FLT: branch
[xreg, local] -> {
- x86_64_comiss_reg_membase(inst, $1, X86_64_RBP, $2);
- inst = output_branch(func, inst, 0x72 /* lt_un */, insn);
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_C, $1,
X86_64_RBP, $2, 0, 0, insn);
+ }
+ [xreg, xreg] -> {
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_C, $1, $2, 0, 0,
insn);
+ }
+
+JIT_OP_BR_FLT_INV: branch
+ [xreg, local] -> {
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_C, $1,
X86_64_RBP, $2, 0, 1, insn);
}
[xreg, xreg] -> {
- x86_64_comiss_reg_reg(inst, $1, $2);
- inst = output_branch(func, inst, 0x72 /* lt_un */, insn);
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_C, $1, $2, 0, 1,
insn);
}
JIT_OP_BR_FLE: branch
[xreg, local] -> {
- x86_64_comiss_reg_membase(inst, $1, X86_64_RBP, $2);
- inst = output_branch(func, inst, 0x76 /* le_un */, insn);
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_BE, $1,
X86_64_RBP, $2, 0, 0, insn);
}
[xreg, xreg] -> {
- x86_64_comiss_reg_reg(inst, $1, $2);
- inst = output_branch(func, inst, 0x76 /* le_un */, insn);
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_BE, $1, $2, 0,
0, insn);
+ }
+
+JIT_OP_BR_FLE_INV: branch
+ [xreg, local] -> {
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_BE, $1,
X86_64_RBP, $2, 0, 1, insn);
+ }
+ [xreg, xreg] -> {
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_BE, $1, $2, 0,
1, insn);
}
JIT_OP_BR_FGT: branch
[xreg, local] -> {
- x86_64_comiss_reg_membase(inst, $1, X86_64_RBP, $2);
- inst = output_branch(func, inst, 0x77 /* gt_un */, insn);
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_NBE, $1,
X86_64_RBP, $2, 0, 0, insn);
+ }
+ [xreg, xreg] -> {
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_NBE, $1, $2, 0,
0, insn);
+ }
+
+JIT_OP_BR_FGT_INV: branch
+ [xreg, local] -> {
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_NBE, $1,
X86_64_RBP, $2, 0, 1, insn);
}
[xreg, xreg] -> {
- x86_64_comiss_reg_reg(inst, $1, $2);
- inst = output_branch(func, inst, 0x77 /* gt_un */, insn);
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_NBE, $1, $2, 0,
1, insn);
}
JIT_OP_BR_FGE: branch
[xreg, local] -> {
- x86_64_comiss_reg_membase(inst, $1, X86_64_RBP, $2);
- inst = output_branch(func, inst, 0x73 /* ge_un */, insn);
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_NC, $1,
X86_64_RBP, $2, 0, 0, insn);
}
[xreg, xreg] -> {
- x86_64_comiss_reg_reg(inst, $1, $2);
- inst = output_branch(func, inst, 0x73 /* ge_un */, insn);
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_NC, $1, $2, 0,
0, insn);
}
-JIT_OP_BR_DEQ: branch, commutative
+JIT_OP_BR_FGE_INV: branch
[xreg, local] -> {
- x86_64_comisd_reg_membase(inst, $1, X86_64_RBP, $2);
- inst = output_branch(func, inst, 0x74 /* eq */, insn);
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_NC, $1,
X86_64_RBP, $2, 0, 1, insn);
}
[xreg, xreg] -> {
- x86_64_comisd_reg_reg(inst, $1, $2);
- inst = output_branch(func, inst, 0x74 /* eq */, insn);
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_NC, $1, $2, 0,
1, insn);
}
-JIT_OP_BR_DNE: branch, commutative
+JIT_OP_BR_DEQ, JIT_OP_BR_DEQ_INV: branch, commutative
[xreg, local] -> {
- x86_64_comisd_reg_membase(inst, $1, X86_64_RBP, $2);
- inst = output_branch(func, inst, 0x75 /* ne */, insn);
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_Z, $1,
X86_64_RBP, $2, 1, 0, insn);
}
[xreg, xreg] -> {
- x86_64_comisd_reg_reg(inst, $1, $2);
- inst = output_branch(func, inst, 0x75 /* ne */, insn);
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_Z, $1, $2, 1, 0,
insn);
+ }
+
+JIT_OP_BR_DNE, JIT_OP_BR_DNE_INV: branch, commutative
+ [xreg, local] -> {
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_NZ, $1,
X86_64_RBP, $2, 1, 1, insn);
+ }
+ [xreg, xreg, space("20")] -> {
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_NZ, $1, $2, 1,
1, insn);
}
JIT_OP_BR_DLT: branch
[xreg, local] -> {
- x86_64_comisd_reg_membase(inst, $1, X86_64_RBP, $2);
- inst = output_branch(func, inst, 0x72 /* lt_un */, insn);
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_C, $1,
X86_64_RBP, $2, 1, 0, insn);
}
[xreg, xreg] -> {
- x86_64_comisd_reg_reg(inst, $1, $2);
- inst = output_branch(func, inst, 0x72 /* lt_un */, insn);
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_C, $1, $2, 1, 0,
insn);
+ }
+
+JIT_OP_BR_DLT_INV: branch
+ [xreg, local] -> {
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_C, $1,
X86_64_RBP, $2, 1, 1, insn);
+ }
+ [xreg, xreg] -> {
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_C, $1, $2, 1, 1,
insn);
}
JIT_OP_BR_DLE: branch
[xreg, local] -> {
- x86_64_comisd_reg_membase(inst, $1, X86_64_RBP, $2);
- inst = output_branch(func, inst, 0x76 /* le_un */, insn);
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_BE, $1,
X86_64_RBP, $2, 1, 0, insn);
+ }
+ [xreg, xreg] -> {
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_BE, $1, $2, 1,
0, insn);
+ }
+
+JIT_OP_BR_DLE_INV: branch
+ [xreg, local] -> {
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_BE, $1,
X86_64_RBP, $2, 1, 1, insn);
}
[xreg, xreg] -> {
- x86_64_comisd_reg_reg(inst, $1, $2);
- inst = output_branch(func, inst, 0x76 /* le_un */, insn);
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_BE, $1, $2, 1,
1, insn);
}
JIT_OP_BR_DGT: branch
[xreg, local] -> {
- x86_64_comisd_reg_membase(inst, $1, X86_64_RBP, $2);
- inst = output_branch(func, inst, 0x77 /* gt_un */, insn);
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_NBE, $1,
X86_64_RBP, $2, 1, 0, insn);
}
[xreg, xreg] -> {
- x86_64_comisd_reg_reg(inst, $1, $2);
- inst = output_branch(func, inst, 0x77 /* gt_un */, insn);
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_NBE, $1, $2, 1,
0, insn);
+ }
+
+JIT_OP_BR_DGT_INV: branch
+ [xreg, local] -> {
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_NBE, $1,
X86_64_RBP, $2, 1, 1, insn);
+ }
+ [xreg, xreg] -> {
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_NBE, $1, $2, 1,
1, insn);
}
JIT_OP_BR_DGE: branch
[xreg, local] -> {
- x86_64_comisd_reg_membase(inst, $1, X86_64_RBP, $2);
- inst = output_branch(func, inst, 0x73 /* ge_un */, insn);
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_NC, $1,
X86_64_RBP, $2, 1, 0, insn);
}
[xreg, xreg] -> {
- x86_64_comisd_reg_reg(inst, $1, $2);
- inst = output_branch(func, inst, 0x73 /* ge_un */, insn);
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_NC, $1, $2, 1,
0, insn);
+ }
+
+JIT_OP_BR_DGE_INV: branch
+ [xreg, local] -> {
+ inst = xmm_cmp_brcc_reg_membase(func, inst, X86_CC_NC, $1,
X86_64_RBP, $2, 1, 1, insn);
+ }
+ [xreg, xreg] -> {
+ inst = xmm_cmp_brcc_reg_reg(func, inst, X86_CC_NC, $1, $2, 1,
1, insn);
}
/*
@@ -2466,76 +2506,104 @@
inst = setcc_reg(inst, $1, X86_CC_GE, 0);
}
-JIT_OP_FEQ: commutative
- [=reg, xreg, xreg] -> {
- x86_64_comiss_reg_reg(inst, $2, $3);
- inst = setcc_reg(inst, $1, X86_CC_EQ, 0);
+JIT_OP_FEQ, JIT_OP_FEQ_INV: commutative
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_Z, $2, $3, $4, 0,
0);
}
-JIT_OP_FNE: commutative
- [=reg, xreg, xreg] -> {
- x86_64_comiss_reg_reg(inst, $2, $3);
- inst = setcc_reg(inst, $1, X86_CC_NE, 0);
+JIT_OP_FNE, JIT_OP_FNE_INV: commutative
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_NZ, $2, $3, $4,
0, 1);
}
JIT_OP_FLT:
- [=reg, xreg, xreg] -> {
- x86_64_comiss_reg_reg(inst, $2, $3);
- inst = setcc_reg(inst, $1, X86_CC_B, 0);
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_C, $2, $3, $4, 0,
0);
+ }
+
+JIT_OP_FLT_INV:
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_C, $2, $3, $4, 0,
1);
}
JIT_OP_FLE:
- [=reg, xreg, xreg] -> {
- x86_64_comiss_reg_reg(inst, $2, $3);
- inst = setcc_reg(inst, $1, X86_CC_BE, 0);
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_BE, $2, $3, $4,
0, 0);
+ }
+
+JIT_OP_FLE_INV:
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_BE, $2, $3, $4,
0, 1);
}
JIT_OP_FGT:
- [=reg, xreg, xreg] -> {
- x86_64_comiss_reg_reg(inst, $2, $3);
- inst = setcc_reg(inst, $1, X86_CC_A, 0);
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_NBE, $2, $3, $4,
0, 0);
+ }
+
+JIT_OP_FGT_INV:
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_NBE, $2, $3, $4,
0, 1);
}
JIT_OP_FGE:
- [=reg, xreg, xreg] -> {
- x86_64_comiss_reg_reg(inst, $2, $3);
- inst = setcc_reg(inst, $1, X86_CC_AE, 0);
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_NC, $2, $3, $4,
0, 0);
}
-JIT_OP_DEQ: commutative
- [=reg, xreg, xreg] -> {
- x86_64_comisd_reg_reg(inst, $2, $3);
- inst = setcc_reg(inst, $1, X86_CC_EQ, 0);
+JIT_OP_FGE_INV:
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_NC, $2, $3, $4,
0, 1);
}
-JIT_OP_DNE: commutative
- [=reg, xreg, xreg] -> {
- x86_64_comisd_reg_reg(inst, $2, $3);
- inst = setcc_reg(inst, $1, X86_CC_NE, 0);
+JIT_OP_DEQ, JIT_OP_DEQ_INV: commutative
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_Z, $2, $3, $4, 1,
0);
+ }
+
+JIT_OP_DNE, JIT_OP_DNE_INV: commutative
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_NZ, $2, $3, $4,
1, 1);
}
JIT_OP_DLT:
- [=reg, xreg, xreg] -> {
- x86_64_comisd_reg_reg(inst, $2, $3);
- inst = setcc_reg(inst, $1, X86_CC_B, 0);
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_C, $2, $3, $4, 1,
0);
+ }
+
+JIT_OP_DLT_INV:
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_C, $2, $3, $4, 1,
1);
}
JIT_OP_DLE:
- [=reg, xreg, xreg] -> {
- x86_64_comisd_reg_reg(inst, $2, $3);
- inst = setcc_reg(inst, $1, X86_CC_BE, 0);
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_BE, $2, $3, $4,
1, 0);
+ }
+
+JIT_OP_DLE_INV:
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_BE, $2, $3, $4,
1, 1);
}
JIT_OP_DGT:
- [=reg, xreg, xreg] -> {
- x86_64_comisd_reg_reg(inst, $2, $3);
- inst = setcc_reg(inst, $1, X86_CC_A, 0);
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_NBE, $2, $3, $4,
1, 0);
+ }
+
+JIT_OP_DGT_INV:
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_NBE, $2, $3, $4,
1, 1);
}
JIT_OP_DGE:
- [=reg, xreg, xreg] -> {
- x86_64_comisd_reg_reg(inst, $2, $3);
- inst = setcc_reg(inst, $1, X86_CC_AE, 0);
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_NC, $2, $3, $4,
1, 0);
+ }
+
+JIT_OP_DGE_INV:
+ [=+reg, xreg, xreg, scratch reg, space("20")] -> {
+ inst = xmm_cmp_setcc_reg_reg(inst, $1, X86_CC_NC, $2, $3, $4,
1, 1);
}
JIT_OP_FSQRT:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] libjit ChangeLog tests/cond.pas jit/jit-rules-x...,
Klaus Treichel <=