mirror of https://github.com/microsoft/clang.git
CodeGen: Let arrays be inputs to inline asm
An array showing up in an inline assembly input is accepted in ICC and GCC 4.8 This fixes PR20201. Differential Revision: http://reviews.llvm.org/D4382 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212954 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5573271b0c
commit
f685eac9e6
|
@ -152,6 +152,12 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
|
|||
diag::err_asm_invalid_lvalue_in_input)
|
||||
<< Info.getConstraintStr()
|
||||
<< InputExpr->getSourceRange());
|
||||
} else {
|
||||
ExprResult Result = DefaultFunctionArrayLvalueConversion(Exprs[i]);
|
||||
if (Result.isInvalid())
|
||||
return StmtError();
|
||||
|
||||
Exprs[i] = Result.get();
|
||||
}
|
||||
|
||||
if (Info.allowsRegister()) {
|
||||
|
@ -163,11 +169,6 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
|
|||
}
|
||||
}
|
||||
|
||||
ExprResult Result = DefaultFunctionArrayLvalueConversion(Exprs[i]);
|
||||
if (Result.isInvalid())
|
||||
return StmtError();
|
||||
|
||||
Exprs[i] = Result.get();
|
||||
InputConstraintInfos.push_back(Info);
|
||||
|
||||
const Type *Ty = Exprs[i]->getType().getTypePtr();
|
||||
|
|
|
@ -239,3 +239,12 @@ void t28(void)
|
|||
// CHECK: call void asm sideeffect "/* $0 */", "i|r,~{dirflag},~{fpsr},~{flags}"(i32 1)
|
||||
}
|
||||
|
||||
static unsigned t29_var[1];
|
||||
|
||||
void t29(void) {
|
||||
asm volatile("movl %%eax, %0"
|
||||
:
|
||||
: "m"(t29_var));
|
||||
// CHECK: @t29
|
||||
// CHECK: call void asm sideeffect "movl %eax, $0", "*m,~{dirflag},~{fpsr},~{flags}"([1 x i32]* @t29_var)
|
||||
}
|
||||
|
|
|
@ -10,3 +10,8 @@ void f() {
|
|||
// expected-error@-5 {{scale factor without index register is ignored}}
|
||||
#endif
|
||||
}
|
||||
|
||||
static unsigned var[1] = {};
|
||||
void g(void) { asm volatile("movd %%xmm0, %0"
|
||||
:
|
||||
: "m"(var)); }
|
||||
|
|
Loading…
Reference in New Issue