return emit_TAGGEDP (obj, Lisp_Cons);
}
+static gcc_jit_rvalue *
+emit_FLOATP (gcc_jit_rvalue *obj)
+{
+ return emit_TAGGEDP (obj, Lisp_Float);
+}
+
static gcc_jit_rvalue *
emit_BIGNUMP (gcc_jit_rvalue *obj)
{
emit_BIGNUMP (obj));
}
+static gcc_jit_rvalue *
+emit_NUMBERP (gcc_jit_rvalue *obj)
+{
+ return gcc_jit_context_new_binary_op (comp.ctxt,
+ NULL,
+ GCC_JIT_BINARY_OP_LOGICAL_OR,
+ comp.bool_type,
+ emit_INTEGERP(obj),
+ emit_cast (comp.bool_type,
+ emit_FLOATP (obj)));
+}
+
static gcc_jit_rvalue *
emit_make_fixnum (gcc_jit_block *block, gcc_jit_rvalue *obj)
{
CASE_CALL_NARGS (rem, 2);
case Bnumberp:
- error ("Bnumberp not supported");
+ POP1;
+ res = emit_NUMBERP (args[0]);
+ res = gcc_jit_context_new_call (comp.ctxt,
+ NULL,
+ comp.bool_to_lisp_obj,
+ 1, &res);
+ PUSH_RVAL (res);
break;
case Bintegerp:
(defun comp-tests-integerp-f (x)
;; Bintegerp
(integerp x))
+ (defun comp-tests-numberp-f (x)
+ ;; Bnumberp
+ (numberp x))
(byte-compile #'comp-tests-integerp-f)
(native-compile #'comp-tests-integerp-f)
+ (byte-compile #'comp-tests-numberp-f)
+ (native-compile #'comp-tests-numberp-f)
(should (eq (comp-tests-integerp-f 1) t))
(should (eq (comp-tests-integerp-f '(1)) nil))
(should (eq (comp-tests-integerp-f 3.5) nil))
- (should (eq (comp-tests-integerp-f (1+ most-negative-fixnum)) t)))
+ (should (eq (comp-tests-integerp-f (1+ most-negative-fixnum)) t))
+
+ (should (eq (comp-tests-numberp-f 1) t))
+ (should (eq (comp-tests-numberp-f 'a) nil))
+ (should (eq (comp-tests-numberp-f 3.5) t)))
(ert-deftest comp-tests-gc ()
"Try to do some longer computation to let the gc kick in."