]> granicus.if.org Git - yasm/commitdiff
Make CPU feature flags and registers case insensitive again.
authorPeter Johnson <peter@tortall.net>
Mon, 17 Sep 2007 02:58:05 +0000 (02:58 -0000)
committerPeter Johnson <peter@tortall.net>
Mon, 17 Sep 2007 02:58:05 +0000 (02:58 -0000)
This was accidentally removed in [1929].
Add test case for these so it doesn't happen again.

svn path=/trunk/yasm/; revision=1955

modules/arch/x86/tests/Makefile.inc
modules/arch/x86/tests/mixcase.asm [new file with mode: 0644]
modules/arch/x86/tests/mixcase.hex [new file with mode: 0644]
modules/arch/x86/x86cpu.gperf
modules/arch/x86/x86regtmod.gperf

index 60406bfcb1e1322de4536c4f0a29f01508038ccd..c513ad17bd948ba8eccc7412aa281460daad2905 100644 (file)
@@ -84,6 +84,8 @@ EXTRA_DIST += modules/arch/x86/tests/mem64hi32.asm
 EXTRA_DIST += modules/arch/x86/tests/mem64hi32.hex
 EXTRA_DIST += modules/arch/x86/tests/mem64rip.asm
 EXTRA_DIST += modules/arch/x86/tests/mem64rip.hex
+EXTRA_DIST += modules/arch/x86/tests/mixcase.asm
+EXTRA_DIST += modules/arch/x86/tests/mixcase.hex
 EXTRA_DIST += modules/arch/x86/tests/movdq32.asm
 EXTRA_DIST += modules/arch/x86/tests/movdq32.hex
 EXTRA_DIST += modules/arch/x86/tests/movdq64.asm
diff --git a/modules/arch/x86/tests/mixcase.asm b/modules/arch/x86/tests/mixcase.asm
new file mode 100644 (file)
index 0000000..4964e72
--- /dev/null
@@ -0,0 +1,3 @@
+CPU SSE5
+MOV AX,5
+
diff --git a/modules/arch/x86/tests/mixcase.hex b/modules/arch/x86/tests/mixcase.hex
new file mode 100644 (file)
index 0000000..76dc00b
--- /dev/null
@@ -0,0 +1,3 @@
+b8 
+05 
+00 
index 3597b535982b3fc808e1ecb48710d64e4b2c0832..5878a9176f5e0a26f2c70e5b1743a4ea5592fa02 100644 (file)
@@ -332,12 +332,16 @@ yasm_x86__parse_cpu(yasm_arch_x86 *arch_x86, const char *cpuid,
 {
     /*@null@*/ const struct cpu_parse_data *pdata;
     wordptr new_cpu;
-    unsigned int i;
+    size_t i;
+    static char lcaseid[16];
 
     if (cpuid_len > 15)
         return;
+    for (i=0; i<cpuid_len; i++)
+        lcaseid[i] = tolower(cpuid[i]);
+    lcaseid[cpuid_len] = '\0';
 
-    pdata = cpu_find(cpuid, cpuid_len);
+    pdata = cpu_find(lcaseid, cpuid_len);
     if (!pdata) {
         yasm_warn_set(YASM_WARN_GENERAL,
                       N_("unrecognized CPU identifier `%s'"), cpuid);
index e9d2ac9c7dece764b687f982bbe4a4b7d47e79c5..e3d0a89e24e822ef0c2796a61340d67f993a54ed 100644 (file)
@@ -241,13 +241,18 @@ yasm_x86__parse_check_regtmod(yasm_arch *arch, const char *id, size_t id_len,
 {
     yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch;
     /*@null@*/ const struct regtmod_parse_data *pdata;
+    size_t i;
+    static char lcaseid[8];
     unsigned int bits;
     yasm_arch_regtmod type;
 
     if (id_len > 7)
         return YASM_ARCH_NOTREGTMOD;
+    for (i=0; i<id_len; i++)
+        lcaseid[i] = tolower(id[i]);
+    lcaseid[id_len] = '\0';
 
-    pdata = regtmod_find(id, id_len);
+    pdata = regtmod_find(lcaseid, id_len);
     if (!pdata)
         return YASM_ARCH_NOTREGTMOD;