Skip to content

Commit

Permalink
gpu: jit: invert cmp instructions when required
Browse files Browse the repository at this point in the history
  • Loading branch information
kealan-barbieri authored and karturov committed Feb 9, 2023
1 parent 41e8612 commit 068893e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/gpu/jit/codegen/codegen.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2022 Intel Corporation
* Copyright 2022-2023 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -1072,9 +1072,15 @@ class expr_evaluator_t : public ir_visitor_t {
case op_kind_t::_ne: {
ir_assert(!dst.is_negated()) << "Destination can't be negated.";
ngen::InstructionModifier cmp_mod = mod;
cmp_mod |= cmp_op_to_ngen(obj.op_kind);
cmp_mod |= dst.flag_register();
host_->ecmp(cmp_mod, src0, src1);
if (!src0.is_reg_data()) {
cmp_mod |= cmp_op_to_ngen(negate_cmp_op(obj.op_kind));
cmp_mod |= dst.flag_register();
host_->ecmp(cmp_mod, src1, src0);
} else {
cmp_mod |= cmp_op_to_ngen(obj.op_kind);
cmp_mod |= dst.flag_register();
host_->ecmp(cmp_mod, src0, src1);
}
break;
}
case op_kind_t::_and: host_->eand(mod, dst, src0, src1); break;
Expand Down

0 comments on commit 068893e

Please sign in to comment.