From 268953e19f59634ca6c8c630c26a268868f11a18 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Fri, 19 Aug 2016 16:09:21 +0000
Subject: [PATCH] CPUID: Add IDs for Kaby Lake (unverified/untested)

---
 .../support/CPUInformation/IntelInfoImpl.java | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/core/java/src/freenet/support/CPUInformation/IntelInfoImpl.java b/core/java/src/freenet/support/CPUInformation/IntelInfoImpl.java
index 6343774807..eb6ec0fe31 100644
--- a/core/java/src/freenet/support/CPUInformation/IntelInfoImpl.java
+++ b/core/java/src/freenet/support/CPUInformation/IntelInfoImpl.java
@@ -461,6 +461,38 @@ class IntelInfoImpl extends CPUIDCPUInfo implements IntelCPUInfo
                         break;
                     }
 
+                // following are for extended model == 8 or 9
+                // most flags are set above
+                // isCoreiCompatible = true is the default
+
+                    // Kaby Lake
+                    // ref: https://github.com/InstLatx64/InstLatx64/commit/9d2ea1a9eb727868dc514900da9e2f175710f9bf
+                    // See Haswell notes above
+                    case 0x8e:
+                    case 0x9e: {
+                        CPUIDCPUInfo c = new CPUIDCPUInfo();
+                        if (c.hasAVX2() && c.hasBMI1()  && c.hasBMI2() &&
+                            c.hasFMA3() && c.hasMOVBE() && c.hasABM()) {
+                            isSandyCompatible = true;
+                            isIvyCompatible = true;
+                            isHaswellCompatible = true;
+                            if (c.hasADX())
+                                isBroadwellCompatible = true;
+                            modelString = "Kaby Lake Core i3/i5/i7";
+                        } else {
+                            // This processor is "corei" compatible, as we define it,
+                            // i.e. SSE4.2 but not necessarily AVX.
+                            if (c.hasAVX()) {
+                                isSandyCompatible = true;
+                                isIvyCompatible = true;
+                                modelString = "Kaby Lake Celeron/Pentium w/ AVX";
+                            } else {
+                                modelString = "Kaby Lake Celeron/Pentium";
+                            }
+                        }
+                        break;
+                    }
+
                     // others
                     default:
                         modelString = "Intel model " + model;
-- 
GitLab