Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/hotspot/share/opto/addnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,22 @@ const Type *OrLNode::add_ring( const Type *t0, const Type *t1 ) const {
}

//=============================================================================

const Type* XorINode::Value(PhaseGVN* phase) const {
Node* in1 = in(1);
Node* in2 = in(2);
const Type* t1 = phase->type(in1);
const Type* t2 = phase->type(in2);
if (t1 == Type::TOP || t2 == Type::TOP) {
return Type::TOP;
}
// x ^ x ==> 0
if (in1->eqv_uncast(in2)) {
return add_id();
}
return AddNode::Value(phase);
}

//------------------------------add_ring---------------------------------------
// Supplied function returns the sum of the inputs IN THE CURRENT RING. For
// the logical operations the ring's ADD is really a logical OR function.
Expand Down Expand Up @@ -948,6 +964,20 @@ const Type *XorLNode::add_ring( const Type *t0, const Type *t1 ) const {
return TypeLong::make( r0->get_con() ^ r1->get_con() );
}

const Type* XorLNode::Value(PhaseGVN* phase) const {
Node* in1 = in(1);
Node* in2 = in(2);
const Type* t1 = phase->type(in1);
const Type* t2 = phase->type(in2);
if (t1 == Type::TOP || t2 == Type::TOP) {
return Type::TOP;
}
// x ^ x ==> 0
if (in1->eqv_uncast(in2)) {
return add_id();
}
return AddNode::Value(phase);
}

Node* MaxNode::build_min_max(Node* a, Node* b, bool is_max, bool is_unsigned, const Type* t, PhaseGVN& gvn) {
bool is_int = gvn.type(a)->isa_int();
Expand Down
4 changes: 3 additions & 1 deletion src/hotspot/share/opto/addnode.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -212,6 +212,7 @@ class XorINode : public AddNode {
virtual const Type *add_ring( const Type *, const Type * ) const;
virtual const Type *add_id() const { return TypeInt::ZERO; }
virtual const Type *bottom_type() const { return TypeInt::INT; }
virtual const Type *Value(PhaseGVN *phase) const;
virtual uint ideal_reg() const { return Op_RegI; }
};

Expand All @@ -224,6 +225,7 @@ class XorLNode : public AddNode {
virtual const Type *add_ring( const Type *, const Type * ) const;
virtual const Type *add_id() const { return TypeLong::ZERO; }
virtual const Type *bottom_type() const { return TypeLong::LONG; }
virtual const Type *Value(PhaseGVN *phase) const;
virtual uint ideal_reg() const { return Op_RegL; }
};

Expand Down