summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1d9ab25)
raw | patch | inline | side by side (parent: 1d9ab25)
author | David Woodhouse <dwmw2@infradead.org> | |
Mon, 20 Jan 2014 12:02:25 +0000 (12:02 +0000) | ||
committer | David Woodhouse <dwmw2@infradead.org> | |
Mon, 20 Jan 2014 12:02:25 +0000 (12:02 +0000) |
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199648 91177308-0d34-0410-b5e6-96231b3b80d8
index 314ee4e3589bd593b77a6d0daf960560d0833f27..cfc9e3d3ed5c26d3829e9751666f26e2b6d997f3 100644 (file)
GNUEABI,
GNUEABIHF,
GNUX32,
+ CODE16,
EABI,
EABIHF,
MachO,
diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp
index 273316a0a6f9ca7fc4b673d24c72b5b0b289fdcb..1947f43aa11a3bc905967d7ada3fa0fd0e98c5c3 100644 (file)
--- a/lib/Support/Triple.cpp
+++ b/lib/Support/Triple.cpp
case GNUEABIHF: return "gnueabihf";
case GNUEABI: return "gnueabi";
case GNUX32: return "gnux32";
+ case CODE16: return "code16";
case EABI: return "eabi";
case EABIHF: return "eabihf";
case MachO: return "macho";
.StartsWith("gnueabihf", Triple::GNUEABIHF)
.StartsWith("gnueabi", Triple::GNUEABI)
.StartsWith("gnux32", Triple::GNUX32)
+ .StartsWith("code16", Triple::CODE16)
.StartsWith("gnu", Triple::GNU)
.StartsWith("macho", Triple::MachO)
.StartsWith("android", Triple::Android)
diff --git a/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp b/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
index 9d5ff1027cd23a1256a26dbf46c8d0e2e2124118..fd79c6aea2e01039994704abe41ef31760164ffb 100644 (file)
std::string FS;
if (TheTriple.getArch() == Triple::x86_64)
FS = "+64bit-mode,-32bit-mode,-16bit-mode";
- else
+ else if (TheTriple.getEnvironment() != Triple::CODE16)
FS = "-64bit-mode,+32bit-mode,-16bit-mode";
+ else
+ FS = "-64bit-mode,-32bit-mode,+16bit-mode";
+
return FS;
}
index 6f724b42d977483c9ff2420dc4837c1a84adcd85..16161cfbd8f51e4914532e6e9f2bdafefa867626 100644 (file)
, TargetTriple(TT)
, StackAlignOverride(StackAlignOverride)
, In64BitMode(TargetTriple.getArch() == Triple::x86_64)
- , In32BitMode(TargetTriple.getArch() == Triple::x86)
- , In16BitMode(false) {
+ , In32BitMode(TargetTriple.getArch() == Triple::x86 &&
+ TargetTriple.getEnvironment() != Triple::CODE16)
+ , In16BitMode(TargetTriple.getArch() == Triple::x86 &&
+ TargetTriple.getEnvironment() == Triple::CODE16) {
initializeEnvironment();
resetSubtargetFeatures(CPU, FS);
}
diff --git a/test/MC/X86/ret.s b/test/MC/X86/ret.s
index fdb851523067db3088f66c8e0e1a455158cbf2cc..bac669b2561be6dcca64c4f841fdea18db1d73cd 100644 (file)
--- a/test/MC/X86/ret.s
+++ b/test/MC/X86/ret.s
// RUN: FileCheck --check-prefix=ERR64 < %t.err %s
// RUN: not llvm-mc -triple i386-unknown-unknown --show-encoding %s 2> %t.err | FileCheck --check-prefix=32 %s
// RUN: FileCheck --check-prefix=ERR32 < %t.err %s
-
+// RUN: not llvm-mc -triple i386-unknown-unknown-code16 --show-encoding %s 2> %t.err | FileCheck --check-prefix=16 %s
+// RUN: FileCheck --check-prefix=ERR16 < %t.err %s
ret
// 64: retq
// 64: encoding: [0xc3]
// 32: retl
// 32: encoding: [0xc3]
+// 16: retw
+// 16: encoding: [0xc3]
retw
// 64: retw
// 64: encoding: [0x66,0xc3]
// 32: retw
// 32: encoding: [0x66,0xc3]
+// 16: retw
+// 16: encoding: [0xc3]
retl
// ERR64: error: instruction requires: Not 64-bit mode
// 32: retl
// 32: encoding: [0xc3]
+// 16: retl
+// 16: encoding: [0x66,0xc3]
retq
// 64: retq
// 64: encoding: [0xc3]
// ERR32: error: instruction requires: 64-bit mode
+// ERR16: error: instruction requires: 64-bit mode
ret $0
// 64: retq $0
// 64: encoding: [0xc2,0x00,0x00]
// 32: retl $0
// 32: encoding: [0xc2,0x00,0x00]
+// 16: retw $0
+// 16: encoding: [0xc2,0x00,0x00]
retw $0
// 64: retw $0
// 64: encoding: [0x66,0xc2,0x00,0x00]
// 32: retw $0
// 32: encoding: [0x66,0xc2,0x00,0x00]
+// 16: retw $0
+// 16: encoding: [0xc2,0x00,0x00]
retl $0
// ERR64: error: instruction requires: Not 64-bit mode
// 32: retl $0
// 32: encoding: [0xc2,0x00,0x00]
+// 16: retl $0
+// 16: encoding: [0x66,0xc2,0x00,0x00]
retq $0
// 64: retq $0
// 64: encoding: [0xc2,0x00,0x00]
// ERR32: error: instruction requires: 64-bit mode
+// ERR16: error: instruction requires: 64-bit mode
lret
// 64: lretl
// 64: encoding: [0xcb]
// 32: lretl
// 32: encoding: [0xcb]
+// 16: lretw
+// 16: encoding: [0xcb]
lretw
// 64: lretw
// 64: encoding: [0x66,0xcb]
// 32: lretw
// 32: encoding: [0x66,0xcb]
+// 16: lretw
+// 16: encoding: [0xcb]
lretl
// 64: lretl
// 64: encoding: [0xcb]
// 32: lretl
// 32: encoding: [0xcb]
+// 16: lretl
+// 16: encoding: [0x66,0xcb]
lretq
// 64: lretq
// 64: encoding: [0x48,0xcb]
// ERR32: error: instruction requires: 64-bit mode
+// ERR16: error: instruction requires: 64-bit mode
lret $0
// 64: lretl $0
// 64: encoding: [0xca,0x00,0x00]
// 32: lretl $0
// 32: encoding: [0xca,0x00,0x00]
+// 16: lretw $0
+// 16: encoding: [0xca,0x00,0x00]
lretw $0
// 64: lretw $0
// 64: encoding: [0x66,0xca,0x00,0x00]
// 32: lretw $0
// 32: encoding: [0x66,0xca,0x00,0x00]
+// 16: lretw $0
+// 16: encoding: [0xca,0x00,0x00]
lretl $0
// 64: lretl $0
// 64: encoding: [0xca,0x00,0x00]
// 32: lretl $0
// 32: encoding: [0xca,0x00,0x00]
+// 16: lretl $0
+// 16: encoding: [0x66,0xca,0x00,0x00]
lretq $0
// 64: lretq $0
// 64: encoding: [0x48,0xca,0x00,0x00]
// ERR32: error: instruction requires: 64-bit mode
+// ERR16: error: instruction requires: 64-bit mode
diff --git a/test/MC/X86/x86-16.s b/test/MC/X86/x86-16.s
index 9cb800952272fc6c93e74e7474de427d1087d21d..41d068e3d02cee887c5dc4dbe42391dea1c66f4c 100644 (file)
--- a/test/MC/X86/x86-16.s
+++ b/test/MC/X86/x86-16.s
-// RUN: llvm-mc -triple i386-unknown-unknown --show-encoding %s | FileCheck %s
-
- .code16
+// RUN: llvm-mc -triple i386-unknown-unknown-code16 --show-encoding %s | FileCheck %s
movl $0x12345678, %ebx
// CHECK: movl