llvm.org GIT mirror llvm / 7bcec7e
Handle 'a' modifier in X86 asms. PR 4742. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79484 91177308-0d34-0410-b5e6-96231b3b80d8 Dale Johannesen 10 years ago
2 changed file(s) with 30 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
619619
620620 switch (ExtraCode[0]) {
621621 default: return true; // Unknown modifier.
622 case 'a': // This is an address. Currently only 'i' and 'r' are expected.
623 if (MO.isImm()) {
624 O << MO.getImm();
625 return false;
626 } else if (MO.isReg()) {
627 O << '(';
628 printOperand(MI, OpNo);
629 O << ')';
630 return false;
631 }
632 return true;
633
622634 case 'c': // Don't print "$" before a global var name or constant.
623635 if (MO.isImm())
624636 O << MO.getImm();
0 ; RUN: llvm-as < %s | llc | grep {%gs:6}
1 ; RUN: llvm-as < %s | llc | grep {%gs:\\\(%*\\\)}
2 ; ModuleID = 'asm.c'
3 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
4 target triple = "i386-apple-darwin9.6"
5
6 define i32 @main() nounwind {
7 entry:
8 %asmtmp.i = tail call i16 asm "movw\09%gs:${1:a}, ${0:w}", "=r,ir,~{dirflag},~{fpsr},~{flags}"(i32 6) nounwind ; [#uses=1]
9 %0 = zext i16 %asmtmp.i to i32 ; [#uses=1]
10 ret i32 %0
11 }
12
13 define zeroext i16 @readgsword2(i32 %address) nounwind {
14 entry:
15 %asmtmp = tail call i16 asm "movw\09%gs:${1:a}, ${0:w}", "=r,ir,~{dirflag},~{fpsr},~{flags}"(i32 %address) nounwind ; [#uses=1]
16 ret i16 %asmtmp
17 }