llvm.org GIT mirror llvm / a406bce
Merging r300429: ------------------------------------------------------------------------ r300429 | d0k | 2017-04-16 16:13:08 -0400 (Sun, 16 Apr 2017) | 7 lines [X86] Remove special handling for 16 bit for A asm constraints. Our 16 bit support is assembler-only + the terrible hack that is .code16gcc. Simply using 32 bit registers does the right thing for the latter. Fixes PR32681. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_40@301437 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 2 years ago
3 changed file(s) with 11 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
3472134721 if (Subtarget.is64Bit()) {
3472234722 Res.first = X86::RAX;
3472334723 Res.second = &X86::GR64_ADRegClass;
34724 } else if (Subtarget.is32Bit()) {
34724 } else {
34725 assert((Subtarget.is32Bit() || Subtarget.is16Bit()) &&
34726 "Expecting 64, 32 or 16 bit subtarget");
3472534727 Res.first = X86::EAX;
3472634728 Res.second = &X86::GR32_ADRegClass;
34727 } else if (Subtarget.is16Bit()) {
34728 Res.first = X86::AX;
34729 Res.second = &X86::GR16_ADRegClass;
34730 } else {
34731 llvm_unreachable("Expecting 64, 32 or 16 bit subtarget");
3473234729 }
3473334730 return Res;
3473434731 }
437437 (add LOW32_ADDR_ACCESS, RBP)>;
438438
439439 // A class to support the 'A' assembler constraint: [ER]AX then [ER]DX.
440 def GR16_AD : RegisterClass<"X86", [i16], 16, (add AX, DX)>;
441440 def GR32_AD : RegisterClass<"X86", [i32], 32, (add EAX, EDX)>;
442441 def GR64_AD : RegisterClass<"X86", [i64], 64, (add RAX, RDX)>;
443442
1111 ; CHECK: .code16
1212 ; CHECK-LABEL: main
1313
14 define i64 @foo(i32 %index) #0 {
15 %asm = tail call i64 asm "rdmsr", "=A,{cx},~{dirflag},~{fpsr},~{flags}"(i32 %index)
16 ret i64 %asm
17 }
18
19 ; CHECK-LABEL: foo
20 ; CHECK: rdmsr
1421
1522 attributes #0 = { nounwind }
1623
1724 !llvm.ident = !{!0}
1825
19 !0 = !{!"clang version 3.9.0 (trunk 265439) (llvm/trunk 265567)"}
26 !0 = !{!"clang version 3.9.0 (trunk 265439) (llvm/trunk 265567)"}