nak: Add False and True to IntCmpOp
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34535>
This commit is contained in:
committed by
Marge Bot
parent
eb4fb70bae
commit
9c5a0eca95
@@ -540,6 +540,9 @@ pub trait SSABuilder: Builder {
|
||||
|
||||
let dst = self.alloc_ssa(RegFile::Pred, 1);
|
||||
match cmp_op {
|
||||
IntCmpOp::False | IntCmpOp::True => {
|
||||
panic!("These don't make sense for the builder helper");
|
||||
}
|
||||
IntCmpOp::Eq | IntCmpOp::Ne => {
|
||||
self.push_op(OpISetP {
|
||||
dst: dst.into(),
|
||||
|
||||
@@ -680,6 +680,8 @@ fn test_op_iadd3x() {
|
||||
fn test_op_isetp() {
|
||||
let set_ops = [PredSetOp::And, PredSetOp::Or, PredSetOp::Xor];
|
||||
let cmp_ops = [
|
||||
IntCmpOp::False,
|
||||
IntCmpOp::True,
|
||||
IntCmpOp::Eq,
|
||||
IntCmpOp::Ne,
|
||||
IntCmpOp::Lt,
|
||||
@@ -1211,6 +1213,8 @@ fn test_isetp64() {
|
||||
let x = x as i64;
|
||||
let y = y as i64;
|
||||
match cmp_op {
|
||||
IntCmpOp::False => false,
|
||||
IntCmpOp::True => true,
|
||||
IntCmpOp::Eq => x == y,
|
||||
IntCmpOp::Ne => x != y,
|
||||
IntCmpOp::Lt => x < y,
|
||||
@@ -1220,6 +1224,8 @@ fn test_isetp64() {
|
||||
}
|
||||
} else {
|
||||
match cmp_op {
|
||||
IntCmpOp::False => false,
|
||||
IntCmpOp::True => true,
|
||||
IntCmpOp::Eq => x == y,
|
||||
IntCmpOp::Ne => x != y,
|
||||
IntCmpOp::Lt => x < y,
|
||||
|
||||
@@ -1813,8 +1813,11 @@ impl fmt::Display for FloatCmpOp {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Clone, Copy, Eq, Hash, PartialEq)]
|
||||
pub enum IntCmpOp {
|
||||
False,
|
||||
True,
|
||||
Eq,
|
||||
Ne,
|
||||
Lt,
|
||||
@@ -1826,6 +1829,7 @@ pub enum IntCmpOp {
|
||||
impl IntCmpOp {
|
||||
pub fn flip(self) -> IntCmpOp {
|
||||
match self {
|
||||
IntCmpOp::False | IntCmpOp::True => self,
|
||||
IntCmpOp::Eq | IntCmpOp::Ne => self,
|
||||
IntCmpOp::Lt => IntCmpOp::Gt,
|
||||
IntCmpOp::Le => IntCmpOp::Ge,
|
||||
@@ -1838,6 +1842,8 @@ impl IntCmpOp {
|
||||
impl fmt::Display for IntCmpOp {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
IntCmpOp::False => write!(f, ".f"),
|
||||
IntCmpOp::True => write!(f, ".t"),
|
||||
IntCmpOp::Eq => write!(f, ".eq"),
|
||||
IntCmpOp::Ne => write!(f, ".ne"),
|
||||
IntCmpOp::Lt => write!(f, ".lt"),
|
||||
@@ -3769,6 +3775,8 @@ impl Foldable for OpISetP {
|
||||
let x = x as i32;
|
||||
let y = y as i32;
|
||||
match &self.cmp_op {
|
||||
IntCmpOp::False => false,
|
||||
IntCmpOp::True => true,
|
||||
IntCmpOp::Eq => x == y,
|
||||
IntCmpOp::Ne => x != y,
|
||||
IntCmpOp::Lt => x < y,
|
||||
@@ -3778,6 +3786,8 @@ impl Foldable for OpISetP {
|
||||
}
|
||||
} else {
|
||||
match &self.cmp_op {
|
||||
IntCmpOp::False => false,
|
||||
IntCmpOp::True => true,
|
||||
IntCmpOp::Eq => x == y,
|
||||
IntCmpOp::Ne => x != y,
|
||||
IntCmpOp::Lt => x < y,
|
||||
@@ -3787,7 +3797,9 @@ impl Foldable for OpISetP {
|
||||
}
|
||||
};
|
||||
|
||||
let cmp = if self.ex && x == y {
|
||||
let cmp_op_is_const =
|
||||
matches!(self.cmp_op, IntCmpOp::False | IntCmpOp::True);
|
||||
let cmp = if self.ex && x == y && !cmp_op_is_const {
|
||||
// Pre-Volta, isetp.x takes the accumulator into account. If we
|
||||
// want to support this, we need to take an an accumulator into
|
||||
// account. Disallow it for now.
|
||||
|
||||
@@ -844,6 +844,8 @@ impl SM50Encoder<'_> {
|
||||
self.set_field(
|
||||
range,
|
||||
match op {
|
||||
IntCmpOp::False => 0_u8,
|
||||
IntCmpOp::True => 7_u8,
|
||||
IntCmpOp::Eq => 2_u8,
|
||||
IntCmpOp::Ne => 5_u8,
|
||||
IntCmpOp::Lt => 1_u8,
|
||||
|
||||
@@ -827,6 +827,8 @@ impl SM70Encoder<'_> {
|
||||
self.set_field(
|
||||
range,
|
||||
match op {
|
||||
IntCmpOp::False => 0_u8,
|
||||
IntCmpOp::True => 7_u8,
|
||||
IntCmpOp::Eq => 2_u8,
|
||||
IntCmpOp::Ne => 5_u8,
|
||||
IntCmpOp::Lt => 1_u8,
|
||||
|
||||
Reference in New Issue
Block a user