Merge "Introduce new Arm64 arch variant with dot product features"
diff --git a/android/arch.go b/android/arch.go
index 8500bc7..4141138 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -125,6 +125,7 @@
 	Arm64: {
 		"armv8_a",
 		"armv8_2a",
+		"armv8-2a-dotprod",
 		"cortex-a53",
 		"cortex-a55",
 		"cortex-a72",
@@ -172,6 +173,9 @@
 	Arm: {
 		"neon",
 	},
+	Arm64: {
+		"dotprod",
+	},
 	X86: {
 		"ssse3",
 		"sse4",
@@ -209,6 +213,11 @@
 			"neon",
 		},
 	},
+	Arm64: {
+		"armv8-2a-dotprod": {
+			"dotprod",
+		},
+	},
 	X86: {
 		"amberlake": {
 			"ssse3",
@@ -1628,9 +1637,10 @@
 		{"arm64", "armv8-a", "kryo", []string{"arm64-v8a"}},
 		{"arm64", "armv8-a", "exynos-m1", []string{"arm64-v8a"}},
 		{"arm64", "armv8-a", "exynos-m2", []string{"arm64-v8a"}},
-		{"arm64", "armv8-2a", "cortex-a75", []string{"arm64-v8a"}},
-		{"arm64", "armv8-2a", "cortex-a76", []string{"arm64-v8a"}},
 		{"arm64", "armv8-2a", "kryo385", []string{"arm64-v8a"}},
+		{"arm64", "armv8-2a-dotprod", "cortex-a55", []string{"arm64-v8a"}},
+		{"arm64", "armv8-2a-dotprod", "cortex-a75", []string{"arm64-v8a"}},
+		{"arm64", "armv8-2a-dotprod", "cortex-a76", []string{"arm64-v8a"}},
 		{"x86", "", "", []string{"x86"}},
 		{"x86", "atom", "", []string{"x86"}},
 		{"x86", "haswell", "", []string{"x86"}},
diff --git a/cc/config/arm64_device.go b/cc/config/arm64_device.go
index 62d8cc8..e6024aa 100644
--- a/cc/config/arm64_device.go
+++ b/cc/config/arm64_device.go
@@ -34,6 +34,9 @@
 		"armv8-2a": []string{
 			"-march=armv8.2-a",
 		},
+		"armv8-2a-dotprod": []string{
+			"-march=armv8.2-a+dotprod",
+		},
 	}
 
 	arm64Ldflags = []string{
@@ -100,6 +103,7 @@
 
 	pctx.StaticVariable("Arm64ClangArmv8ACflags", strings.Join(arm64ArchVariantCflags["armv8-a"], " "))
 	pctx.StaticVariable("Arm64ClangArmv82ACflags", strings.Join(arm64ArchVariantCflags["armv8-2a"], " "))
+	pctx.StaticVariable("Arm64ClangArmv82ADotprodCflags", strings.Join(arm64ArchVariantCflags["armv8-2a-dotprod"], " "))
 
 	pctx.StaticVariable("Arm64ClangCortexA53Cflags",
 		strings.Join(arm64ClangCpuVariantCflags["cortex-a53"], " "))
@@ -121,6 +125,7 @@
 	arm64ClangArchVariantCflagsVar = map[string]string{
 		"armv8-a":  "${config.Arm64ClangArmv8ACflags}",
 		"armv8-2a": "${config.Arm64ClangArmv82ACflags}",
+		"armv8-2a-dotprod": "${config.Arm64ClangArmv82ADotprodCflags}",
 	}
 
 	arm64ClangCpuVariantCflagsVar = map[string]string{
@@ -198,6 +203,7 @@
 	switch arch.ArchVariant {
 	case "armv8-a":
 	case "armv8-2a":
+	case "armv8-2a-dotprod":
 		// Nothing extra for armv8-a/armv8-2a
 	default:
 		panic(fmt.Sprintf("Unknown ARM architecture version: %q", arch.ArchVariant))
diff --git a/rust/config/arm64_device.go b/rust/config/arm64_device.go
index 7d13c42..21b22a4 100644
--- a/rust/config/arm64_device.go
+++ b/rust/config/arm64_device.go
@@ -28,6 +28,7 @@
 	Arm64ArchVariantRustFlags = map[string][]string{
 		"armv8-a":  []string{},
 		"armv8-2a": []string{},
+		"armv8-2a-dotprod": []string{},
 	}
 )