internal/simdgen: remove non-masked 128/256-bit AVX512 comparisons

If we intend to emulate these on AVX2, and also give them the
"good names", then we can't use those same names for AVX512 versions
of the comparisons.

Generates dev.simd CL 692335

Change-Id: I4e814b4de42cea38fb6e81c293a21cc56f45c13e
Reviewed-on: https://go-review.googlesource.com/c/arch/+/692355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
diff --git a/internal/simdgen/main.go b/internal/simdgen/main.go
index 69eb85f..a7f0b0d 100644
--- a/internal/simdgen/main.go
+++ b/internal/simdgen/main.go
@@ -250,7 +250,7 @@
 		}
 
 		if !def.Exact() {
-			fmt.Fprintf(os.Stderr, "%s: def not reduced to an exact value:\n", def.PosString())
+			fmt.Fprintf(os.Stderr, "%s: def not reduced to an exact value, why is %s:\n", def.PosString(), def.WhyNotExact())
 			fmt.Fprintf(os.Stderr, "\t%s\n", strings.ReplaceAll(def.String(), "\n", "\n\t"))
 		}
 
diff --git a/internal/simdgen/ops/Compares/go.yaml b/internal/simdgen/ops/Compares/go.yaml
index a8e2368..0f91628 100644
--- a/internal/simdgen/ops/Compares/go.yaml
+++ b/internal/simdgen/ops/Compares/go.yaml
@@ -36,6 +36,8 @@
     overwriteElementBits: 64
     overwriteClass: mask
     overwriteBase: int
+
+# TODO these are redundant with VPCMP operations.
 # AVX-512 compares produce masks.
 - go: Equal
   asm: "V?PCMPEQ[BWDQ]"
@@ -51,21 +53,61 @@
   - *int
   out:
   - class: mask
-# The const imm predicated compares after AVX512, please see categories.yaml
-# for const imm specification.
+
+# MASKED signed comparisons for X/Y registers
+# unmasked would clash with emulations on AVX2
 - go: (Equal|Greater|Less|LessEqual|GreaterEqual|NotEqual)
   asm: "VPCMP[BWDQ]"
   in:
+  - &int
+    bits: (128|256)
+    go: $t
+    base: int
   - *int
+  - class: immediate
+    const: 0 # Just a placeholder, will be overwritten by const imm porting.
+  inVariant:
+  - class: mask
+  out:
+  - class: mask
+
+# MASKED unsigned comparisons for X/Y registers
+# unmasked would clash with emulations on AVX2
+- go: (Equal|Greater|Less|LessEqual|GreaterEqual|NotEqual)
+  asm: "VPCMPU[BWDQ]"
+  in:
+  - &uint
+    bits: (128|256)
+    go: $t
+    base: uint
+  - *uint
+  - class: immediate
+    const: 0
+  inVariant:
+  - class: mask
+  out:
+  - class: mask
+
+# masked/unmasked signed comparisons for Z registers
+- go: (Equal|Greater|Less|LessEqual|GreaterEqual|NotEqual)
+  asm: "VPCMP[BWDQ]"
+  in:
+  - &int
+    bits: 512
+    go: $t
+    base: int
   - *int
   - class: immediate
     const: 0 # Just a placeholder, will be overwritten by const imm porting.
   out:
   - class: mask
+
+# masked/unmasked unsigned comparisons for Z registers
 - go: (Equal|Greater|Less|LessEqual|GreaterEqual|NotEqual)
   asm: "VPCMPU[BWDQ]"
   in:
   - &uint
+    bits: 512
     go: $t
     base: uint
   - *uint
diff --git a/internal/unify/domain.go b/internal/unify/domain.go
index 5c4d349..1e0f2be 100644
--- a/internal/unify/domain.go
+++ b/internal/unify/domain.go
@@ -39,6 +39,7 @@
 //   - [Var] - A value captured in the environment.
 type Domain interface {
 	Exact() bool
+	WhyNotExact() string
 
 	// decode stores this value in a Go value. If this value is not exact, this
 	// returns a potentially wrapped *inexactError.
@@ -77,7 +78,8 @@
 // Top represents all possible values of all possible types.
 type Top struct{}
 
-func (t Top) Exact() bool { return false }
+func (t Top) Exact() bool         { return false }
+func (t Top) WhyNotExact() string { return "is top" }
 
 func (t Top) decode(rv reflect.Value) error {
 	// We can decode Top into a pointer-typed value as nil.
@@ -125,6 +127,17 @@
 	return true
 }
 
+// WhyNotExact returns why the value is not exact
+func (d Def) WhyNotExact() string {
+	for s, v := range d.fields {
+		if !v.Exact() {
+			w := v.WhyNotExact()
+			return "field " + s + ": " + w
+		}
+	}
+	return ""
+}
+
 func (d Def) decode(rv reflect.Value) error {
 	if rv.Kind() != reflect.Struct {
 		return fmt.Errorf("cannot decode Def into %s", rv.Type())
@@ -219,6 +232,19 @@
 	return true
 }
 
+func (d Tuple) WhyNotExact() string {
+	if d.repeat != nil {
+		return "d.repeat is not nil"
+	}
+	for i, v := range d.vs {
+		if !v.Exact() {
+			w := v.WhyNotExact()
+			return "index " + strconv.FormatInt(int64(i), 10) + ": " + w
+		}
+	}
+	return ""
+}
+
 func (d Tuple) decode(rv reflect.Value) error {
 	if d.repeat != nil {
 		return &inexactError{"repeated tuple", rv.Type().String()}
@@ -300,6 +326,13 @@
 	return d.kind == stringExact
 }
 
+func (d String) WhyNotExact() string {
+	if d.kind == stringExact {
+		return ""
+	}
+	return "string is not exact"
+}
+
 func (d String) decode(rv reflect.Value) error {
 	if d.kind != stringExact {
 		return &inexactError{"regex", rv.Type().String()}
diff --git a/internal/unify/env.go b/internal/unify/env.go
index 1200eb3..3331ff7 100644
--- a/internal/unify/env.go
+++ b/internal/unify/env.go
@@ -384,6 +384,11 @@
 	panic("Exact called on non-concrete Value")
 }
 
+func (d Var) WhyNotExact() string {
+	// These can't appear in concrete Values.
+	return "WhyNotExact called on non-concrete Value"
+}
+
 func (d Var) decode(rv reflect.Value) error {
 	return &inexactError{"var", rv.Type().String()}
 }
diff --git a/internal/unify/value.go b/internal/unify/value.go
index 87387bb..ffc25b8 100644
--- a/internal/unify/value.go
+++ b/internal/unify/value.go
@@ -69,6 +69,13 @@
 	return string(b)
 }
 
+func (v *Value) WhyNotExact() string {
+	if v.Domain == nil {
+		return "v.Domain is nil"
+	}
+	return v.Domain.WhyNotExact()
+}
+
 func (v *Value) Exact() bool {
 	if v.Domain == nil {
 		return false