diff --git a/lib/codeclib.c b/lib/codeclib.c
index 8bbef8435..fb327a593 100644
--- a/lib/codeclib.c
+++ b/lib/codeclib.c
@@ -1182,18 +1182,22 @@ bool rtpe_has_cpu_flag(enum rtpe_cpu_flag flag) {
 
 	if (!done) {
 #if defined(__x86_64__)
-		int32_t ebx_7h0h;
+		int32_t ebx_7h0h, edx_1h;
 
 		__asm (
+			"mov $1, %%eax"		"\n\t"
+			"cpuid"			"\n\t"
+			"mov %%edx, %1"		"\n\t"
 			"mov $7, %%eax"		"\n\t"
 			"xor %%ecx, %%ecx"	"\n\t"
 			"cpuid"			"\n\t"
 			"mov %%ebx, %0"		"\n\t"
-			: "=rm" (ebx_7h0h)
+			: "=rm" (ebx_7h0h), "=rm" (edx_1h)
 			:
 			: "eax", "ebx", "ecx", "edx"
 		    );
 
+		cpu_flags[RTPE_CPU_FLAG_SSE2]      = !!(edx_1h   & (1L << 26));
 		cpu_flags[RTPE_CPU_FLAG_AVX2]      = !!(ebx_7h0h & (1L << 5));
 		cpu_flags[RTPE_CPU_FLAG_AVX512BW]  = !!(ebx_7h0h & (1L << 30));
 		cpu_flags[RTPE_CPU_FLAG_AVX512F]   = !!(ebx_7h0h & (1L << 16));
diff --git a/lib/codeclib.h b/lib/codeclib.h
index 3eab0046b..4d6fb523a 100644
--- a/lib/codeclib.h
+++ b/lib/codeclib.h
@@ -65,6 +65,7 @@ enum rtpe_cpu_flag {
 	RTPE_CPU_FLAG_AVX2 = 0,
 	RTPE_CPU_FLAG_AVX512BW,
 	RTPE_CPU_FLAG_AVX512F,
+	RTPE_CPU_FLAG_SSE2,
 
 	__NUM_RTPE_CPU_FLAGS
 };