summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Wawrzyniak <anna.wawrzyniak@mongodb.com>2022-11-29 07:50:14 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-11-29 08:26:45 +0000
commit638bdd33bf1514517fa8d495ed7d73d54f060550 (patch)
treee627323472294fd984660ec8b511c601601e24d2
parent7f0f03628ca7cc3e3a0fc931fbefb4e62817e461 (diff)
downloadmongo-638bdd33bf1514517fa8d495ed7d73d54f060550.tar.gz
SERVER-71344 Added EExpression unit test coverage
-rw-r--r--src/mongo/db/exec/sbe/SConscript5
-rw-r--r--src/mongo/db/exec/sbe/expression_test_base.h90
-rw-r--r--src/mongo/db/exec/sbe/expressions/expression.cpp5
-rw-r--r--src/mongo/db/exec/sbe/expressions/sbe_constant_test.cpp81
-rw-r--r--src/mongo/db/exec/sbe/expressions/sbe_fail_test.cpp81
-rw-r--r--src/mongo/db/exec/sbe/expressions/sbe_if_test.cpp259
-rw-r--r--src/mongo/db/exec/sbe/expressions/sbe_lambda_test.cpp36
-rw-r--r--src/mongo/db/exec/sbe/expressions/sbe_local_bind_test.cpp36
-rw-r--r--src/mongo/db/exec/sbe/expressions/sbe_prim_binary_test.cpp359
-rw-r--r--src/mongo/db/exec/sbe/expressions/sbe_prim_unary_test.cpp99
-rw-r--r--src/mongo/db/exec/sbe/expressions/sbe_variable_test.cpp92
-rw-r--r--src/mongo/db/exec/sbe/sbe_numeric_convert_test.cpp13
-rw-r--r--src/mongo/db/exec/sbe/util/print_options.h15
-rw-r--r--src/mongo/db/exec/sbe/values/value_printer.cpp73
-rw-r--r--src/mongo/db/exec/sbe/values/value_printer.h2
-rw-r--r--src/mongo/db/exec/sbe/vm/vm.cpp218
-rw-r--r--src/mongo/db/exec/sbe/vm/vm.h2
-rw-r--r--src/mongo/db/exec/sbe/vm/vm_printer.cpp15
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_constant_test/sbe_constants.txt129
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_fail_test/fail_with_add_decimal.txt16
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_fail_test/fail_with_local_bind.txt22
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_fail_test/simple_fail.txt14
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_if_test/if_with_fill_empty.txt58
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_if_test/if_with_logic_and.txt59
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_if_test/if_with_logic_not.txt31
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_if_test/if_with_logic_or.txt59
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_if_test/nested_if_cond.txt39
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_if_test/nested_if_else.txt62
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_if_test/nested_if_then.txt63
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_if_test/simple_if.txt30
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_lambda_test/traverse_f_op_eq.txt19
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_lambda_test/traverse_f_with_local_bind.txt43
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_lambda_test/traverse_p_add_one_to_array.txt19
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_local_bind_test/nested_bind1.txt29
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_local_bind_test/nested_bind2.txt36
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_local_bind_test/one_variable.txt20
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_local_bind_test/two_variables.txt24
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_numeric_test/compile.txt10
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_numeric_test/compile_only.txt10
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/add_mixed.txt267
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/add_numeric.txt155
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/cmp3w_mixed.txt267
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/cmp3w_numeric.txt155
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/cmp3w_string.txt312
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/div_mixed.txt267
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/div_numeric.txt155
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/eq_mixed.txt267
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/eq_numeric.txt155
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/eq_string.txt312
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/fill_empty.txt77
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/fill_empty_with_constant.txt108
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_eq_mixed.txt267
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_eq_numeric.txt155
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_eq_string.txt312
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_mixed.txt267
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_numeric.txt155
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_string.txt312
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_eq_mixed.txt267
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_eq_numeric.txt155
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_eq_string.txt312
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_mixed.txt267
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_numeric.txt155
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_string.txt312
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/mul_mixed.txt267
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/mul_numeric.txt155
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/neq_mixed.txt267
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/neq_numeric.txt155
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/neq_string.txt312
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/sub_mixed.txt267
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/sub_numeric.txt155
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_unary_test/logic_not_bool.txt22
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_unary_test/logic_not_mixed.txt42
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_unary_test/negate_mixed.txt42
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_prim_unary_test/negate_numeric.txt38
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_variable_test/local_variable.txt22
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_variable_test/local_variable_move.txt22
-rw-r--r--src/mongo/db/test_output/exec/sbe/s_b_e_variable_test/slot_variable.txt21
77 files changed, 9385 insertions, 108 deletions
diff --git a/src/mongo/db/exec/sbe/SConscript b/src/mongo/db/exec/sbe/SConscript
index bf2d6170cf1..9be25c996cd 100644
--- a/src/mongo/db/exec/sbe/SConscript
+++ b/src/mongo/db/exec/sbe/SConscript
@@ -169,13 +169,16 @@ env.CppUnitTest(
'expressions/sbe_bson_size_test.cpp',
'expressions/sbe_coerce_to_string_test.cpp',
'expressions/sbe_concat_test.cpp',
+ 'expressions/sbe_constant_test.cpp',
'expressions/sbe_date_add_test.cpp',
'expressions/sbe_date_diff_test.cpp',
'expressions/sbe_date_to_parts_test.cpp',
'expressions/sbe_date_trunc_test.cpp',
'expressions/sbe_day_of_expressions_test.cpp',
'expressions/sbe_extract_sub_array_builtin_test.cpp',
+ 'expressions/sbe_fail_test.cpp',
'expressions/sbe_get_element_builtin_test.cpp',
+ 'expressions/sbe_if_test.cpp',
'expressions/sbe_index_of_test.cpp',
'expressions/sbe_is_array_empty_builtin_test.cpp',
'expressions/sbe_is_member_builtin_test.cpp',
@@ -186,6 +189,7 @@ env.CppUnitTest(
'expressions/sbe_mod_expression_test.cpp',
'expressions/sbe_new_array_from_range_builtin_test.cpp',
'expressions/sbe_prim_binary_test.cpp',
+ 'expressions/sbe_prim_unary_test.cpp',
'expressions/sbe_regex_test.cpp',
'expressions/sbe_replace_one_expression_test.cpp',
'expressions/sbe_reverse_array_builtin_test.cpp',
@@ -196,6 +200,7 @@ env.CppUnitTest(
'expressions/sbe_trigonometric_expressions_test.cpp',
'expressions/sbe_trunc_builtin_test.cpp',
'expressions/sbe_ts_second_ts_increment_test.cpp',
+ 'expressions/sbe_variable_test.cpp',
'sbe_column_scan_test.cpp',
'sbe_filter_test.cpp',
'sbe_hash_agg_test.cpp',
diff --git a/src/mongo/db/exec/sbe/expression_test_base.h b/src/mongo/db/exec/sbe/expression_test_base.h
index e3565016243..59c64a8d67f 100644
--- a/src/mongo/db/exec/sbe/expression_test_base.h
+++ b/src/mongo/db/exec/sbe/expression_test_base.h
@@ -34,6 +34,8 @@
#include "mongo/db/exec/sbe/sbe_unittest.h"
#include "mongo/db/exec/sbe/stages/co_scan.h"
#include "mongo/db/exec/sbe/values/slot.h"
+#include "mongo/db/exec/sbe/values/value.h"
+#include "mongo/db/exec/sbe/values/value_printer.h"
#include "mongo/db/exec/sbe/vm/vm.h"
#include "mongo/db/exec/sbe/vm/vm_printer.h"
#include "mongo/unittest/golden_test.h"
@@ -125,6 +127,8 @@ protected:
}
void executeAndPrintVariation(std::ostream& os, const vm::CodeFragment& code) {
+ auto valuePrinter = makeValuePrinter(os);
+
os << "-- EXECUTE VARIATION:" << std::endl;
if (!boundAccessors.empty()) {
bool first = true;
@@ -135,14 +139,24 @@ protected:
} else {
first = false;
}
- os << p.first << ": " << p.second->getViewOfValue();
+ os << p.first << ": ";
+
+ auto [tag, val] = p.second->getViewOfValue();
+ valuePrinter.writeValueToStream(tag, val);
}
os << "]" << std::endl;
+ }
+ try {
auto [owned, tag, val] = _vm.run(&code);
value::ValueGuard guard(owned, tag, val);
- os << "RESULT: " << std::make_pair(tag, val) << std::endl << std::endl;
+ os << "RESULT: ";
+ valuePrinter.writeValueToStream(tag, val);
+ os << std::endl;
+ } catch (const DBException& e) {
+ os << "EXCEPTION: " << e.toString() << std::endl;
}
+ os << std::endl;
}
void runAndAssertNothing(const vm::CodeFragment* compiledExpression) {
@@ -156,6 +170,12 @@ protected:
value::bitcastFrom<const char*>(ba.objdata()));
}
+
+ static std::pair<value::TypeTags, value::Value> makeBsonObject(const BSONObj& bo) {
+ return value::copyValue(value::TypeTags::bsonObject,
+ value::bitcastFrom<const char*>(bo.objdata()));
+ }
+
static std::pair<value::TypeTags, value::Value> makeArraySet(const BSONArray& arr) {
auto [tmpTag, tmpVal] = makeBsonArray(arr);
value::ValueGuard tmpGuard{tmpTag, tmpVal};
@@ -202,10 +222,36 @@ protected:
return {arrTag, arrVal};
}
+ static std::pair<value::TypeTags, value::Value> makeObject(const BSONObj& obj) {
+ auto [tmpTag, tmpVal] = makeBsonObject(obj);
+ value::ValueGuard tmpGuard{tmpTag, tmpVal};
+
+ value::ObjectEnumerator enumerator{tmpTag, tmpVal};
+
+ auto [objTag, objVal] = value::makeNewObject();
+ value::ValueGuard guard{objTag, objVal};
+
+ auto objView = value::getObjectView(objVal);
+
+ while (!enumerator.atEnd()) {
+ auto [tag, val] = enumerator.getViewOfValue();
+ auto [copyTag, copyVal] = value::copyValue(tag, val);
+ objView->push_back(enumerator.getFieldName(), copyTag, copyVal);
+ enumerator.advance();
+ }
+ guard.reset();
+
+ return {objTag, objVal};
+ }
+
static std::pair<value::TypeTags, value::Value> makeNothing() {
return {value::TypeTags::Nothing, value::bitcastFrom<int64_t>(0)};
}
+ static std::pair<value::TypeTags, value::Value> makeNull() {
+ return {value::TypeTags::Null, value::bitcastFrom<int64_t>(0)};
+ }
+
static std::pair<value::TypeTags, value::Value> makeInt32(int32_t value) {
return {value::TypeTags::NumberInt32, value::bitcastFrom<int32_t>(value)};
}
@@ -234,6 +280,12 @@ protected:
return makeC(p.first, p.second);
}
+ template <typename Stream>
+ value::ValuePrinter<Stream> makeValuePrinter(Stream& stream) {
+ return value::ValuePrinters::make(
+ stream, PrintOptions().useTagForAmbiguousValues(true).normalizeOutput(true));
+ }
+
private:
value::SlotIdGenerator _slotIdGenerator;
CoScanStage _emptyStage{kEmptyPlanNodeId};
@@ -242,4 +294,38 @@ private:
std::vector<std::pair<value::SlotId, value::SlotAccessor*>> boundAccessors;
};
+
+class GoldenEExpressionTestFixture : public EExpressionTestFixture {
+public:
+ GoldenEExpressionTestFixture() {}
+
+ void run() {
+ GoldenTestContext ctx(&goldenTestConfigSbe);
+ auto guard = ScopeGuard([&] { gctx = nullptr; });
+ gctx = &ctx;
+ gctx->printTestHeader(GoldenTestContext::HeaderFormat::Text);
+ Test::run();
+ }
+
+protected:
+ GoldenTestContext* gctx;
+};
+
+class ValueVectorGuard {
+ ValueVectorGuard() = delete;
+ ValueVectorGuard& operator=(const ValueVectorGuard&) = delete;
+
+public:
+ ValueVectorGuard(std::vector<TypedValue>& values) : _values(values) {}
+
+ ~ValueVectorGuard() {
+ for (auto p : _values) {
+ value::releaseValue(p.first, p.second);
+ }
+ }
+
+private:
+ std::vector<TypedValue>& _values;
+};
+
} // namespace mongo::sbe
diff --git a/src/mongo/db/exec/sbe/expressions/expression.cpp b/src/mongo/db/exec/sbe/expressions/expression.cpp
index 071f74f33a8..0ddf262dd76 100644
--- a/src/mongo/db/exec/sbe/expressions/expression.cpp
+++ b/src/mongo/db/exec/sbe/expressions/expression.cpp
@@ -40,6 +40,7 @@
#include "mongo/db/exec/sbe/stages/spool.h"
#include "mongo/db/exec/sbe/stages/stages.h"
#include "mongo/db/exec/sbe/values/arith_common.h"
+#include "mongo/db/exec/sbe/values/value_printer.h"
#include "mongo/db/exec/sbe/vm/datetime.h"
#include "mongo/util/str.h"
@@ -120,7 +121,9 @@ vm::CodeFragment EConstant::compileDirect(CompileCtx& ctx) const {
std::vector<DebugPrinter::Block> EConstant::debugPrint() const {
std::vector<DebugPrinter::Block> ret;
std::stringstream ss;
- ss << std::make_pair(_tag, _val);
+ value::ValuePrinters::make(ss,
+ PrintOptions().useTagForAmbiguousValues(true).normalizeOutput(true))
+ .writeValueToStream(_tag, _val);
ret.emplace_back(ss.str());
diff --git a/src/mongo/db/exec/sbe/expressions/sbe_constant_test.cpp b/src/mongo/db/exec/sbe/expressions/sbe_constant_test.cpp
new file mode 100644
index 00000000000..cf4059456b5
--- /dev/null
+++ b/src/mongo/db/exec/sbe/expressions/sbe_constant_test.cpp
@@ -0,0 +1,81 @@
+/**
+ * Copyright (C) 2022-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/db/exec/sbe/expression_test_base.h"
+#include "mongo/db/exec/sbe/values/bson.h"
+
+namespace mongo::sbe {
+
+class SBEConstantTest : public GoldenEExpressionTestFixture {
+public:
+ // Takes ownership of the value.
+ void verifyConstantExpression(std::ostream& os, std::pair<value::TypeTags, value::Value> p) {
+ verifyConstantExpression(os, p.first, p.second);
+ }
+
+ // Takes ownership of the value.
+ void verifyConstantExpression(std::ostream& os, value::TypeTags tag, value::Value val) {
+ auto expr = sbe::makeE<EConstant>(tag, val);
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ auto [tagActual, valActual] = runCompiledExpression(compiledExpr.get());
+ value::ValueGuard guard(tagActual, valActual);
+
+ ASSERT_THAT(std::make_pair(tagActual, valActual), ValueEq(std::make_pair(tag, val)));
+ }
+};
+
+TEST_F(SBEConstantTest, SbeConstants) {
+ auto& os = gctx->outStream();
+
+ verifyConstantExpression(os, value::TypeTags::Nothing, 0);
+ verifyConstantExpression(os, value::TypeTags::Null, 0);
+ verifyConstantExpression(os, value::TypeTags::Boolean, value::bitcastFrom<bool>(true));
+ verifyConstantExpression(os, value::TypeTags::NumberInt32, value::bitcastFrom<int32_t>(123));
+ verifyConstantExpression(os, value::TypeTags::NumberInt64, value::bitcastFrom<int64_t>(123));
+ verifyConstantExpression(os, value::TypeTags::NumberDouble, value::bitcastFrom<double>(123.0));
+ verifyConstantExpression(os, value::TypeTags::MinKey, 0);
+ verifyConstantExpression(os, value::TypeTags::MaxKey, 0);
+
+ verifyConstantExpression(os, value::makeCopyDecimal(Decimal128(123.0)));
+ verifyConstantExpression(os, value::makeSmallString("abc"_sd));
+ verifyConstantExpression(os, value::makeBigString("abcdefghijklmnop"_sd));
+ verifyConstantExpression(os, value::makeNewRecordId(123));
+ verifyConstantExpression(
+ os, value::makeCopyObjectId(std::array<uint8_t, 12>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}));
+
+ verifyConstantExpression(os, makeArray(BSON_ARRAY(1 << 2 << 3)));
+ verifyConstantExpression(os, makeArraySet(BSON_ARRAY(2 << 1 << 3)));
+ verifyConstantExpression(os, makeObject(BSON("a"_sd << 1 << "b"_sd << 2)));
+}
+
+} // namespace mongo::sbe
diff --git a/src/mongo/db/exec/sbe/expressions/sbe_fail_test.cpp b/src/mongo/db/exec/sbe/expressions/sbe_fail_test.cpp
new file mode 100644
index 00000000000..095db37f72d
--- /dev/null
+++ b/src/mongo/db/exec/sbe/expressions/sbe_fail_test.cpp
@@ -0,0 +1,81 @@
+/**
+ * Copyright (C) 2022-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/db/exec/sbe/expression_test_base.h"
+
+namespace mongo::sbe {
+
+using SBEFailTest = GoldenEExpressionTestFixture;
+
+TEST_F(SBEFailTest, SimpleFail) {
+ auto& os = gctx->outStream();
+
+ auto expr = sbe::makeE<EFail>(ErrorCodes::Error::BadValue, "test"_sd);
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ executeAndPrintVariation(os, *compiledExpr);
+}
+
+TEST_F(SBEFailTest, FailWithAddDecimal) {
+ auto& os = gctx->outStream();
+
+ value::ViewOfValueAccessor condAccessor;
+
+ auto expr = sbe::makeE<EPrimBinary>(EPrimBinary::Op::add,
+ makeC(value::makeCopyDecimal(Decimal128(123))),
+ sbe::makeE<EFail>(ErrorCodes::Error::BadValue, "test"_sd));
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ executeAndPrintVariation(os, *compiledExpr);
+}
+
+TEST_F(SBEFailTest, FailWithLocalBind) {
+ auto& os = gctx->outStream();
+
+ FrameId frame = 10;
+ auto expr = sbe::makeE<ELocalBind>(frame,
+ makeEs(makeC(value::makeCopyDecimal(Decimal128(123)))),
+ sbe::makeE<EFail>(ErrorCodes::Error::BadValue, "test"_sd));
+
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ executeAndPrintVariation(os, *compiledExpr);
+}
+
+
+} // namespace mongo::sbe
diff --git a/src/mongo/db/exec/sbe/expressions/sbe_if_test.cpp b/src/mongo/db/exec/sbe/expressions/sbe_if_test.cpp
new file mode 100644
index 00000000000..87f7476da2a
--- /dev/null
+++ b/src/mongo/db/exec/sbe/expressions/sbe_if_test.cpp
@@ -0,0 +1,259 @@
+/**
+ * Copyright (C) 2022-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/db/exec/sbe/expression_test_base.h"
+
+namespace mongo::sbe {
+
+class SBEIfTest : public GoldenEExpressionTestFixture {
+protected:
+ std::vector<TypedValue> boolTestValues = {makeNothing(), makeBool(false), makeBool(true)};
+ ValueVectorGuard boolTestValuesGuard{boolTestValues};
+};
+
+TEST_F(SBEIfTest, SimpleIf) {
+ auto& os = gctx->outStream();
+
+ value::ViewOfValueAccessor condAccessor;
+
+ auto condSlot = bindAccessor(&condAccessor);
+
+ auto expr = sbe::makeE<EIf>(makeE<EVariable>(condSlot),
+ makeC(value::makeNewString("then")),
+ makeC(value::makeNewString("else")));
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ // Verify input variations.
+ for (auto cond : boolTestValues) {
+ condAccessor.reset(cond.first, cond.second);
+ executeAndPrintVariation(os, *compiledExpr);
+ }
+}
+
+TEST_F(SBEIfTest, NestedIfCond) {
+ auto& os = gctx->outStream();
+
+ value::ViewOfValueAccessor condAccessor;
+
+ auto condSlot = bindAccessor(&condAccessor);
+
+
+ auto ifExpr =
+ sbe::makeE<EIf>(makeE<EVariable>(condSlot), makeC(makeBool(false)), makeC(makeBool(true)));
+
+ auto expr = sbe::makeE<EIf>(std::move(ifExpr),
+ makeC(value::makeNewString("then")),
+ makeC(value::makeNewString("else")));
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ // Verify input variations.
+ for (auto cond : boolTestValues) {
+ condAccessor.reset(cond.first, cond.second);
+ executeAndPrintVariation(os, *compiledExpr);
+ }
+}
+
+TEST_F(SBEIfTest, NestedIfThen) {
+ auto& os = gctx->outStream();
+
+ value::ViewOfValueAccessor condAccessor;
+ value::ViewOfValueAccessor cond2Accessor;
+
+ auto condSlot = bindAccessor(&condAccessor);
+ auto cond2Slot = bindAccessor(&cond2Accessor);
+
+
+ auto ifExpr = sbe::makeE<EIf>(makeE<EVariable>(condSlot),
+ makeC(value::makeNewString("then")),
+ makeC(value::makeNewString("else")));
+
+ auto expr = sbe::makeE<EIf>(
+ makeE<EVariable>(cond2Slot), std::move(ifExpr), makeC(value::makeNewString("else2")));
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ // Verify input variations.
+ for (auto cond : boolTestValues)
+ for (auto cond2 : boolTestValues) {
+ condAccessor.reset(cond.first, cond.second);
+ cond2Accessor.reset(cond2.first, cond2.second);
+ executeAndPrintVariation(os, *compiledExpr);
+ }
+}
+
+
+TEST_F(SBEIfTest, NestedIfElse) {
+ auto& os = gctx->outStream();
+
+ value::ViewOfValueAccessor condAccessor;
+ value::ViewOfValueAccessor cond2Accessor;
+
+ auto condSlot = bindAccessor(&condAccessor);
+ auto cond2Slot = bindAccessor(&cond2Accessor);
+
+ auto ifExpr = sbe::makeE<EIf>(makeE<EVariable>(condSlot),
+ makeC(value::makeNewString("then")),
+ makeC(value::makeNewString("else")));
+
+ auto expr = sbe::makeE<EIf>(
+ makeE<EVariable>(cond2Slot), makeC(value::makeNewString("then2")), std::move(ifExpr));
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ // Verify input variations.
+ for (auto cond : boolTestValues)
+ for (auto cond2 : boolTestValues) {
+ condAccessor.reset(cond.first, cond.second);
+ cond2Accessor.reset(cond2.first, cond2.second);
+ executeAndPrintVariation(os, *compiledExpr);
+ }
+}
+
+
+TEST_F(SBEIfTest, IfWithLogicAnd) {
+ auto& os = gctx->outStream();
+
+ value::ViewOfValueAccessor condAccessor;
+ value::ViewOfValueAccessor cond2Accessor;
+
+ auto condSlot = bindAccessor(&condAccessor);
+ auto cond2Slot = bindAccessor(&cond2Accessor);
+
+
+ auto expr = sbe::makeE<EIf>(makeE<EPrimBinary>(EPrimBinary::Op::logicAnd,
+ makeE<EVariable>(condSlot),
+ makeE<EVariable>(cond2Slot)),
+ makeC(value::makeNewString("then")),
+ makeC(value::makeNewString("else")));
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ // Verify input variations.
+ for (auto cond : boolTestValues)
+ for (auto cond2 : boolTestValues) {
+ condAccessor.reset(cond.first, cond.second);
+ cond2Accessor.reset(cond2.first, cond2.second);
+ executeAndPrintVariation(os, *compiledExpr);
+ }
+}
+
+TEST_F(SBEIfTest, IfWithLogicOr) {
+ auto& os = gctx->outStream();
+
+ value::ViewOfValueAccessor condAccessor;
+ value::ViewOfValueAccessor cond2Accessor;
+
+ auto condSlot = bindAccessor(&condAccessor);
+ auto cond2Slot = bindAccessor(&cond2Accessor);
+
+
+ auto expr = sbe::makeE<EIf>(makeE<EPrimBinary>(EPrimBinary::Op::logicOr,
+ makeE<EVariable>(condSlot),
+ makeE<EVariable>(cond2Slot)),
+ makeC(value::makeNewString("then")),
+ makeC(value::makeNewString("else")));
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ // Verify input variations.
+ for (auto cond : boolTestValues)
+ for (auto cond2 : boolTestValues) {
+ condAccessor.reset(cond.first, cond.second);
+ cond2Accessor.reset(cond2.first, cond2.second);
+ executeAndPrintVariation(os, *compiledExpr);
+ }
+}
+
+TEST_F(SBEIfTest, IfWithLogicNot) {
+ auto& os = gctx->outStream();
+
+ value::ViewOfValueAccessor condAccessor;
+
+ auto condSlot = bindAccessor(&condAccessor);
+
+ auto expr =
+ sbe::makeE<EIf>(makeE<EPrimUnary>(EPrimUnary::Op::logicNot, makeE<EVariable>(condSlot)),
+ makeC(value::makeNewString("then")),
+ makeC(value::makeNewString("else")));
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ // Verify input variations.
+ for (auto cond : boolTestValues) {
+ condAccessor.reset(cond.first, cond.second);
+ executeAndPrintVariation(os, *compiledExpr);
+ }
+}
+
+
+TEST_F(SBEIfTest, IfWithFillEmpty) {
+ auto& os = gctx->outStream();
+
+ value::ViewOfValueAccessor condAccessor;
+ value::ViewOfValueAccessor cond2Accessor;
+
+ auto condSlot = bindAccessor(&condAccessor);
+ auto cond2Slot = bindAccessor(&cond2Accessor);
+
+ auto expr = sbe::makeE<EIf>(makeE<EPrimBinary>(EPrimBinary::Op::fillEmpty,
+ makeE<EVariable>(condSlot),
+ makeE<EVariable>(cond2Slot)),
+ makeC(value::makeNewString("then")),
+ makeC(value::makeNewString("else")));
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ // Verify input variations.
+ for (auto cond : boolTestValues)
+ for (auto cond2 : boolTestValues) {
+ condAccessor.reset(cond.first, cond.second);
+ cond2Accessor.reset(cond2.first, cond2.second);
+ executeAndPrintVariation(os, *compiledExpr);
+ }
+}
+
+} // namespace mongo::sbe
diff --git a/src/mongo/db/exec/sbe/expressions/sbe_lambda_test.cpp b/src/mongo/db/exec/sbe/expressions/sbe_lambda_test.cpp
index df8a2835244..a355b12873b 100644
--- a/src/mongo/db/exec/sbe/expressions/sbe_lambda_test.cpp
+++ b/src/mongo/db/exec/sbe/expressions/sbe_lambda_test.cpp
@@ -30,9 +30,11 @@
#include "mongo/db/exec/sbe/expression_test_base.h"
namespace mongo::sbe {
-using SBELambdaTest = EExpressionTestFixture;
+using SBELambdaTest = GoldenEExpressionTestFixture;
TEST_F(SBELambdaTest, TraverseP_AddOneToArray) {
+ auto& os = gctx->outStream();
+
value::ViewOfValueAccessor slotAccessor;
auto argSlot = bindAccessor(&slotAccessor);
FrameId frame = 10;
@@ -44,22 +46,21 @@ TEST_F(SBELambdaTest, TraverseP_AddOneToArray) {
makeE<EVariable>(frame, 0),
makeC(makeInt32(1)))),
makeC(makeNothing())));
+ printInputExpression(os, *expr);
+
auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
auto bsonArr = BSON_ARRAY(1 << 2 << 3);
slotAccessor.reset(value::TypeTags::bsonArray,
value::bitcastFrom<const char*>(bsonArr.objdata()));
- auto [tag, val] = runCompiledExpression(compiledExpr.get());
- value::ValueGuard guard(tag, val);
-
- auto [tagExpected, valExpected] = makeArray(BSON_ARRAY(2 << 3 << 4));
- value::ValueGuard expectedGuard(tagExpected, valExpected);
-
- ASSERT_THAT(std::make_pair(tag, val), ValueEq(std::make_pair(tagExpected, valExpected)));
+ executeAndPrintVariation(os, *compiledExpr);
}
TEST_F(SBELambdaTest, TraverseF_OpEq) {
+ auto& os = gctx->outStream();
+
value::ViewOfValueAccessor slotAccessor;
auto argSlot = bindAccessor(&slotAccessor);
FrameId frame = 10;
@@ -71,19 +72,22 @@ TEST_F(SBELambdaTest, TraverseF_OpEq) {
makeE<EVariable>(frame, 0),
makeC(makeInt32(3)))),
makeC(makeNothing())));
+ printInputExpression(os, *expr);
+
auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
auto bsonArr = BSON_ARRAY(1 << 2 << 3 << 4);
slotAccessor.reset(value::TypeTags::bsonArray,
value::bitcastFrom<const char*>(bsonArr.objdata()));
- auto [tag, val] = runCompiledExpression(compiledExpr.get());
-
- value::ValueGuard guard(tag, val);
- ASSERT_THAT(std::make_pair(tag, val), ValueEq(makeBool(true)));
+ executeAndPrintVariation(os, *compiledExpr);
}
TEST_F(SBELambdaTest, TraverseF_WithLocalBind) {
+ auto& os = gctx->outStream();
+
value::ViewOfValueAccessor slotAccessor;
auto argSlot = bindAccessor(&slotAccessor);
FrameId frame1 = 10;
@@ -101,22 +105,20 @@ TEST_F(SBELambdaTest, TraverseF_WithLocalBind) {
sbe::makeE<EVariable>(frame2, 1),
sbe::makeE<EVariable>(frame2, 2));
-
auto expr = sbe::makeE<ELocalBind>(
frame2,
makeEs(makeE<EVariable>(argSlot), makeC(makeInt32(10)), makeC(makeInt32(20))),
std::move(ifExpr));
+ printInputExpression(os, *expr);
auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
auto bsonArr = BSON_ARRAY(1 << 2 << 3 << 4);
slotAccessor.reset(value::TypeTags::bsonArray,
value::bitcastFrom<const char*>(bsonArr.objdata()));
- auto [tag, val] = runCompiledExpression(compiledExpr.get());
-
- value::ValueGuard guard(tag, val);
- ASSERT_THAT(std::make_pair(tag, val), ValueEq(makeInt32(10)));
+ executeAndPrintVariation(os, *compiledExpr);
}
} // namespace mongo::sbe
diff --git a/src/mongo/db/exec/sbe/expressions/sbe_local_bind_test.cpp b/src/mongo/db/exec/sbe/expressions/sbe_local_bind_test.cpp
index da7f4d91907..a21f8e677c3 100644
--- a/src/mongo/db/exec/sbe/expressions/sbe_local_bind_test.cpp
+++ b/src/mongo/db/exec/sbe/expressions/sbe_local_bind_test.cpp
@@ -30,9 +30,11 @@
#include "mongo/db/exec/sbe/expression_test_base.h"
namespace mongo::sbe {
-using SBELocalBindTest = EExpressionTestFixture;
+using SBELocalBindTest = GoldenEExpressionTestFixture;
TEST_F(SBELocalBindTest, OneVariable) {
+ auto& os = gctx->outStream();
+
value::ViewOfValueAccessor slotAccessor;
FrameId frame = 10;
auto expr = sbe::makeE<ELocalBind>(frame,
@@ -40,14 +42,17 @@ TEST_F(SBELocalBindTest, OneVariable) {
makeE<EPrimBinary>(EPrimBinary::Op::add,
makeE<EVariable>(frame, 0),
makeE<EVariable>(frame, 0)));
+ printInputExpression(os, *expr);
+
auto compiledExpr = compileExpression(*expr);
- auto [tag, val] = runCompiledExpression(compiledExpr.get());
- value::ValueGuard guard(tag, val);
+ printCompiledExpression(os, *compiledExpr);
- ASSERT_THAT(std::make_pair(tag, val), ValueEq(makeInt32(20)));
+ executeAndPrintVariation(os, *compiledExpr);
}
TEST_F(SBELocalBindTest, TwoVariables) {
+ auto& os = gctx->outStream();
+
value::ViewOfValueAccessor slotAccessor;
FrameId frame = 10;
auto expr = sbe::makeE<ELocalBind>(frame,
@@ -55,14 +60,17 @@ TEST_F(SBELocalBindTest, TwoVariables) {
makeE<EPrimBinary>(EPrimBinary::Op::add,
makeE<EVariable>(frame, 0),
makeE<EVariable>(frame, 1)));
+ printInputExpression(os, *expr);
+
auto compiledExpr = compileExpression(*expr);
- auto [tag, val] = runCompiledExpression(compiledExpr.get());
- value::ValueGuard guard(tag, val);
+ printCompiledExpression(os, *compiledExpr);
- ASSERT_THAT(std::make_pair(tag, val), ValueEq(makeInt32(30)));
+ executeAndPrintVariation(os, *compiledExpr);
}
TEST_F(SBELocalBindTest, NestedBind1) {
+ auto& os = gctx->outStream();
+
value::ViewOfValueAccessor slotAccessor;
FrameId frame1 = 10;
FrameId frame2 = 20;
@@ -76,15 +84,17 @@ TEST_F(SBELocalBindTest, NestedBind1) {
frame2,
makeEs(makeC(makeInt32(20))),
makeE<EPrimBinary>(EPrimBinary::Op::add, std::move(bindExpr), makeE<EVariable>(frame2, 0)));
+ printInputExpression(os, *expr);
auto compiledExpr = compileExpression(*expr);
- auto [tag, val] = runCompiledExpression(compiledExpr.get());
- value::ValueGuard guard(tag, val);
+ printCompiledExpression(os, *compiledExpr);
- ASSERT_THAT(std::make_pair(tag, val), ValueEq(makeInt32(50)));
+ executeAndPrintVariation(os, *compiledExpr);
}
TEST_F(SBELocalBindTest, NestedBind2) {
+ auto& os = gctx->outStream();
+
value::ViewOfValueAccessor slotAccessor;
FrameId frame1 = 10;
FrameId frame2 = 20;
@@ -99,12 +109,12 @@ TEST_F(SBELocalBindTest, NestedBind2) {
makeE<EPrimBinary>(EPrimBinary::Op::add,
makeE<EVariable>(frame2, 0),
makeE<EVariable>(frame2, 1)));
+ printInputExpression(os, *expr);
auto compiledExpr = compileExpression(*expr);
- auto [tag, val] = runCompiledExpression(compiledExpr.get());
- value::ValueGuard guard(tag, val);
+ printCompiledExpression(os, *compiledExpr);
- ASSERT_THAT(std::make_pair(tag, val), ValueEq(makeInt32(60)));
+ executeAndPrintVariation(os, *compiledExpr);
}
} // namespace mongo::sbe
diff --git a/src/mongo/db/exec/sbe/expressions/sbe_prim_binary_test.cpp b/src/mongo/db/exec/sbe/expressions/sbe_prim_binary_test.cpp
index d1cd3bb3c76..1fc72e4c786 100644
--- a/src/mongo/db/exec/sbe/expressions/sbe_prim_binary_test.cpp
+++ b/src/mongo/db/exec/sbe/expressions/sbe_prim_binary_test.cpp
@@ -28,10 +28,11 @@
*/
#include "mongo/db/exec/sbe/expression_test_base.h"
+#include "mongo/db/query/collation/collator_interface_mock.h"
namespace mongo::sbe {
-class SBEPrimBinaryTest : public EExpressionTestFixture {
+class SBEPrimBinaryTest : public GoldenEExpressionTestFixture {
public:
std::unique_ptr<EExpression> makeBalancedBinaryExpr(EPrimBinary::Op op,
int depth,
@@ -46,75 +47,119 @@ public:
return makeE<EVariable>(slotIds[offset]);
}
}
-};
-TEST_F(SBEPrimBinaryTest, TruthTableAnd) {
- GoldenTestContext gctx(&goldenTestConfigSbe);
- gctx.printTestHeader(GoldenTestContext::HeaderFormat::Text);
- auto& os = gctx.outStream();
+ void runBinaryOpTest(std::ostream& os,
+ EPrimBinary::Op op,
+ std::vector<TypedValue>& testValues) {
+ value::ViewOfValueAccessor lhsAccessor;
+ value::ViewOfValueAccessor rhsAccessor;
+ auto lhsSlot = bindAccessor(&lhsAccessor);
+ auto rhsSlot = bindAccessor(&rhsAccessor);
+
+ auto expr =
+ sbe::makeE<EPrimBinary>(op, makeE<EVariable>(lhsSlot), makeE<EVariable>(rhsSlot));
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ // Verify the operator table
+ for (auto lhs : testValues)
+ for (auto rhs : testValues) {
+ lhsAccessor.reset(lhs.first, lhs.second);
+ rhsAccessor.reset(rhs.first, rhs.second);
+ executeAndPrintVariation(os, *compiledExpr);
+ }
+ }
- value::ViewOfValueAccessor lhsAccessor;
- value::ViewOfValueAccessor rhsAccessor;
+ void runBinaryOpCollationTest(std::ostream& os,
+ EPrimBinary::Op op,
+ std::vector<TypedValue>& testValues,
+ std::vector<TypedValue>& collValues) {
+ value::ViewOfValueAccessor lhsAccessor;
+ value::ViewOfValueAccessor rhsAccessor;
+ value::ViewOfValueAccessor collAccessor;
+
+ auto lhsSlot = bindAccessor(&lhsAccessor);
+ auto rhsSlot = bindAccessor(&rhsAccessor);
+ auto collSlot = bindAccessor(&collAccessor);
+
+ auto expr = sbe::makeE<EPrimBinary>(
+ op, makeE<EVariable>(lhsSlot), makeE<EVariable>(rhsSlot), makeE<EVariable>(collSlot));
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ // Verify the operator table.
+ for (auto lhs : testValues)
+ for (auto rhs : testValues)
+ for (auto coll : collValues) {
+ lhsAccessor.reset(lhs.first, lhs.second);
+ rhsAccessor.reset(rhs.first, rhs.second);
+ collAccessor.reset(coll.first, coll.second);
+ executeAndPrintVariation(os, *compiledExpr);
+ }
+ }
- auto lhsSlot = bindAccessor(&lhsAccessor);
- auto rhsSlot = bindAccessor(&rhsAccessor);
+protected:
+ std::vector<TypedValue> boolTestValues = {makeNothing(), makeBool(false), makeBool(true)};
+ ValueVectorGuard boolTestValuesGuard{boolTestValues};
+
+ std::vector<TypedValue> numericTestValues = {makeNothing(),
+ makeInt32(12),
+ makeInt32(23),
+ makeInt64(123),
+ makeDouble(123.5),
+ value::makeCopyDecimal(Decimal128(223.5))};
+ ValueVectorGuard numericTestValuesGuard{numericTestValues};
+
+ std::vector<TypedValue> mixedTestValues = {makeNothing(),
+ makeNull(),
+ makeBool(false),
+ makeBool(true),
+ makeInt32(12),
+ value::makeCopyDecimal(Decimal128(223.5)),
+ value::makeNewString("abc"_sd),
+ makeTimestamp(Timestamp(1668792433))};
+ ValueVectorGuard mixedTestValuesGuard{mixedTestValues};
+
+ std::vector<TypedValue> stringTestValues = {makeNothing(),
+ value::makeNewString("abc"),
+ value::makeNewString("ABC"),
+ value::makeNewString("abcdefghijkop"),
+ value::makeNewString("ABCDEFGHIJKOP")};
+ ValueVectorGuard stringTestValuesGuard{stringTestValues};
+
+ std::vector<TypedValue> collTestValues = {
+ makeNothing(),
+ value::makeCopyCollator(
+ CollatorInterfaceMock(CollatorInterfaceMock::MockType::kAlwaysEqual)),
+ value::makeCopyCollator(
+ CollatorInterfaceMock(CollatorInterfaceMock::MockType::kToLowerString))};
+ ValueVectorGuard collTestValuesGuard{collTestValues};
+};
- auto expr = sbe::makeE<EPrimBinary>(
- EPrimBinary::Op::logicAnd, makeE<EVariable>(lhsSlot), makeE<EVariable>(rhsSlot));
- printInputExpression(os, *expr);
+/* Logic Operators */
- auto compiledExpr = compileExpression(*expr);
- printCompiledExpression(os, *compiledExpr);
-
- // Verify the truth table
- std::vector<TypedValue> testValues = {makeNothing(), makeBool(false), makeBool(true)};
- for (auto lhs : testValues)
- for (auto rhs : testValues) {
- lhsAccessor.reset(lhs.first, lhs.second);
- rhsAccessor.reset(rhs.first, rhs.second);
- executeAndPrintVariation(os, *compiledExpr);
- }
+TEST_F(SBEPrimBinaryTest, TruthTableAnd) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::logicAnd, boolTestValues);
}
TEST_F(SBEPrimBinaryTest, TruthTableOr) {
- GoldenTestContext gctx(&goldenTestConfigSbe);
- gctx.printTestHeader(GoldenTestContext::HeaderFormat::Text);
- auto& os = gctx.outStream();
-
- value::ViewOfValueAccessor lhsAccessor;
- value::ViewOfValueAccessor rhsAccessor;
-
- auto lhsSlot = bindAccessor(&lhsAccessor);
- auto rhsSlot = bindAccessor(&rhsAccessor);
-
- auto expr = sbe::makeE<EPrimBinary>(
- EPrimBinary::Op::logicOr, makeE<EVariable>(lhsSlot), makeE<EVariable>(rhsSlot));
- printInputExpression(os, *expr);
-
- auto compiledExpr = compileExpression(*expr);
- printCompiledExpression(os, *compiledExpr);
-
- // Verify the truth table
- std::vector<TypedValue> testValues = {makeNothing(), makeBool(false), makeBool(true)};
- for (auto lhs : testValues)
- for (auto rhs : testValues) {
- lhsAccessor.reset(lhs.first, lhs.second);
- rhsAccessor.reset(rhs.first, rhs.second);
- executeAndPrintVariation(os, *compiledExpr);
- }
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::logicOr, boolTestValues);
}
TEST_F(SBEPrimBinaryTest, BalancedAnd) {
- GoldenTestContext gctx(&goldenTestConfigSbe);
- gctx.printTestHeader(GoldenTestContext::HeaderFormat::Text);
- auto& os = gctx.outStream();
+ auto& os = gctx->outStream();
std::vector<std::unique_ptr<value::ViewOfValueAccessor>> accessors;
value::SlotVector slotIds;
int depth = 3;
int numSlots = 1 << depth;
-
for (int i = 0; i < numSlots; i++) {
accessors.emplace_back(std::make_unique<value::ViewOfValueAccessor>());
accessors.back()->reset(value::TypeTags::Boolean, value::bitcastFrom<bool>(true));
@@ -127,7 +172,7 @@ TEST_F(SBEPrimBinaryTest, BalancedAnd) {
auto compiledExpr = compileExpression(*expr);
printCompiledExpression(os, *compiledExpr);
- // All values are true
+ // All values are true.
{
auto [tag, val] = runCompiledExpression(compiledExpr.get());
value::ValueGuard guard(tag, val);
@@ -136,7 +181,7 @@ TEST_F(SBEPrimBinaryTest, BalancedAnd) {
ASSERT_THAT(std::make_pair(tag, val), ValueEq(expected));
}
- // One of the values is false
+ // One of the values is false.
for (int falsePosition = 0; falsePosition < numSlots; falsePosition++) {
accessors[falsePosition]->reset(value::TypeTags::Boolean, value::bitcastFrom<bool>(false));
@@ -149,7 +194,7 @@ TEST_F(SBEPrimBinaryTest, BalancedAnd) {
accessors[falsePosition]->reset(value::TypeTags::Boolean, value::bitcastFrom<bool>(true));
}
- // One of the values is true and one is nothing
+ // One of the values is true and one is nothing.
for (int nothingPosition = 0; nothingPosition < numSlots; nothingPosition++)
for (int falsePosition = 0; falsePosition < numSlots; falsePosition++) {
if (nothingPosition == falsePosition)
@@ -174,11 +219,8 @@ TEST_F(SBEPrimBinaryTest, BalancedAnd) {
}
}
-
TEST_F(SBEPrimBinaryTest, BalancedOr) {
- GoldenTestContext gctx(&goldenTestConfigSbe);
- gctx.printTestHeader(GoldenTestContext::HeaderFormat::Text);
- auto& os = gctx.outStream();
+ auto& os = gctx->outStream();
std::vector<std::unique_ptr<value::ViewOfValueAccessor>> accessors;
value::SlotVector slotIds;
@@ -198,7 +240,7 @@ TEST_F(SBEPrimBinaryTest, BalancedOr) {
auto compiledExpr = compileExpression(*expr);
printCompiledExpression(os, *compiledExpr);
- // All values are false
+ // All values are false.
{
auto [tag, val] = runCompiledExpression(compiledExpr.get());
value::ValueGuard guard(tag, val);
@@ -207,7 +249,7 @@ TEST_F(SBEPrimBinaryTest, BalancedOr) {
ASSERT_THAT(std::make_pair(tag, val), ValueEq(expected));
}
- // One of the values is true
+ // One of the values is true.
for (int truePosition = 0; truePosition < numSlots; truePosition++) {
accessors[truePosition]->reset(value::TypeTags::Boolean, value::bitcastFrom<bool>(true));
@@ -220,7 +262,7 @@ TEST_F(SBEPrimBinaryTest, BalancedOr) {
accessors[truePosition]->reset(value::TypeTags::Boolean, value::bitcastFrom<bool>(false));
}
- // One of the values is true and one is nothing
+ // One of the values is true and one is nothing.
for (int nothingPosition = 0; nothingPosition < numSlots; nothingPosition++)
for (int truePosition = 0; truePosition < numSlots; truePosition++) {
if (nothingPosition == truePosition)
@@ -245,4 +287,195 @@ TEST_F(SBEPrimBinaryTest, BalancedOr) {
}
}
+/* Arithmetic operators - Numeric */
+TEST_F(SBEPrimBinaryTest, AddNumeric) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::add, numericTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, SubNumeric) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::sub, numericTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, MulNumeric) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::mul, numericTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, DivNumeric) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::div, numericTestValues);
+}
+
+/* Arithmetic operators - Mixed */
+
+TEST_F(SBEPrimBinaryTest, AddMixed) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::add, mixedTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, SubMixed) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::sub, mixedTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, MulMixed) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::mul, mixedTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, DivMixed) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::div, mixedTestValues);
+}
+
+/* Comparison operators - Numeric*/
+
+TEST_F(SBEPrimBinaryTest, EqNumeric) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::eq, numericTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, NeqNumeric) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::neq, numericTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, LessNumeric) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::less, numericTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, LessEqMixed) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::lessEq, mixedTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, GreaterNumeric) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::greater, numericTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, GreaterEqNumeric) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::greaterEq, numericTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, Cmp3wNumeric) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::cmp3w, numericTestValues);
+}
+
+/* Comparison operators - Mixed */
+
+TEST_F(SBEPrimBinaryTest, EqMixed) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::eq, mixedTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, NeqMixed) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::neq, mixedTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, LessMixed) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::less, mixedTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, LessEqNumeric) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::lessEq, numericTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, GreaterMixed) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::greater, mixedTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, GreaterEqMixed) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::greaterEq, mixedTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, Cmp3wMixed) {
+ auto& os = gctx->outStream();
+ runBinaryOpTest(os, EPrimBinary::Op::cmp3w, mixedTestValues);
+}
+
+/* Comparison operators - String */
+
+TEST_F(SBEPrimBinaryTest, EqString) {
+ auto& os = gctx->outStream();
+ runBinaryOpCollationTest(os, EPrimBinary::Op::eq, stringTestValues, collTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, NeqString) {
+ auto& os = gctx->outStream();
+ runBinaryOpCollationTest(os, EPrimBinary::Op::neq, stringTestValues, collTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, LessString) {
+ auto& os = gctx->outStream();
+ runBinaryOpCollationTest(os, EPrimBinary::Op::less, stringTestValues, collTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, LessEqString) {
+ auto& os = gctx->outStream();
+ runBinaryOpCollationTest(os, EPrimBinary::Op::lessEq, stringTestValues, collTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, GreaterString) {
+ auto& os = gctx->outStream();
+ runBinaryOpCollationTest(os, EPrimBinary::Op::greater, stringTestValues, collTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, GreaterEqString) {
+ auto& os = gctx->outStream();
+ runBinaryOpCollationTest(os, EPrimBinary::Op::greaterEq, stringTestValues, collTestValues);
+}
+
+TEST_F(SBEPrimBinaryTest, Cmp3wString) {
+ auto& os = gctx->outStream();
+ runBinaryOpCollationTest(os, EPrimBinary::Op::cmp3w, stringTestValues, collTestValues);
+}
+
+/* Misc operators */
+
+TEST_F(SBEPrimBinaryTest, FillEmpty) {
+ auto& os = gctx->outStream();
+ std::vector<TypedValue> testValues = {
+ makeNothing(), makeNull(), makeBool(false), makeBool(true)};
+ runBinaryOpTest(os, EPrimBinary::Op::fillEmpty, testValues);
+}
+
+TEST_F(SBEPrimBinaryTest, FillEmptyWithConstant) {
+ auto& os = gctx->outStream();
+
+ std::vector<TypedValue> testValues = {
+ makeNothing(), makeNull(), makeBool(true), makeBool(true)};
+ for (auto rhs : testValues) {
+
+ os << "== VARIATION rhs constant: " << rhs << std::endl;
+
+ value::ViewOfValueAccessor lhsAccessor;
+ auto lhsSlot = bindAccessor(&lhsAccessor);
+
+ auto expr = sbe::makeE<EPrimBinary>(
+ EPrimBinary::Op::fillEmpty, makeE<EVariable>(lhsSlot), makeC(rhs));
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ // Verify the combination table.
+ for (auto lhs : testValues) {
+
+ lhsAccessor.reset(lhs.first, lhs.second);
+ executeAndPrintVariation(os, *compiledExpr);
+ }
+ }
+}
+
} // namespace mongo::sbe
diff --git a/src/mongo/db/exec/sbe/expressions/sbe_prim_unary_test.cpp b/src/mongo/db/exec/sbe/expressions/sbe_prim_unary_test.cpp
new file mode 100644
index 00000000000..2e614904992
--- /dev/null
+++ b/src/mongo/db/exec/sbe/expressions/sbe_prim_unary_test.cpp
@@ -0,0 +1,99 @@
+/**
+ * Copyright (C) 2022-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/db/exec/sbe/expression_test_base.h"
+
+namespace mongo::sbe {
+
+class SBEPrimUnaryTest : public GoldenEExpressionTestFixture {
+public:
+ void runUnaryOpTest(std::ostream& os, EPrimUnary::Op op, std::vector<TypedValue>& testValues) {
+ value::ViewOfValueAccessor lhsAccessor;
+
+ auto lhsSlot = bindAccessor(&lhsAccessor);
+
+ auto expr = sbe::makeE<EPrimUnary>(op, makeE<EVariable>(lhsSlot));
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ // Verify the operator table
+ for (auto lhs : testValues) {
+ lhsAccessor.reset(lhs.first, lhs.second);
+ executeAndPrintVariation(os, *compiledExpr);
+ }
+ }
+
+protected:
+ std::vector<TypedValue> boolTestValues = {makeNothing(), makeBool(false), makeBool(true)};
+ ValueVectorGuard boolTestValuesGuard{boolTestValues};
+
+ std::vector<TypedValue> numericTestValues = {makeNothing(),
+ makeInt32(0),
+ makeInt32(12),
+ makeInt32(23),
+ makeInt64(123),
+ makeDouble(123.5),
+ value::makeCopyDecimal(Decimal128(223.5))};
+ ValueVectorGuard numericTestValuesGuard{numericTestValues};
+
+ std::vector<TypedValue> mixedTestValues = {makeNothing(),
+ makeNull(),
+ makeBool(false),
+ makeBool(true),
+ makeInt32(12),
+ value::makeCopyDecimal(Decimal128(223.5)),
+ value::makeNewString("abc"_sd),
+ makeTimestamp(Timestamp(1668792433))};
+ ValueVectorGuard mixedTestValuesGuard{mixedTestValues};
+};
+
+TEST_F(SBEPrimUnaryTest, LogicNotBool) {
+ auto& os = gctx->outStream();
+ runUnaryOpTest(os, EPrimUnary::Op::logicNot, boolTestValues);
+}
+
+TEST_F(SBEPrimUnaryTest, LogicNotMixed) {
+ auto& os = gctx->outStream();
+ runUnaryOpTest(os, EPrimUnary::Op::logicNot, mixedTestValues);
+}
+
+
+TEST_F(SBEPrimUnaryTest, NegateNumeric) {
+ auto& os = gctx->outStream();
+ runUnaryOpTest(os, EPrimUnary::Op::negate, numericTestValues);
+}
+
+TEST_F(SBEPrimUnaryTest, NegateMixed) {
+ auto& os = gctx->outStream();
+ runUnaryOpTest(os, EPrimUnary::Op::negate, mixedTestValues);
+}
+
+} // namespace mongo::sbe
diff --git a/src/mongo/db/exec/sbe/expressions/sbe_variable_test.cpp b/src/mongo/db/exec/sbe/expressions/sbe_variable_test.cpp
new file mode 100644
index 00000000000..37bf0ee091f
--- /dev/null
+++ b/src/mongo/db/exec/sbe/expressions/sbe_variable_test.cpp
@@ -0,0 +1,92 @@
+/**
+ * Copyright (C) 2022-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/db/exec/sbe/expression_test_base.h"
+#include "mongo/db/exec/sbe/values/bson.h"
+
+namespace mongo::sbe {
+
+using SBEVariableTest = GoldenEExpressionTestFixture;
+
+TEST_F(SBEVariableTest, SlotVariable) {
+ auto& os = gctx->outStream();
+
+ value::ViewOfValueAccessor slotAccessor;
+ auto slotId = bindAccessor(&slotAccessor);
+ auto expr = makeE<EVariable>(slotId);
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ std::vector<TypedValue> testValues = {makeNothing(), makeBool(true), makeInt32(123)};
+ for (auto p : testValues) {
+ slotAccessor.reset(p.first, p.second);
+
+ executeAndPrintVariation(os, *compiledExpr);
+ }
+}
+
+TEST_F(SBEVariableTest, LocalVariable) {
+ auto& os = gctx->outStream();
+
+ value::ViewOfValueAccessor slotAccessor;
+ FrameId frame = 10;
+ auto expr = sbe::makeE<ELocalBind>(
+ frame,
+ makeEs(makeC(value::makeNewString("abcdeghijklmnop"_sd))),
+ makeE<EFunction>("newArray"_sd,
+ makeEs(makeE<EVariable>(frame, 0), makeE<EVariable>(frame, 0))));
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ executeAndPrintVariation(os, *compiledExpr);
+}
+
+TEST_F(SBEVariableTest, LocalVariableMove) {
+ auto& os = gctx->outStream();
+
+ value::ViewOfValueAccessor slotAccessor;
+ FrameId frame = 10;
+ auto expr = sbe::makeE<ELocalBind>(frame,
+ makeEs(makeC(value::makeNewString("abcdeghijklmnop"_sd))),
+ makeE<EFunction>("newArray"_sd,
+ makeEs(makeE<EVariable>(frame, 0, true),
+ makeE<EVariable>(frame, 0, true))));
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+
+ executeAndPrintVariation(os, *compiledExpr);
+}
+
+} // namespace mongo::sbe
diff --git a/src/mongo/db/exec/sbe/sbe_numeric_convert_test.cpp b/src/mongo/db/exec/sbe/sbe_numeric_convert_test.cpp
index 2dda3e73a3a..35072243158 100644
--- a/src/mongo/db/exec/sbe/sbe_numeric_convert_test.cpp
+++ b/src/mongo/db/exec/sbe/sbe_numeric_convert_test.cpp
@@ -86,6 +86,19 @@ protected:
}
};
+TEST_F(SBENumericTest, Compile) {
+ GoldenTestContext gctx(&goldenTestConfigSbe);
+ gctx.printTestHeader(GoldenTestContext::HeaderFormat::Text);
+ auto& os = gctx.outStream();
+
+ auto expr = test_detail::makeEFromNumber(
+ Decimal128(123), value::TypeTags::NumberDecimal, value::TypeTags::NumberInt64);
+ printInputExpression(os, *expr);
+
+ auto compiledExpr = compileExpression(*expr);
+ printCompiledExpression(os, *compiledExpr);
+}
+
TEST_F(SBENumericTest, Int32ToInt64) {
assertConversion(int32_t{-2147483648},
int64_t{-2147483648},
diff --git a/src/mongo/db/exec/sbe/util/print_options.h b/src/mongo/db/exec/sbe/util/print_options.h
index cb6a58d6a0e..00f42b31fdb 100644
--- a/src/mongo/db/exec/sbe/util/print_options.h
+++ b/src/mongo/db/exec/sbe/util/print_options.h
@@ -41,6 +41,7 @@ public:
static constexpr size_t kDefaultBinDataMaxDisplayLength = 80;
static constexpr size_t kDefaultArrayObjectOrNestingMaxDepth = 10;
static constexpr size_t kDefaultUseTagForAmbiguousValues = false;
+ static constexpr size_t kNormalizeOutput = false;
size_t stringMaxDisplayLength() const {
return _stringMaxDisplayLength;
@@ -78,11 +79,25 @@ public:
return *this;
}
+ bool normalizeOutput() const {
+ return _normalizeOutput;
+ }
+
+ /**
+ * Sets whether the output should be normalized. A normalized output will be
+ * stable, determinisitc and platform independent.
+ */
+ PrintOptions& normalizeOutput(bool value) {
+ _normalizeOutput = value;
+ return *this;
+ }
+
private:
size_t _stringMaxDisplayLength = kDefaultStringMaxDisplayLength;
size_t _binDataMaxDisplayLength = kDefaultBinDataMaxDisplayLength;
size_t _arrayObjectOrNestingMaxDepth = kDefaultArrayObjectOrNestingMaxDepth;
bool _useTagForAmbiguousValues = kDefaultUseTagForAmbiguousValues;
+ bool _normalizeOutput = kNormalizeOutput;
};
} // namespace mongo::sbe
diff --git a/src/mongo/db/exec/sbe/values/value_printer.cpp b/src/mongo/db/exec/sbe/values/value_printer.cpp
index e4f099a9d01..9673d20a304 100644
--- a/src/mongo/db/exec/sbe/values/value_printer.cpp
+++ b/src/mongo/db/exec/sbe/values/value_printer.cpp
@@ -26,10 +26,13 @@
* exception statement from all source files in the program, then also delete
* it in the license file.
*/
-#include "mongo/db/exec/sbe/values/value_printer.h"
+#include <algorithm>
+#include <boost/format.hpp>
+
#include "mongo/db/exec/sbe/values/makeobj_spec.h"
#include "mongo/db/exec/sbe/values/sort_spec.h"
#include "mongo/db/exec/sbe/values/value.h"
+#include "mongo/db/exec/sbe/values/value_printer.h"
#include "mongo/platform/basic.h"
#include "mongo/util/pcre_util.h"
@@ -222,6 +225,45 @@ void ValuePrinter<T>::writeArrayToStream(TypeTags tag, Value val, size_t depth)
}
template <typename T>
+void ValuePrinter<T>::writeSortedArraySetToStream(TypeTags tag, Value val, size_t depth) {
+ std::vector<std::pair<TypeTags, Value>> items;
+ for (auto ae = ArrayEnumerator{tag, val}; !ae.atEnd(); ae.advance()) {
+ items.push_back(ae.getViewOfValue());
+ }
+ std::sort(items.begin(),
+ items.end(),
+ [&](std::pair<TypeTags, Value> lhs, std::pair<TypeTags, Value> rhs) {
+ auto [tagCmp, valCmp] =
+ compareValue(lhs.first, lhs.second, rhs.first, rhs.second);
+ return tagCmp == TypeTags::NumberInt32 && bitcastTo<int32_t>(valCmp) < 0;
+ });
+ stream << '[';
+ auto shouldTruncate = true;
+ size_t iter = 0;
+ if (auto it = items.begin(); it != items.end()) {
+ while (iter < options.arrayObjectOrNestingMaxDepth() &&
+ depth < options.arrayObjectOrNestingMaxDepth()) {
+ auto [aeTag, aeVal] = *it;
+ if (aeTag == TypeTags::Array || aeTag == TypeTags::Object) {
+ ++depth;
+ }
+ writeValueToStream(aeTag, aeVal, depth);
+ it++;
+ if (it == items.end()) {
+ shouldTruncate = false;
+ break;
+ }
+ stream << ", ";
+ ++iter;
+ }
+ if (shouldTruncate || depth > options.arrayObjectOrNestingMaxDepth()) {
+ stream << "...";
+ }
+ }
+ stream << ']';
+}
+
+template <typename T>
void ValuePrinter<T>::writeObjectToStream(TypeTags tag, Value val, size_t depth) {
stream << '{';
auto shouldTruncate = true;
@@ -289,6 +331,14 @@ void ValuePrinter<T>::writeBsonRegexToStream(const BsonRegex& regex) {
}
template <typename T>
+void ValuePrinter<T>::writeNormalizedDouble(double value) {
+ std::stringstream ss;
+ ss.precision(std::numeric_limits<double>::max_digits10);
+ ss << (boost::format("%f") % value);
+ stream << ss.str();
+}
+
+template <typename T>
void ValuePrinter<T>::writeValueToStream(TypeTags tag, Value val, size_t depth) {
switch (tag) {
case TypeTags::NumberInt32:
@@ -301,7 +351,11 @@ void ValuePrinter<T>::writeValueToStream(TypeTags tag, Value val, size_t depth)
}
break;
case TypeTags::NumberDouble:
- stream << bitcastTo<double>(val);
+ if (options.normalizeOutput()) {
+ writeNormalizedDouble(bitcastTo<double>(val));
+ } else {
+ stream << bitcastTo<double>(val);
+ }
if (options.useTagForAmbiguousValues()) {
stream << "L";
}
@@ -343,10 +397,16 @@ void ValuePrinter<T>::writeValueToStream(TypeTags tag, Value val, size_t depth)
stream << ')';
break;
case TypeTags::Array:
- case TypeTags::ArraySet:
case TypeTags::bsonArray:
writeArrayToStream(tag, val, depth);
break;
+ case TypeTags::ArraySet:
+ if (options.normalizeOutput()) {
+ writeSortedArraySetToStream(tag, val, depth);
+ } else {
+ writeArrayToStream(tag, val, depth);
+ }
+ break;
case TypeTags::Object:
case TypeTags::bsonObject:
writeObjectToStream(tag, val, depth);
@@ -400,15 +460,8 @@ void ValuePrinter<T>::writeValueToStream(TypeTags tag, Value val, size_t depth)
break;
}
case TypeTags::Timestamp: {
- if (options.useTagForAmbiguousValues()) {
- writeTagToStream(tag);
- stream << "(";
- }
Timestamp ts{bitcastTo<uint64_t>(val)};
stream << ts.toString();
- if (options.useTagForAmbiguousValues()) {
- stream << ")";
- }
break;
}
case TypeTags::pcreRegex: {
diff --git a/src/mongo/db/exec/sbe/values/value_printer.h b/src/mongo/db/exec/sbe/values/value_printer.h
index 337cc252827..42b5f99ab86 100644
--- a/src/mongo/db/exec/sbe/values/value_printer.h
+++ b/src/mongo/db/exec/sbe/values/value_printer.h
@@ -66,11 +66,13 @@ public:
void writeTagToStream(TypeTags tag);
void writeStringDataToStream(StringData sd, bool isJavaScript = false);
void writeArrayToStream(TypeTags tag, Value val, size_t depth = 1);
+ void writeSortedArraySetToStream(TypeTags tag, Value val, size_t depth = 1);
void writeObjectToStream(TypeTags tag, Value val, size_t depth = 1);
void writeObjectToStream(const BSONObj& obj);
void writeObjectIdToStream(TypeTags tag, Value val);
void writeCollatorToStream(const CollatorInterface* collator);
void writeBsonRegexToStream(const BsonRegex& regex);
+ void writeNormalizedDouble(double value);
void writeValueToStream(TypeTags tag, Value val, size_t depth = 1);
public:
diff --git a/src/mongo/db/exec/sbe/vm/vm.cpp b/src/mongo/db/exec/sbe/vm/vm.cpp
index f601579a48e..09c0b421612 100644
--- a/src/mongo/db/exec/sbe/vm/vm.cpp
+++ b/src/mongo/db/exec/sbe/vm/vm.cpp
@@ -5022,6 +5022,224 @@ FastTuple<bool, value::TypeTags, value::Value> ByteCode::dispatchBuiltin(Builtin
MONGO_UNREACHABLE;
}
+
+std::string builtinToString(Builtin b) {
+ switch (b) {
+ case Builtin::split:
+ return "split";
+ case Builtin::regexMatch:
+ return "regexMatch";
+ case Builtin::replaceOne:
+ return "replaceOne";
+ case Builtin::dateDiff:
+ return "dateDiff";
+ case Builtin::dateParts:
+ return "dateParts";
+ case Builtin::dateToParts:
+ return "dateToParts";
+ case Builtin::isoDateToParts:
+ return "isoDateToParts";
+ case Builtin::dayOfYear:
+ return "dayOfYear";
+ case Builtin::dayOfMonth:
+ return "dayOfMonth";
+ case Builtin::dayOfWeek:
+ return "dayOfWeek";
+ case Builtin::datePartsWeekYear:
+ return "datePartsWeekYear";
+ case Builtin::dropFields:
+ return "dropFields";
+ case Builtin::newArray:
+ return "newArray";
+ case Builtin::keepFields:
+ return "keepFields";
+ case Builtin::newArrayFromRange:
+ return "newArrayFromRange";
+ case Builtin::newObj:
+ return "newObj";
+ case Builtin::ksToString:
+ return "ksToString";
+ case Builtin::newKs:
+ return "newKs";
+ case Builtin::collNewKs:
+ return "collNewKs";
+ case Builtin::abs:
+ return "abs";
+ case Builtin::ceil:
+ return "ceil";
+ case Builtin::floor:
+ return "floor";
+ case Builtin::trunc:
+ return "trunc";
+ case Builtin::exp:
+ return "exp";
+ case Builtin::ln:
+ return "ln";
+ case Builtin::log10:
+ return "log10";
+ case Builtin::sqrt:
+ return "sqrt";
+ case Builtin::addToArray:
+ return "addToArray";
+ case Builtin::addToArrayCapped:
+ return "addToArrayCapped";
+ case Builtin::mergeObjects:
+ return "mergeObjects";
+ case Builtin::addToSet:
+ return "addToSet";
+ case Builtin::addToSetCapped:
+ return "addToSetCapped";
+ case Builtin::collAddToSet:
+ return "collAddToSet";
+ case Builtin::collAddToSetCapped:
+ return "collAddToSetCapped";
+ case Builtin::doubleDoubleSum:
+ return "doubleDoubleSum";
+ case Builtin::aggDoubleDoubleSum:
+ return "aggDoubleDoubleSum";
+ case Builtin::doubleDoubleSumFinalize:
+ return "doubleDoubleSumFinalize";
+ case Builtin::doubleDoublePartialSumFinalize:
+ return "doubleDoublePartialSumFinalize";
+ case Builtin::aggStdDev:
+ return "aggStdDev";
+ case Builtin::stdDevPopFinalize:
+ return "stdDevPopFinalize";
+ case Builtin::stdDevSampFinalize:
+ return "stdDevSampFinalize";
+ case Builtin::bitTestZero:
+ return "bitTestZero";
+ case Builtin::bitTestMask:
+ return "bitTestMask";
+ case Builtin::bitTestPosition:
+ return "bitTestPosition";
+ case Builtin::bsonSize:
+ return "bsonSize";
+ case Builtin::toUpper:
+ return "toUpper";
+ case Builtin::toLower:
+ return "toLower";
+ case Builtin::coerceToString:
+ return "coerceToString";
+ case Builtin::concat:
+ return "concat";
+ case Builtin::concatArrays:
+ return "concatArrays";
+ case Builtin::acos:
+ return "acos";
+ case Builtin::acosh:
+ return "acosh";
+ case Builtin::asin:
+ return "asin";
+ case Builtin::asinh:
+ return "asinh";
+ case Builtin::atan:
+ return "atan";
+ case Builtin::atanh:
+ return "atanh";
+ case Builtin::atan2:
+ return "atan2";
+ case Builtin::cos:
+ return "cos";
+ case Builtin::cosh:
+ return "cosh";
+ case Builtin::degreesToRadians:
+ return "degreesToRadians";
+ case Builtin::radiansToDegrees:
+ return "radiansToDegrees";
+ case Builtin::sin:
+ return "sin";
+ case Builtin::sinh:
+ return "sinh";
+ case Builtin::tan:
+ return "tan";
+ case Builtin::tanh:
+ return "tanh";
+ case Builtin::round:
+ return "round";
+ case Builtin::isMember:
+ return "isMember";
+ case Builtin::collIsMember:
+ return "collIsMember";
+ case Builtin::indexOfBytes:
+ return "indexOfBytes";
+ case Builtin::indexOfCP:
+ return "indexOfCP";
+ case Builtin::isDayOfWeek:
+ return "isDayOfWeek";
+ case Builtin::isTimeUnit:
+ return "isTimeUnit";
+ case Builtin::isTimezone:
+ return "isTimezone";
+ case Builtin::setUnion:
+ return "setUnion";
+ case Builtin::setIntersection:
+ return "setIntersection";
+ case Builtin::setDifference:
+ return "setDifference";
+ case Builtin::setEquals:
+ return "setEquals";
+ case Builtin::collSetUnion:
+ return "collSetUnion";
+ case Builtin::collSetIntersection:
+ return "collSetIntersection";
+ case Builtin::collSetDifference:
+ return "collSetDifference";
+ case Builtin::collSetEquals:
+ return "collSetEquals";
+ case Builtin::runJsPredicate:
+ return "runJsPredicate";
+ case Builtin::regexCompile:
+ return "regexCompile";
+ case Builtin::regexFind:
+ return "regexFind";
+ case Builtin::regexFindAll:
+ return "regexFindAll";
+ case Builtin::shardFilter:
+ return "shardFilter";
+ case Builtin::shardHash:
+ return "shardHash";
+ case Builtin::extractSubArray:
+ return "extractSubArray";
+ case Builtin::isArrayEmpty:
+ return "isArrayEmpty";
+ case Builtin::reverseArray:
+ return "reverseArray";
+ case Builtin::sortArray:
+ return "sortArray";
+ case Builtin::dateAdd:
+ return "dateAdd";
+ case Builtin::hasNullBytes:
+ return "hasNullBytes";
+ case Builtin::getRegexPattern:
+ return "getRegexPattern";
+ case Builtin::getRegexFlags:
+ return "getRegexFlags";
+ case Builtin::hash:
+ return "hash";
+ case Builtin::ftsMatch:
+ return "ftsMatch";
+ case Builtin::generateSortKey:
+ return "generateSortKey";
+ case Builtin::makeBsonObj:
+ return "makeBsonObj";
+ case Builtin::tsSecond:
+ return "tsSecond";
+ case Builtin::tsIncrement:
+ return "tsIncrement";
+ case Builtin::typeMatch:
+ return "typeMatch";
+ case Builtin::dateTrunc:
+ return "dateTrunc";
+ case Builtin::internalLeast:
+ return "internalLeast";
+ case Builtin::internalGreatest:
+ return "internalGreatest";
+ default:
+ MONGO_UNREACHABLE;
+ }
+}
+
MONGO_COMPILER_NORETURN void reportSwapFailure();
void ByteCode::swapStack() {
diff --git a/src/mongo/db/exec/sbe/vm/vm.h b/src/mongo/db/exec/sbe/vm/vm.h
index d50a52b4e56..641f00dd95c 100644
--- a/src/mongo/db/exec/sbe/vm/vm.h
+++ b/src/mongo/db/exec/sbe/vm/vm.h
@@ -692,6 +692,8 @@ enum class Builtin : uint8_t {
internalGreatest, // helper functions for computation of sort keys
};
+std::string builtinToString(Builtin b);
+
/**
* This enum defines indices into an 'Array' that returns the partial sum result when 'needsMerge'
* is requested.
diff --git a/src/mongo/db/exec/sbe/vm/vm_printer.cpp b/src/mongo/db/exec/sbe/vm/vm_printer.cpp
index 572780bd28f..2ed13999339 100644
--- a/src/mongo/db/exec/sbe/vm/vm_printer.cpp
+++ b/src/mongo/db/exec/sbe/vm/vm_printer.cpp
@@ -29,6 +29,7 @@
#include <boost/format.hpp>
+#include "mongo/db/exec/sbe/values/value_printer.h"
#include "mongo/db/exec/sbe/vm/vm.h"
#include "mongo/db/exec/sbe/vm/vm_printer.h"
#include "mongo/platform/basic.h"
@@ -176,6 +177,13 @@ public:
case Instruction::ret: {
break;
}
+ case Instruction::allocStack: {
+ auto size = readFromMemory<uint32_t>(pcPointer);
+ pcPointer += sizeof(size);
+ os << "size:" << size;
+ break;
+ }
+
// Instructions with 2 arguments and a collator.
case Instruction::collLess:
case Instruction::collLessEq:
@@ -302,7 +310,10 @@ public:
pcPointer += sizeof(tag);
auto val = readFromMemory<value::Value>(pcPointer);
pcPointer += sizeof(val);
- os << "value: " << std::make_pair(tag, val);
+ os << "value: ";
+ value::ValuePrinters::make(
+ os, PrintOptions().useTagForAmbiguousValues(true).normalizeOutput(true))
+ .writeValueToStream(tag, val);
break;
}
case Instruction::pushAccessVal:
@@ -344,7 +355,7 @@ public:
arity = readFromMemory<SmallArityType>(pcPointer);
pcPointer += sizeof(SmallArityType);
}
- os << "f: " << static_cast<uint8_t>(f) << ", arity: " << arity;
+ os << "f: " << builtinToString(f) << ", arity: " << arity;
break;
}
case Instruction::dateTruncImm: {
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_constant_test/sbe_constants.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_constant_test/sbe_constants.txt
new file mode 100644
index 00000000000..a8c6ac8cd70
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_constant_test/sbe_constants.txt
@@ -0,0 +1,129 @@
+# Golden test output of SBEConstantTest/SbeConstants
+-- INPUT EXPRESSION:
+Nothing
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000a]
+0x0000: pushConstVal(value: Nothing);
+
+
+-- INPUT EXPRESSION:
+null
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000a]
+0x0000: pushConstVal(value: null);
+
+
+-- INPUT EXPRESSION:
+true
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000a]
+0x0000: pushConstVal(value: true);
+
+
+-- INPUT EXPRESSION:
+123
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000a]
+0x0000: pushConstVal(value: 123);
+
+
+-- INPUT EXPRESSION:
+123ll
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000a]
+0x0000: pushConstVal(value: 123ll);
+
+
+-- INPUT EXPRESSION:
+123.000000L
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000a]
+0x0000: pushConstVal(value: 123.000000L);
+
+
+-- INPUT EXPRESSION:
+minKey
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000a]
+0x0000: pushConstVal(value: minKey);
+
+
+-- INPUT EXPRESSION:
+maxKey
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000a]
+0x0000: pushConstVal(value: maxKey);
+
+
+-- INPUT EXPRESSION:
+NumberDecimal(123.000000000000)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000a]
+0x0000: pushConstVal(value: NumberDecimal(123.000000000000));
+
+
+-- INPUT EXPRESSION:
+"abc"
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000a]
+0x0000: pushConstVal(value: "abc");
+
+
+-- INPUT EXPRESSION:
+"abcdefghijklmnop"
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000a]
+0x0000: pushConstVal(value: "abcdefghijklmnop");
+
+
+-- INPUT EXPRESSION:
+RecordId(123)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000a]
+0x0000: pushConstVal(value: RecordId(123));
+
+
+-- INPUT EXPRESSION:
+ObjectId("000102030405060708090a0b")
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000a]
+0x0000: pushConstVal(value: ObjectId("000102030405060708090a0b"));
+
+
+-- INPUT EXPRESSION:
+[1, 2, 3]
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000a]
+0x0000: pushConstVal(value: [1, 2, 3]);
+
+
+-- INPUT EXPRESSION:
+[1, 2, 3]
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000a]
+0x0000: pushConstVal(value: [1, 2, 3]);
+
+
+-- INPUT EXPRESSION:
+{"a" : 1, "b" : 2}
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000a]
+0x0000: pushConstVal(value: {"a" : 1, "b" : 2});
+
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_fail_test/fail_with_add_decimal.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_fail_test/fail_with_add_decimal.txt
new file mode 100644
index 00000000000..7b3b80bd9e1
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_fail_test/fail_with_add_decimal.txt
@@ -0,0 +1,16 @@
+# Golden test output of SBEFailTest/FailWithAddDecimal
+-- INPUT EXPRESSION:
+(NumberDecimal(123) + fail(2, "test"))
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0022]
+0x0000: pushConstVal(value: NumberDecimal(123));
+0x000a: pushConstVal(value: 2ll);
+0x0014: pushConstVal(value: "test");
+0x001e: fail();
+0x001f: add(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+EXCEPTION: BadValue: test
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_fail_test/fail_with_local_bind.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_fail_test/fail_with_local_bind.txt
new file mode 100644
index 00000000000..365b40a9ac5
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_fail_test/fail_with_local_bind.txt
@@ -0,0 +1,22 @@
+# Golden test output of SBEFailTest/FailWithLocalBind
+-- INPUT EXPRESSION:
+
+ let [
+ l10.0 = NumberDecimal(123)
+ ]
+ in fail(2, "test")
+
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0021]
+0x0000: pushConstVal(value: NumberDecimal(123));
+0x000a: pushConstVal(value: 2ll);
+0x0014: pushConstVal(value: "test");
+0x001e: fail();
+0x001f: swap();
+0x0020: pop();
+
+
+-- EXECUTE VARIATION:
+EXCEPTION: BadValue: test
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_fail_test/simple_fail.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_fail_test/simple_fail.txt
new file mode 100644
index 00000000000..eeffc2d4582
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_fail_test/simple_fail.txt
@@ -0,0 +1,14 @@
+# Golden test output of SBEFailTest/SimpleFail
+-- INPUT EXPRESSION:
+fail(2, "test")
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushConstVal(value: 2ll);
+0x000a: pushConstVal(value: "test");
+0x0014: fail();
+
+
+-- EXECUTE VARIATION:
+EXCEPTION: BadValue: test
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/if_with_fill_empty.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/if_with_fill_empty.txt
new file mode 100644
index 00000000000..dc27e00ba75
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/if_with_fill_empty.txt
@@ -0,0 +1,58 @@
+# Golden test output of SBEIfTest/IfWithFillEmpty
+-- INPUT EXPRESSION:
+
+ if (s1 ?: s2)
+ then "then"
+ else "else"
+
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0040]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: jmpNothing(target: 0x0013);
+0x000e: jmp(target: 0x001d);
+0x0013: pop();
+0x0014: pushAccessVal(accessor: <accessor>);
+0x001d: jmpNothing(target: 0x0040);
+0x0022: jmpTrue(target: 0x0036);
+0x0027: pushConstVal(value: "else");
+0x0031: jmp(target: 0x0040);
+0x0036: pushConstVal(value: "then");
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: false]
+RESULT: "else"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: true]
+RESULT: "then"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Nothing]
+RESULT: "else"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: false]
+RESULT: "else"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: true]
+RESULT: "else"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Nothing]
+RESULT: "then"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: false]
+RESULT: "then"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: "then"
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/if_with_logic_and.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/if_with_logic_and.txt
new file mode 100644
index 00000000000..47c685297d1
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/if_with_logic_and.txt
@@ -0,0 +1,59 @@
+# Golden test output of SBEIfTest/IfWithLogicAnd
+-- INPUT EXPRESSION:
+
+ if (s1 && s2)
+ then "then"
+ else "else"
+
+
+-- COMPILED EXPRESSION:
+[0x0000-0x004e]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: jmpNothing(target: 0x002b);
+0x000e: jmpTrue(target: 0x0022);
+0x0013: pushConstVal(value: false);
+0x001d: jmp(target: 0x002b);
+0x0022: pushAccessVal(accessor: <accessor>);
+0x002b: jmpNothing(target: 0x004e);
+0x0030: jmpTrue(target: 0x0044);
+0x0035: pushConstVal(value: "else");
+0x003f: jmp(target: 0x004e);
+0x0044: pushConstVal(value: "then");
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Nothing]
+RESULT: "else"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: false]
+RESULT: "else"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: true]
+RESULT: "else"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: false]
+RESULT: "else"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: "then"
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/if_with_logic_not.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/if_with_logic_not.txt
new file mode 100644
index 00000000000..0040cc99722
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/if_with_logic_not.txt
@@ -0,0 +1,31 @@
+# Golden test output of SBEIfTest/IfWithLogicNot
+-- INPUT EXPRESSION:
+
+ if !(s1)
+ then "then"
+ else "else"
+
+
+-- COMPILED EXPRESSION:
+[0x0000-0x002e]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: logicNot(popParam: 1, offsetParam: 0);
+0x000b: jmpNothing(target: 0x002e);
+0x0010: jmpTrue(target: 0x0024);
+0x0015: pushConstVal(value: "else");
+0x001f: jmp(target: 0x002e);
+0x0024: pushConstVal(value: "then");
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false]
+RESULT: "then"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true]
+RESULT: "else"
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/if_with_logic_or.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/if_with_logic_or.txt
new file mode 100644
index 00000000000..e667819edca
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/if_with_logic_or.txt
@@ -0,0 +1,59 @@
+# Golden test output of SBEIfTest/IfWithLogicOr
+-- INPUT EXPRESSION:
+
+ if (s1 || s2)
+ then "then"
+ else "else"
+
+
+-- COMPILED EXPRESSION:
+[0x0000-0x004e]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: jmpNothing(target: 0x002b);
+0x000e: jmpTrue(target: 0x0021);
+0x0013: pushAccessVal(accessor: <accessor>);
+0x001c: jmp(target: 0x002b);
+0x0021: pushConstVal(value: true);
+0x002b: jmpNothing(target: 0x004e);
+0x0030: jmpTrue(target: 0x0044);
+0x0035: pushConstVal(value: "else");
+0x003f: jmp(target: 0x004e);
+0x0044: pushConstVal(value: "then");
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: false]
+RESULT: "else"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: true]
+RESULT: "then"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Nothing]
+RESULT: "then"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: false]
+RESULT: "then"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: "then"
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/nested_if_cond.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/nested_if_cond.txt
new file mode 100644
index 00000000000..b956397c02b
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/nested_if_cond.txt
@@ -0,0 +1,39 @@
+# Golden test output of SBEIfTest/NestedIfCond
+-- INPUT EXPRESSION:
+
+ if
+ if s1
+ then false
+ else true
+
+ then "then"
+ else "else"
+
+
+-- COMPILED EXPRESSION:
+[0x0000-0x004f]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: jmpNothing(target: 0x002c);
+0x000e: jmpTrue(target: 0x0022);
+0x0013: pushConstVal(value: true);
+0x001d: jmp(target: 0x002c);
+0x0022: pushConstVal(value: false);
+0x002c: jmpNothing(target: 0x004f);
+0x0031: jmpTrue(target: 0x0045);
+0x0036: pushConstVal(value: "else");
+0x0040: jmp(target: 0x004f);
+0x0045: pushConstVal(value: "then");
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false]
+RESULT: "then"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true]
+RESULT: "else"
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/nested_if_else.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/nested_if_else.txt
new file mode 100644
index 00000000000..36aef4a19cc
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/nested_if_else.txt
@@ -0,0 +1,62 @@
+# Golden test output of SBEIfTest/NestedIfElse
+-- INPUT EXPRESSION:
+
+ if s2
+ then "then2"
+ else
+ if s1
+ then "then"
+ else "else"
+
+
+-- COMPILED EXPRESSION:
+[0x0000-0x004e]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: jmpNothing(target: 0x004e);
+0x000e: jmpTrue(target: 0x0044);
+0x0013: pushAccessVal(accessor: <accessor>);
+0x001c: jmpNothing(target: 0x003f);
+0x0021: jmpTrue(target: 0x0035);
+0x0026: pushConstVal(value: "else");
+0x0030: jmp(target: 0x003f);
+0x0035: pushConstVal(value: "then");
+0x003f: jmp(target: 0x004e);
+0x0044: pushConstVal(value: "then2");
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: true]
+RESULT: "then2"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: false]
+RESULT: "else"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: true]
+RESULT: "then2"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: false]
+RESULT: "then"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: "then2"
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/nested_if_then.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/nested_if_then.txt
new file mode 100644
index 00000000000..900f92ee9c8
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/nested_if_then.txt
@@ -0,0 +1,63 @@
+# Golden test output of SBEIfTest/NestedIfThen
+-- INPUT EXPRESSION:
+
+ if s2
+ then
+ if s1
+ then "then"
+ else "else"
+
+ else "else2"
+
+
+-- COMPILED EXPRESSION:
+[0x0000-0x004e]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: jmpNothing(target: 0x004e);
+0x000e: jmpTrue(target: 0x0022);
+0x0013: pushConstVal(value: "else2");
+0x001d: jmp(target: 0x004e);
+0x0022: pushAccessVal(accessor: <accessor>);
+0x002b: jmpNothing(target: 0x004e);
+0x0030: jmpTrue(target: 0x0044);
+0x0035: pushConstVal(value: "else");
+0x003f: jmp(target: 0x004e);
+0x0044: pushConstVal(value: "then");
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: false]
+RESULT: "else2"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: false]
+RESULT: "else2"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: true]
+RESULT: "else"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: false]
+RESULT: "else2"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: "then"
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/simple_if.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/simple_if.txt
new file mode 100644
index 00000000000..0ff0ab40bfa
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_if_test/simple_if.txt
@@ -0,0 +1,30 @@
+# Golden test output of SBEIfTest/SimpleIf
+-- INPUT EXPRESSION:
+
+ if s1
+ then "then"
+ else "else"
+
+
+-- COMPILED EXPRESSION:
+[0x0000-0x002c]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: jmpNothing(target: 0x002c);
+0x000e: jmpTrue(target: 0x0022);
+0x0013: pushConstVal(value: "else");
+0x001d: jmp(target: 0x002c);
+0x0022: pushConstVal(value: "then");
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false]
+RESULT: "else"
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true]
+RESULT: "then"
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_lambda_test/traverse_f_op_eq.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_lambda_test/traverse_f_op_eq.txt
new file mode 100644
index 00000000000..f00a7a5b0f1
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_lambda_test/traverse_f_op_eq.txt
@@ -0,0 +1,19 @@
+# Golden test output of SBELambdaTest/TraverseF_OpEq
+-- INPUT EXPRESSION:
+traverseF(s1, lambda(l10.0) { (l10.0 == 3) }, Nothing)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x002b]
+0x0000: jmp(target: 0x001c);
+0x0005: allocStack(size:1);
+0x000a: pushConstVal(value: 3);
+0x0014: eq(popLhs: 0, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+0x001b: ret();
+0x001c: pushAccessVal(accessor: <accessor>);
+0x0025: traverseFImm(k: False, target: 0x0005);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: [1, 2, 3, 4]]
+RESULT: true
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_lambda_test/traverse_f_with_local_bind.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_lambda_test/traverse_f_with_local_bind.txt
new file mode 100644
index 00000000000..50839afab8b
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_lambda_test/traverse_f_with_local_bind.txt
@@ -0,0 +1,43 @@
+# Golden test output of SBELambdaTest/TraverseF_WithLocalBind
+-- INPUT EXPRESSION:
+
+ let [
+ l20.0 = s1
+ l20.1 = 10
+ l20.2 = 20
+ ]
+ in
+ if traverseF(l20.0, lambda(l10.0) { (l10.0 == 3) }, Nothing)
+ then l20.1
+ else l20.2
+
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0063]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushConstVal(value: 10);
+0x0013: pushConstVal(value: 20);
+0x001d: jmp(target: 0x0039);
+0x0022: allocStack(size:1);
+0x0027: pushConstVal(value: 3);
+0x0031: eq(popLhs: 0, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+0x0038: ret();
+0x0039: pushLocalVal(arg: 2);
+0x003e: traverseFImm(k: False, target: 0x0022);
+0x0044: jmpNothing(target: 0x005d);
+0x0049: jmpTrue(target: 0x0058);
+0x004e: pushLocalVal(arg: 0);
+0x0053: jmp(target: 0x005d);
+0x0058: pushLocalVal(arg: 1);
+0x005d: swap();
+0x005e: pop();
+0x005f: swap();
+0x0060: pop();
+0x0061: swap();
+0x0062: pop();
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: [1, 2, 3, 4]]
+RESULT: 10
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_lambda_test/traverse_p_add_one_to_array.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_lambda_test/traverse_p_add_one_to_array.txt
new file mode 100644
index 00000000000..91b718818f7
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_lambda_test/traverse_p_add_one_to_array.txt
@@ -0,0 +1,19 @@
+# Golden test output of SBELambdaTest/TraverseP_AddOneToArray
+-- INPUT EXPRESSION:
+traverseP(s1, lambda(l10.0) { (l10.0 + 1) }, Nothing)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x002b]
+0x0000: jmp(target: 0x001c);
+0x0005: allocStack(size:1);
+0x000a: pushConstVal(value: 1);
+0x0014: add(popLhs: 0, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+0x001b: ret();
+0x001c: pushAccessVal(accessor: <accessor>);
+0x0025: traversePImm(k: Nothing, target: 0x0005);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: [1, 2, 3]]
+RESULT: [2, 3, 4]
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_local_bind_test/nested_bind1.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_local_bind_test/nested_bind1.txt
new file mode 100644
index 00000000000..ede4ae8caf7
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_local_bind_test/nested_bind1.txt
@@ -0,0 +1,29 @@
+# Golden test output of SBELocalBindTest/NestedBind1
+-- INPUT EXPRESSION:
+
+ let [
+ l20.0 = 20
+ ]
+ in (
+ let [
+ l10.0 = 10
+ ]
+ in (l10.0 + l20.0)
+ + l20.0)
+
+
+-- COMPILED EXPRESSION:
+[0x0000-0x002a]
+0x0000: pushConstVal(value: 20);
+0x000a: pushConstVal(value: 10);
+0x0014: add(popLhs: 0, offsetLhs: 0, popRhs: 0, offsetRhs: 1);
+0x001f: swap();
+0x0020: pop();
+0x0021: add(popLhs: 1, offsetLhs: 0, popRhs: 0, offsetRhs: 1);
+0x0028: swap();
+0x0029: pop();
+
+
+-- EXECUTE VARIATION:
+RESULT: 50
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_local_bind_test/nested_bind2.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_local_bind_test/nested_bind2.txt
new file mode 100644
index 00000000000..4baac2d4b02
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_local_bind_test/nested_bind2.txt
@@ -0,0 +1,36 @@
+# Golden test output of SBELocalBindTest/NestedBind2
+-- INPUT EXPRESSION:
+
+ let [
+ l20.0 =
+ let [
+ l10.0 = 10
+ l10.1 = 20
+ ]
+ in (l10.0 + l10.1)
+
+ l20.1 = 30
+ ]
+ in (l20.0 + l20.1)
+
+
+-- COMPILED EXPRESSION:
+[0x0000-0x003c]
+0x0000: pushConstVal(value: 10);
+0x000a: pushConstVal(value: 20);
+0x0014: add(popLhs: 0, offsetLhs: 1, popRhs: 0, offsetRhs: 0);
+0x001f: swap();
+0x0020: pop();
+0x0021: swap();
+0x0022: pop();
+0x0023: pushConstVal(value: 30);
+0x002d: add(popLhs: 0, offsetLhs: 1, popRhs: 0, offsetRhs: 0);
+0x0038: swap();
+0x0039: pop();
+0x003a: swap();
+0x003b: pop();
+
+
+-- EXECUTE VARIATION:
+RESULT: 60
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_local_bind_test/one_variable.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_local_bind_test/one_variable.txt
new file mode 100644
index 00000000000..ed4205f6087
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_local_bind_test/one_variable.txt
@@ -0,0 +1,20 @@
+# Golden test output of SBELocalBindTest/OneVariable
+-- INPUT EXPRESSION:
+
+ let [
+ l10.0 = 10
+ ]
+ in (l10.0 + l10.0)
+
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0017]
+0x0000: pushConstVal(value: 10);
+0x000a: add(popLhs: 0, offsetLhs: 0, popRhs: 0, offsetRhs: 0);
+0x0015: swap();
+0x0016: pop();
+
+
+-- EXECUTE VARIATION:
+RESULT: 20
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_local_bind_test/two_variables.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_local_bind_test/two_variables.txt
new file mode 100644
index 00000000000..3fc9c54a725
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_local_bind_test/two_variables.txt
@@ -0,0 +1,24 @@
+# Golden test output of SBELocalBindTest/TwoVariables
+-- INPUT EXPRESSION:
+
+ let [
+ l10.0 = 10
+ l10.1 = 20
+ ]
+ in (l10.0 + l10.1)
+
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0023]
+0x0000: pushConstVal(value: 10);
+0x000a: pushConstVal(value: 20);
+0x0014: add(popLhs: 0, offsetLhs: 1, popRhs: 0, offsetRhs: 0);
+0x001f: swap();
+0x0020: pop();
+0x0021: swap();
+0x0022: pop();
+
+
+-- EXECUTE VARIATION:
+RESULT: 30
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_numeric_test/compile.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_numeric_test/compile.txt
new file mode 100644
index 00000000000..5f5ebdeaba5
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_numeric_test/compile.txt
@@ -0,0 +1,10 @@
+# Golden test output of SBENumericTest/Compile
+-- INPUT EXPRESSION:
+convert ( NumberDecimal(123), int64)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000c]
+0x0000: pushConstVal(value: NumberDecimal(123));
+0x000a: numConvert(tag: NumberInt64);
+
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_numeric_test/compile_only.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_numeric_test/compile_only.txt
new file mode 100644
index 00000000000..f9ca0d9cd42
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_numeric_test/compile_only.txt
@@ -0,0 +1,10 @@
+# Golden test output of SBENumericTest/CompileOnly
+-- INPUT EXPRESSION:
+convert ( NumberDecimal(123), int64)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000c]
+0x0000: pushConstVal(value: NumberDecimal(123));
+0x000a: numConvert(tag: NumberInt64);
+
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/add_mixed.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/add_mixed.txt
new file mode 100644
index 00000000000..67c6216b021
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/add_mixed.txt
@@ -0,0 +1,267 @@
+# Golden test output of SBEPrimBinaryTest/AddMixed
+-- INPUT EXPRESSION:
+(s1 + s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: add(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: 24
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(235.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: NumberDecimal(235.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(447.000000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/add_numeric.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/add_numeric.txt
new file mode 100644
index 00000000000..fa72ba31f3d
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/add_numeric.txt
@@ -0,0 +1,155 @@
+# Golden test output of SBEPrimBinaryTest/AddNumeric
+-- INPUT EXPRESSION:
+(s1 + s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: add(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 23]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123ll]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123.500000L]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: 24
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 23]
+RESULT: 35
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123ll]
+RESULT: 135ll
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123.500000L]
+RESULT: 135.500000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(235.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 12]
+RESULT: 35
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 23]
+RESULT: 46
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123ll]
+RESULT: 146ll
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123.500000L]
+RESULT: 146.500000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(246.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 12]
+RESULT: 135ll
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 23]
+RESULT: 146ll
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123ll]
+RESULT: 246ll
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123.500000L]
+RESULT: 246.500000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(346.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 12]
+RESULT: 135.500000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 23]
+RESULT: 146.500000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123ll]
+RESULT: 246.500000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123.500000L]
+RESULT: 247.000000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(347.000000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: NumberDecimal(235.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 23]
+RESULT: NumberDecimal(246.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123ll]
+RESULT: NumberDecimal(346.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123.500000L]
+RESULT: NumberDecimal(347.000000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(447.000000000000)
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/cmp3w_mixed.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/cmp3w_mixed.txt
new file mode 100644
index 00000000000..44cdcc099cc
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/cmp3w_mixed.txt
@@ -0,0 +1,267 @@
+# Golden test output of SBEPrimBinaryTest/Cmp3wMixed
+-- INPUT EXPRESSION:
+(s1 <=> s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: cmp3w(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: null]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: false]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: true]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: 12]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: NumberDecimal(223.500000000000)]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: "abc"]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Timestamp(0, 1668792433)]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: null]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: false]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: true]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: 12]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: NumberDecimal(223.500000000000)]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: "abc"]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Timestamp(0, 1668792433)]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: null]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: false]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: 12]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: NumberDecimal(223.500000000000)]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: "abc"]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Timestamp(0, 1668792433)]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: null]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: false]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: true]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: "abc"]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Timestamp(0, 1668792433)]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: null]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: false]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: true]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: "abc"]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Timestamp(0, 1668792433)]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: null]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: false]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: true]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: 12]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: NumberDecimal(223.500000000000)]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc"]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Timestamp(0, 1668792433)]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: null]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: false]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: true]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: 12]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: NumberDecimal(223.500000000000)]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: "abc"]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Timestamp(0, 1668792433)]
+RESULT: 0
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/cmp3w_numeric.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/cmp3w_numeric.txt
new file mode 100644
index 00000000000..dfa4a9a2b4f
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/cmp3w_numeric.txt
@@ -0,0 +1,155 @@
+# Golden test output of SBEPrimBinaryTest/Cmp3wNumeric
+-- INPUT EXPRESSION:
+(s1 <=> s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: cmp3w(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 23]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123ll]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123.500000L]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 23]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123ll]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123.500000L]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 12]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 23]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123ll]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123.500000L]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: NumberDecimal(223.500000000000)]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 12]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 23]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123ll]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123.500000L]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: NumberDecimal(223.500000000000)]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 12]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 23]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123ll]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123.500000L]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: NumberDecimal(223.500000000000)]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 23]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123ll]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123.500000L]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: 0
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/cmp3w_string.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/cmp3w_string.txt
new file mode 100644
index 00000000000..1fc401edbba
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/cmp3w_string.txt
@@ -0,0 +1,312 @@
+# Golden test output of SBEPrimBinaryTest/Cmp3wString
+-- INPUT EXPRESSION:
+(s1 <=>[s3] s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x001f]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: pushAccessVal(accessor: <accessor>);
+0x001b: collCmp3w(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0, popColl: 1, offsetColl: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: -1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 1
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: 0
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/div_mixed.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/div_mixed.txt
new file mode 100644
index 00000000000..37cbb8f09f5
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/div_mixed.txt
@@ -0,0 +1,267 @@
+# Golden test output of SBEPrimBinaryTest/DivMixed
+-- INPUT EXPRESSION:
+(s1 / s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: div(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: 1.000000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(0.05369127516778523489932885906040268)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: NumberDecimal(18.625000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(1)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/div_numeric.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/div_numeric.txt
new file mode 100644
index 00000000000..a12b6838985
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/div_numeric.txt
@@ -0,0 +1,155 @@
+# Golden test output of SBEPrimBinaryTest/DivNumeric
+-- INPUT EXPRESSION:
+(s1 / s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: div(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 23]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123ll]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123.500000L]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: 1.000000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 23]
+RESULT: 0.521739L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123ll]
+RESULT: 0.097561L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123.500000L]
+RESULT: 0.097166L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(0.05369127516778523489932885906040268)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 12]
+RESULT: 1.916667L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 23]
+RESULT: 1.000000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123ll]
+RESULT: 0.186992L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123.500000L]
+RESULT: 0.186235L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(0.1029082774049217002237136465324385)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 12]
+RESULT: 10.250000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 23]
+RESULT: 5.347826L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123ll]
+RESULT: 1.000000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123.500000L]
+RESULT: 0.995951L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(0.5503355704697986577181208053691275)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 12]
+RESULT: 10.291667L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 23]
+RESULT: 5.369565L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123ll]
+RESULT: 1.004065L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123.500000L]
+RESULT: 1.000000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(0.5525727069351230425055928411633110)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: NumberDecimal(18.625000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 23]
+RESULT: NumberDecimal(9.717391304347826086956521739130435)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123ll]
+RESULT: NumberDecimal(1.817073170731707317073170731707317)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123.500000L]
+RESULT: NumberDecimal(1.809716599190283400809716599190283)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(1)
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/eq_mixed.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/eq_mixed.txt
new file mode 100644
index 00000000000..e15b02760ae
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/eq_mixed.txt
@@ -0,0 +1,267 @@
+# Golden test output of SBEPrimBinaryTest/EqMixed
+-- INPUT EXPRESSION:
+(s1 == s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: eq(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: null]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: false]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: true]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: false]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc"]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Timestamp(0, 1668792433)]
+RESULT: true
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/eq_numeric.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/eq_numeric.txt
new file mode 100644
index 00000000000..d4e31976424
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/eq_numeric.txt
@@ -0,0 +1,155 @@
+# Golden test output of SBEPrimBinaryTest/EqNumeric
+-- INPUT EXPRESSION:
+(s1 == s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: eq(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 23]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123ll]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123.500000L]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 23]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123ll]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123.500000L]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 23]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123ll]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123.500000L]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 23]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123ll]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123.500000L]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 23]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123ll]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123.500000L]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 23]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123ll]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123.500000L]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/eq_string.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/eq_string.txt
new file mode 100644
index 00000000000..8c8a84b474c
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/eq_string.txt
@@ -0,0 +1,312 @@
+# Golden test output of SBEPrimBinaryTest/EqString
+-- INPUT EXPRESSION:
+(s1 ==[s3] s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x001f]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: pushAccessVal(accessor: <accessor>);
+0x001b: collEq(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0, popColl: 1, offsetColl: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/fill_empty.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/fill_empty.txt
new file mode 100644
index 00000000000..48c7908d7dd
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/fill_empty.txt
@@ -0,0 +1,77 @@
+# Golden test output of SBEPrimBinaryTest/FillEmpty
+-- INPUT EXPRESSION:
+(s1 ?: s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x001d]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: jmpNothing(target: 0x0013);
+0x000e: jmp(target: 0x001d);
+0x0013: pop();
+0x0014: pushAccessVal(accessor: <accessor>);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: null]
+RESULT: null
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: false]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: true]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Nothing]
+RESULT: null
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: null]
+RESULT: null
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: false]
+RESULT: null
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: true]
+RESULT: null
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Nothing]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: null]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: false]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: true]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Nothing]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: null]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: false]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: true
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/fill_empty_with_constant.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/fill_empty_with_constant.txt
new file mode 100644
index 00000000000..75356636101
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/fill_empty_with_constant.txt
@@ -0,0 +1,108 @@
+# Golden test output of SBEPrimBinaryTest/FillEmptyWithConstant
+== VARIATION rhs constant: Nothing
+-- INPUT EXPRESSION:
+(s1 ?: Nothing)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x001e]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: jmpNothing(target: 0x0013);
+0x000e: jmp(target: 0x001e);
+0x0013: pop();
+0x0014: pushConstVal(value: Nothing);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null]
+RESULT: null
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true]
+RESULT: true
+
+== VARIATION rhs constant: null
+-- INPUT EXPRESSION:
+(s2 ?: null)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000b]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: fillEmptyImm(k: Null);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: null
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: null]
+RESULT: null
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: true
+
+== VARIATION rhs constant: true
+-- INPUT EXPRESSION:
+(s3 ?: true)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000b]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: fillEmptyImm(k: True);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Nothing]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: null, 3: null]
+RESULT: null
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true, 3: true]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true, 3: true]
+RESULT: true
+
+== VARIATION rhs constant: true
+-- INPUT EXPRESSION:
+(s4 ?: true)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000b]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: fillEmptyImm(k: True);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Nothing, 4: Nothing]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: null, 3: null, 4: null]
+RESULT: null
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true, 3: true, 4: true]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true, 3: true, 4: true]
+RESULT: true
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_eq_mixed.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_eq_mixed.txt
new file mode 100644
index 00000000000..a5d9a6f475e
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_eq_mixed.txt
@@ -0,0 +1,267 @@
+# Golden test output of SBEPrimBinaryTest/GreaterEqMixed
+-- INPUT EXPRESSION:
+(s1 >= s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: greaterEq(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: null]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: false]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: true]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: false]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc"]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Timestamp(0, 1668792433)]
+RESULT: true
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_eq_numeric.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_eq_numeric.txt
new file mode 100644
index 00000000000..c659666c713
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_eq_numeric.txt
@@ -0,0 +1,155 @@
+# Golden test output of SBEPrimBinaryTest/GreaterEqNumeric
+-- INPUT EXPRESSION:
+(s1 >= s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: greaterEq(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 23]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123ll]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123.500000L]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 23]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123ll]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123.500000L]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 23]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123ll]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123.500000L]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 23]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123ll]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123.500000L]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 23]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123ll]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123.500000L]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 23]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123ll]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123.500000L]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_eq_string.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_eq_string.txt
new file mode 100644
index 00000000000..cbe934c5069
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_eq_string.txt
@@ -0,0 +1,312 @@
+# Golden test output of SBEPrimBinaryTest/GreaterEqString
+-- INPUT EXPRESSION:
+(s1 >=[s3] s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x001f]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: pushAccessVal(accessor: <accessor>);
+0x001b: collGreaterEq(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0, popColl: 1, offsetColl: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_mixed.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_mixed.txt
new file mode 100644
index 00000000000..a45742ee565
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_mixed.txt
@@ -0,0 +1,267 @@
+# Golden test output of SBEPrimBinaryTest/GreaterMixed
+-- INPUT EXPRESSION:
+(s1 > s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: greater(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: null]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: false]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: true]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: false]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc"]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Timestamp(0, 1668792433)]
+RESULT: false
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_numeric.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_numeric.txt
new file mode 100644
index 00000000000..efee609318e
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_numeric.txt
@@ -0,0 +1,155 @@
+# Golden test output of SBEPrimBinaryTest/GreaterNumeric
+-- INPUT EXPRESSION:
+(s1 > s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: greater(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 23]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123ll]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123.500000L]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 23]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123ll]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123.500000L]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 23]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123ll]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123.500000L]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 23]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123ll]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123.500000L]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 23]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123ll]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123.500000L]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 23]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123ll]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123.500000L]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_string.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_string.txt
new file mode 100644
index 00000000000..6b29bb1e035
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/greater_string.txt
@@ -0,0 +1,312 @@
+# Golden test output of SBEPrimBinaryTest/GreaterString
+-- INPUT EXPRESSION:
+(s1 >[s3] s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x001f]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: pushAccessVal(accessor: <accessor>);
+0x001b: collGreater(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0, popColl: 1, offsetColl: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_eq_mixed.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_eq_mixed.txt
new file mode 100644
index 00000000000..e9884a5aee2
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_eq_mixed.txt
@@ -0,0 +1,267 @@
+# Golden test output of SBEPrimBinaryTest/LessEqMixed
+-- INPUT EXPRESSION:
+(s1 <= s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: lessEq(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: null]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: false]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: true]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: false]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc"]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Timestamp(0, 1668792433)]
+RESULT: true
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_eq_numeric.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_eq_numeric.txt
new file mode 100644
index 00000000000..4d5a732442b
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_eq_numeric.txt
@@ -0,0 +1,155 @@
+# Golden test output of SBEPrimBinaryTest/LessEqNumeric
+-- INPUT EXPRESSION:
+(s1 <= s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: lessEq(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 23]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123ll]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123.500000L]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 23]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123ll]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123.500000L]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 23]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123ll]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123.500000L]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 23]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123ll]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123.500000L]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 23]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123ll]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123.500000L]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 23]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123ll]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123.500000L]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_eq_string.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_eq_string.txt
new file mode 100644
index 00000000000..5babaa80c6b
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_eq_string.txt
@@ -0,0 +1,312 @@
+# Golden test output of SBEPrimBinaryTest/LessEqString
+-- INPUT EXPRESSION:
+(s1 <=[s3] s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x001f]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: pushAccessVal(accessor: <accessor>);
+0x001b: collLessEq(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0, popColl: 1, offsetColl: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_mixed.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_mixed.txt
new file mode 100644
index 00000000000..3d617227507
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_mixed.txt
@@ -0,0 +1,267 @@
+# Golden test output of SBEPrimBinaryTest/LessMixed
+-- INPUT EXPRESSION:
+(s1 < s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: less(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: null]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: false]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: true]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: false]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc"]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Timestamp(0, 1668792433)]
+RESULT: false
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_numeric.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_numeric.txt
new file mode 100644
index 00000000000..f272ffe99e7
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_numeric.txt
@@ -0,0 +1,155 @@
+# Golden test output of SBEPrimBinaryTest/LessNumeric
+-- INPUT EXPRESSION:
+(s1 < s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: less(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 23]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123ll]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123.500000L]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 23]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123ll]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123.500000L]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 23]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123ll]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123.500000L]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 23]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123ll]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123.500000L]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 23]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123ll]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123.500000L]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 23]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123ll]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123.500000L]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_string.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_string.txt
new file mode 100644
index 00000000000..a35a089c5df
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/less_string.txt
@@ -0,0 +1,312 @@
+# Golden test output of SBEPrimBinaryTest/LessString
+-- INPUT EXPRESSION:
+(s1 <[s3] s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x001f]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: pushAccessVal(accessor: <accessor>);
+0x001b: collLess(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0, popColl: 1, offsetColl: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/mul_mixed.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/mul_mixed.txt
new file mode 100644
index 00000000000..745071fe431
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/mul_mixed.txt
@@ -0,0 +1,267 @@
+# Golden test output of SBEPrimBinaryTest/MulMixed
+-- INPUT EXPRESSION:
+(s1 * s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: mul(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: 144
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(2682.000000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: NumberDecimal(2682.000000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(49952.250000000000000000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/mul_numeric.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/mul_numeric.txt
new file mode 100644
index 00000000000..3b2f59e35e1
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/mul_numeric.txt
@@ -0,0 +1,155 @@
+# Golden test output of SBEPrimBinaryTest/MulNumeric
+-- INPUT EXPRESSION:
+(s1 * s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: mul(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 23]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123ll]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123.500000L]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: 144
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 23]
+RESULT: 276
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123ll]
+RESULT: 1476ll
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123.500000L]
+RESULT: 1482.000000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(2682.000000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 12]
+RESULT: 276
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 23]
+RESULT: 529
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123ll]
+RESULT: 2829ll
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123.500000L]
+RESULT: 2840.500000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(5140.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 12]
+RESULT: 1476ll
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 23]
+RESULT: 2829ll
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123ll]
+RESULT: 15129ll
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123.500000L]
+RESULT: 15190.500000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(27490.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 12]
+RESULT: 1482.000000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 23]
+RESULT: 2840.500000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123ll]
+RESULT: 15190.500000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123.500000L]
+RESULT: 15252.250000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(27602.250000000000000000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: NumberDecimal(2682.000000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 23]
+RESULT: NumberDecimal(5140.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123ll]
+RESULT: NumberDecimal(27490.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123.500000L]
+RESULT: NumberDecimal(27602.250000000000000000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(49952.250000000000000000000000)
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/neq_mixed.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/neq_mixed.txt
new file mode 100644
index 00000000000..c1aa5c134f3
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/neq_mixed.txt
@@ -0,0 +1,267 @@
+# Golden test output of SBEPrimBinaryTest/NeqMixed
+-- INPUT EXPRESSION:
+(s1 != s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: neq(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: null]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: false]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: true]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: false]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc"]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Timestamp(0, 1668792433)]
+RESULT: false
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/neq_numeric.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/neq_numeric.txt
new file mode 100644
index 00000000000..d2900d64212
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/neq_numeric.txt
@@ -0,0 +1,155 @@
+# Golden test output of SBEPrimBinaryTest/NeqNumeric
+-- INPUT EXPRESSION:
+(s1 != s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: neq(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 23]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123ll]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123.500000L]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 23]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123ll]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123.500000L]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 23]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123ll]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123.500000L]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 23]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123ll]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123.500000L]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 23]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123ll]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123.500000L]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: NumberDecimal(223.500000000000)]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 23]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123ll]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123.500000L]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: false
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/neq_string.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/neq_string.txt
new file mode 100644
index 00000000000..f25b52ea538
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/neq_string.txt
@@ -0,0 +1,312 @@
+# Golden test output of SBEPrimBinaryTest/NeqString
+-- INPUT EXPRESSION:
+(s1 !=[s3] s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x001f]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: pushAccessVal(accessor: <accessor>);
+0x001b: collNeq(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0, popColl: 1, offsetColl: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABC", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abcdefghijkop", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: Nothing, 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abc", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABC", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "abcdefghijkop", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_always_equal", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "ABCDEFGHIJKOP", 2: "ABCDEFGHIJKOP", 3: Collator({"locale" : "mock_to_lower_string", "caseLevel" : false, "caseFirst" : "off", "strength" : 3, "numericOrdering" : false, "alternate" : "non-ignorable", "maxVariable" : "punct", "normalization" : false, "backwards" : false, "version" : "mock_version"})]
+RESULT: false
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/sub_mixed.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/sub_mixed.txt
new file mode 100644
index 00000000000..799febcef6a
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/sub_mixed.txt
@@ -0,0 +1,267 @@
+# Golden test output of SBEPrimBinaryTest/SubMixed
+-- INPUT EXPRESSION:
+(s1 - s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: sub(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(-211.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: NumberDecimal(211.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(0E-12)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc", 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433), 2: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/sub_numeric.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/sub_numeric.txt
new file mode 100644
index 00000000000..e76850369b5
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_binary_test/sub_numeric.txt
@@ -0,0 +1,155 @@
+# Golden test output of SBEPrimBinaryTest/SubNumeric
+-- INPUT EXPRESSION:
+(s1 - s2)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0015]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: pushAccessVal(accessor: <accessor>);
+0x0012: sub(popLhs: 1, offsetLhs: 0, popRhs: 1, offsetRhs: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 23]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123ll]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: 123.500000L]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing, 2: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 12]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 23]
+RESULT: -11
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123ll]
+RESULT: -111ll
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: 123.500000L]
+RESULT: -111.500000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(-211.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 12]
+RESULT: 11
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 23]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123ll]
+RESULT: -100ll
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: 123.500000L]
+RESULT: -100.500000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(-200.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 12]
+RESULT: 111ll
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 23]
+RESULT: 100ll
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123ll]
+RESULT: 0ll
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: 123.500000L]
+RESULT: -0.500000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(-100.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 12]
+RESULT: 111.500000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 23]
+RESULT: 100.500000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123ll]
+RESULT: 0.500000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: 123.500000L]
+RESULT: 0.000000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L, 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(-100.000000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 12]
+RESULT: NumberDecimal(211.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 23]
+RESULT: NumberDecimal(200.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123ll]
+RESULT: NumberDecimal(100.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: 123.500000L]
+RESULT: NumberDecimal(100.000000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000), 2: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(0E-12)
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_unary_test/logic_not_bool.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_unary_test/logic_not_bool.txt
new file mode 100644
index 00000000000..b190a8bd42d
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_unary_test/logic_not_bool.txt
@@ -0,0 +1,22 @@
+# Golden test output of SBEPrimUnaryTest/LogicNotBool
+-- INPUT EXPRESSION:
+!(s1)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000b]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: logicNot(popParam: 1, offsetParam: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true]
+RESULT: false
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_unary_test/logic_not_mixed.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_unary_test/logic_not_mixed.txt
new file mode 100644
index 00000000000..7df4fa4fc52
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_unary_test/logic_not_mixed.txt
@@ -0,0 +1,42 @@
+# Golden test output of SBEPrimUnaryTest/LogicNotMixed
+-- INPUT EXPRESSION:
+!(s1)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000b]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: logicNot(popParam: 1, offsetParam: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true]
+RESULT: false
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000)]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_unary_test/negate_mixed.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_unary_test/negate_mixed.txt
new file mode 100644
index 00000000000..7005c2f8548
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_unary_test/negate_mixed.txt
@@ -0,0 +1,42 @@
+# Golden test output of SBEPrimUnaryTest/NegateMixed
+-- INPUT EXPRESSION:
+-(s1)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000b]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: negate(popParam: 1, offsetParam: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: null]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: false]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12]
+RESULT: -12
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(-223.500000000000)
+
+-- EXECUTE VARIATION:
+SLOTS: [1: "abc"]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Timestamp(0, 1668792433)]
+RESULT: Nothing
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_prim_unary_test/negate_numeric.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_unary_test/negate_numeric.txt
new file mode 100644
index 00000000000..96e3bf54d76
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_prim_unary_test/negate_numeric.txt
@@ -0,0 +1,38 @@
+# Golden test output of SBEPrimUnaryTest/NegateNumeric
+-- INPUT EXPRESSION:
+-(s1)
+
+-- COMPILED EXPRESSION:
+[0x0000-0x000b]
+0x0000: pushAccessVal(accessor: <accessor>);
+0x0009: negate(popParam: 1, offsetParam: 0);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 0]
+RESULT: 0
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 12]
+RESULT: -12
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 23]
+RESULT: -23
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123ll]
+RESULT: -123ll
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123.500000L]
+RESULT: -123.500000L
+
+-- EXECUTE VARIATION:
+SLOTS: [1: NumberDecimal(223.500000000000)]
+RESULT: NumberDecimal(-223.500000000000)
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_variable_test/local_variable.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_variable_test/local_variable.txt
new file mode 100644
index 00000000000..72614a4406b
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_variable_test/local_variable.txt
@@ -0,0 +1,22 @@
+# Golden test output of SBEVariableTest/LocalVariable
+-- INPUT EXPRESSION:
+
+ let [
+ l10.0 = "abcdeghijklmnop"
+ ]
+ in newArray(l10.0, l10.0)
+
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0019]
+0x0000: pushConstVal(value: "abcdeghijklmnop");
+0x000a: pushLocalVal(arg: 0);
+0x000f: pushLocalVal(arg: 1);
+0x0014: functionSmall(f: newArray, arity: 2);
+0x0017: swap();
+0x0018: pop();
+
+
+-- EXECUTE VARIATION:
+RESULT: ["abcdeghijklmnop", "abcdeghijklmnop"]
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_variable_test/local_variable_move.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_variable_test/local_variable_move.txt
new file mode 100644
index 00000000000..baf2548aca2
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_variable_test/local_variable_move.txt
@@ -0,0 +1,22 @@
+# Golden test output of SBEVariableTest/LocalVariableMove
+-- INPUT EXPRESSION:
+
+ let [
+ l10.0 = "abcdeghijklmnop"
+ ]
+ in newArray(move(l10.0), move(l10.0))
+
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0019]
+0x0000: pushConstVal(value: "abcdeghijklmnop");
+0x000a: pushMoveLocalVal(arg: 0);
+0x000f: pushMoveLocalVal(arg: 1);
+0x0014: functionSmall(f: newArray, arity: 2);
+0x0017: swap();
+0x0018: pop();
+
+
+-- EXECUTE VARIATION:
+RESULT: ["abcdeghijklmnop"]
+
diff --git a/src/mongo/db/test_output/exec/sbe/s_b_e_variable_test/slot_variable.txt b/src/mongo/db/test_output/exec/sbe/s_b_e_variable_test/slot_variable.txt
new file mode 100644
index 00000000000..1f1204f22c9
--- /dev/null
+++ b/src/mongo/db/test_output/exec/sbe/s_b_e_variable_test/slot_variable.txt
@@ -0,0 +1,21 @@
+# Golden test output of SBEVariableTest/SlotVariable
+-- INPUT EXPRESSION:
+s1
+
+-- COMPILED EXPRESSION:
+[0x0000-0x0009]
+0x0000: pushAccessVal(accessor: <accessor>);
+
+
+-- EXECUTE VARIATION:
+SLOTS: [1: Nothing]
+RESULT: Nothing
+
+-- EXECUTE VARIATION:
+SLOTS: [1: true]
+RESULT: true
+
+-- EXECUTE VARIATION:
+SLOTS: [1: 123]
+RESULT: 123
+