Skip to content

Commit eaf3f23

Browse files
committed
Add constant narrowing for float EQ, NE
1 parent 7a03b22 commit eaf3f23

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

Python/optimizer_analysis.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ add_op(JitOptContext *ctx, _PyUOpInstruction *this_instr,
250250
#define sym_new_predicate _Py_uop_sym_new_predicate
251251
#define sym_apply_predicate_narrowing _Py_uop_sym_apply_predicate_narrowing
252252

253+
/* Comparison oparg masks */
254+
#define COMPARE_LT_MASK 2
255+
#define COMPARE_GT_MASK 4
256+
#define COMPARE_EQ_MASK 8
257+
253258
#define JUMP_TO_LABEL(label) goto label;
254259

255260
static int

Python/optimizer_cases.c.h

Lines changed: 10 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/optimizer_symbols.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,7 @@ _Py_uop_symbols_test(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored))
13161316
_Py_uop_sym_apply_predicate_narrowing(ctx, ref, true);
13171317
TEST_PREDICATE(_Py_uop_sym_is_const(ctx, subject), "predicate narrowing did not const-narrow subject (1)");
13181318
TEST_PREDICATE(_Py_uop_sym_get_const(ctx, subject) == one_obj, "predicate narrowing did not narrow subject to 1");
1319-
1319+
13201320
// Test narrowing subject to constant from EQ predicate for int
13211321
subject = _Py_uop_sym_new_unknown(ctx);
13221322
if (PyJitRef_IsNull(subject)) {

0 commit comments

Comments
 (0)